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
+5 -5
View File
@@ -51,7 +51,7 @@ func ChannelByID(id string) (Channel, bool) {
// Draft statuses.
const (
StatusDraft = "draft" // waiting for review, in the Inbox
StatusDraft = "draft" // waiting for review, in Posts
StatusScheduled = "scheduled" // approved, goes out at PublishAt
StatusPublishing = "publishing" // claimed by a publish in progress
StatusPublished = "published"
@@ -320,7 +320,7 @@ func Schedule(d *db.DB, id int64, at time.Time) error {
return oneRow(res, err)
}
// Unschedule sends a scheduled draft back to the Inbox, to edit or drop.
// Unschedule sends a scheduled draft back to Posts, to edit or drop.
func Unschedule(d *db.DB, id int64) error {
res, err := d.Exec(`UPDATE drafts SET status = ?, publish_at = NULL, updated_at = ? WHERE id = ? AND status = ?`,
StatusDraft, formatTime(time.Now()), id, StatusScheduled)
@@ -329,11 +329,11 @@ func Unschedule(d *db.DB, id int64) error {
// MaxLate is how late a scheduled post may still go out, if the app was
// stopped when it was due. Later than that, news is stale: it goes back to
// the Inbox instead.
// Posts instead.
const MaxLate = 12 * time.Hour
// Due returns the scheduled drafts whose time has come, oldest first. Ones
// more than MaxLate overdue are sent back to the Inbox with a note.
// more than MaxLate overdue are sent back to Posts with a note.
func Due(d *db.DB, now time.Time) ([]Draft, error) {
if _, err := d.Exec(`UPDATE drafts SET status = ?, error = ?, updated_at = ?
WHERE status = ? AND publish_at < ?`,
@@ -350,7 +350,7 @@ func Due(d *db.DB, now time.Time) ([]Draft, error) {
}
// FailScheduled sends a scheduled draft that couldn't go out (its channel
// was signed out, say) back to the Inbox with the reason.
// was signed out, say) back to Posts with the reason.
func FailScheduled(d *db.DB, id int64, reason string) error {
res, err := d.Exec(`UPDATE drafts SET status = ?, error = ?, updated_at = ? WHERE id = ? AND status = ?`,
StatusFailed, reason, formatTime(time.Now()), id, StatusScheduled)