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:
2026-11-21 12:50:06 -07:00
co-authored by Claude Opus 5.5
parent 7733672706
commit 4b2d791909
21 changed files with 273 additions and 73 deletions
+9 -9
View File
@@ -16,9 +16,9 @@ import (
"supermarket/internal/utm"
)
// --- The Inbox: everything waiting for the user's approval ---
// --- Posts: everything waiting for the user's approval ---
// inboxSection is one module's share of the Inbox. Later phases add their
// inboxSection is one module's share of Posts. Later phases add their
// own (prospects to send to the CRM, SEO changes to open as pull requests).
type inboxSection struct {
Module string
@@ -95,7 +95,7 @@ func (s *Server) renderInbox(w http.ResponseWriter, r *http.Request, errMsg stri
if len(pending) > 0 {
sections = append(sections, inboxSection{Module: "Content", Batches: groupBatches(pending)})
}
s.render(w, r, "inbox", page{Title: "Inbox", Nav: "content/inbox", Error: errMsg, Data: map[string]any{
s.render(w, r, "inbox", page{Title: "Posts", Nav: "content/posts", Error: errMsg, Data: map[string]any{
"Reminders": s.reminders(),
"Sections": sections,
"Reddit": s.redditViews(r.Context(), pending),
@@ -106,7 +106,7 @@ func (s *Server) renderInbox(w http.ResponseWriter, r *http.Request, errMsg stri
}})
}
// redditView is what the Inbox shows with a Reddit draft.
// redditView is what Posts shows with a Reddit draft.
type redditView struct {
Info *reddit.Subreddit
Warnings []string
@@ -153,7 +153,7 @@ func (s *Server) refreshRules(w http.ResponseWriter, r *http.Request) {
s.renderInbox(w, r, "Couldn't read the subreddit's rules: "+err.Error())
return
}
redirect(w, r, "/inbox", "rules-refreshed")
redirect(w, r, "/posts", "rules-refreshed")
}
// The Content module's own lists of approved and published drafts.
@@ -213,9 +213,9 @@ func (s *Server) draftAction(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
// Where the form was: the Inbox, or the Scheduled list.
// Where the form was: Posts, or the Scheduled list.
fromScheduled := r.PostForm.Get("from") == "scheduled"
back := "/inbox"
back := "/posts"
if fromScheduled {
back = "/content/scheduled"
}
@@ -315,7 +315,7 @@ func (s *Server) draftAction(w http.ResponseWriter, r *http.Request) {
fail(err)
return
}
redirect(w, r, "/inbox", "unscheduled")
redirect(w, r, "/posts", "unscheduled")
case "discard":
if err := content.DiscardDraft(s.DB, id); err != nil {
fail(err)
@@ -389,7 +389,7 @@ func (s *Server) publishDue(ctx context.Context, now time.Time) {
if err != nil {
// A failed post is recorded on the draft by Publish. One refused
// before posting (not connected, too long) is still scheduled:
// send it back to the Inbox rather than retry it forever.
// send it back to Posts rather than retry it forever.
if ferr := content.FailScheduled(s.DB, d.ID, err.Error()); ferr != nil && !errors.Is(ferr, content.ErrNotEditable) {
s.Log.Error("scheduler: recording a failure", "draft", d.ID, "err", ferr)
}