LinkedIn publishing works again; rename Inbox to Posts
LinkedIn: - The API version was fixed at 202501, retired by LinkedIn (426 NONEXISTENT_VERSION). It's now the month before last, stepping back a month (up to four) if LinkedIn says a version isn't active. - The versioned Posts API needs a title for a link's article card (422). Supermarket reads the linked page's title and description and sends them, falling back to the page's address as the title. Tested for real: a post with a link went out to the member's profile. Inbox is now Posts: the menu, page, messages and docs; the page moves to /posts, and /inbox redirects there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,10 +94,10 @@ func TestDraftsPage(t *testing.T) {
|
||||
ids[d.Channel] = strconv.FormatInt(d.ID, 10)
|
||||
}
|
||||
|
||||
if rec := do(h, http.MethodGet, "/drafts?msg=drafted", nil, nil); rec.Code != http.StatusSeeOther || rec.Header().Get("Location") != "/inbox?msg=drafted" {
|
||||
if rec := do(h, http.MethodGet, "/drafts?msg=drafted", nil, nil); rec.Code != http.StatusSeeOther || rec.Header().Get("Location") != "/posts?msg=drafted" {
|
||||
t.Errorf("old drafts page: %d %s", rec.Code, rec.Header().Get("Location"))
|
||||
}
|
||||
rec := do(h, http.MethodGet, "/inbox", nil, nil)
|
||||
rec := do(h, http.MethodGet, "/posts", nil, nil)
|
||||
body := rec.Body.String()
|
||||
if rec.Code != 200 || strings.Index(body, "X text") > strings.Index(body, "LinkedIn text") ||
|
||||
!strings.Contains(body, "31 / 280 including the link") || !strings.Contains(body, `data-reserve="25"`) ||
|
||||
@@ -162,7 +162,7 @@ func TestScheduleFromInbox(t *testing.T) {
|
||||
if !strings.Contains(body, "Soon, edited") || !strings.Contains(body, when.Format("15:04")) || !strings.Contains(body, "not connected") {
|
||||
t.Errorf("scheduled page:\n%s", body)
|
||||
}
|
||||
if !strings.Contains(do(h, http.MethodGet, "/inbox", nil, nil).Body.String(), "Nothing waiting") {
|
||||
if !strings.Contains(do(h, http.MethodGet, "/posts", nil, nil).Body.String(), "Nothing waiting") {
|
||||
t.Error("a scheduled draft is still in the Inbox")
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ func TestRedditInInbox(t *testing.T) {
|
||||
Rules: []reddit.Rule{{Name: "No self-promotion", Description: "Limit it."}}, FetchedAt: time.Now()}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body := do(h, http.MethodGet, "/inbox", nil, nil).Body.String()
|
||||
body := do(h, http.MethodGet, "/posts", nil, nil).Body.String()
|
||||
for _, want := range []string{"Reddit r/selfhosted", `name="title" value="Jitsi 3"`, "Flair it.", "No self-promotion",
|
||||
"has a rule about this", "Couldn't read r/homelab's rules", `action="/reddit/rules/homelab"`, "Read rules", "text only"} {
|
||||
if !strings.Contains(body, want) {
|
||||
@@ -334,7 +334,7 @@ func TestPostRedditByHand(t *testing.T) {
|
||||
for _, d := range ds {
|
||||
ids[d.Target] = strconv.FormatInt(d.ID, 10)
|
||||
}
|
||||
if body := do(h, http.MethodGet, "/inbox", nil, nil).Body.String(); !strings.Contains(body, "Open in Reddit") ||
|
||||
if body := do(h, http.MethodGet, "/posts", nil, nil).Body.String(); !strings.Contains(body, "Open in Reddit") ||
|
||||
!strings.Contains(body, "can't post to Reddit for you yet") || !strings.Contains(body, `action="/drafts/`+ids["selfhosted"]+`/posted"`) {
|
||||
t.Error("inbox lacks the by-hand controls")
|
||||
}
|
||||
@@ -381,7 +381,7 @@ func TestPostRedditByHand(t *testing.T) {
|
||||
// Supermarket's own record; nothing about the whole account is claimed.
|
||||
_, _ = content.CreateDrafts(s.DB, []content.Draft{{InventoryName: "Acme", Kind: "product", Channel: content.ChannelReddit,
|
||||
Title: "Again", Target: "selfhosted", Content: "More."}})
|
||||
body := do(h, http.MethodGet, "/inbox", nil, nil).Body.String()
|
||||
body := do(h, http.MethodGet, "/posts", nil, nil).Body.String()
|
||||
if !strings.Contains(body, "You posted in r/selfhosted 1 time in the past week through Supermarket") {
|
||||
t.Error("no same-subreddit warning from the recorded post")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user