Post Reddit drafts by hand: Open in Reddit, Copy text, Mark as posted

Reddit now approves API apps before they get keys, so Supermarket may not
be able to post there for a while. Each Reddit draft in the Inbox can be
posted by hand instead:

- Open in Reddit saves the edits and opens old.reddit.com's submit page
  for the subreddit in a new tab, with the title and text filled in, the
  source link added and own-site links UTM-tagged as publishing would.
  Links-only subreddits get a link post. Over ~7500 characters the text
  is left out of the address.
- Copy text copies the draft's current text.
- Mark as posted (with the post's link, optional) moves it to Published
  and into the Reddit history used for warnings.

Copy buttons now copy a field's current value, not its first text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 11:51:16 -07:00
co-authored by Claude Opus 5.5
parent 9c62680927
commit 013e30bf40
7 changed files with 171 additions and 10 deletions
+24 -5
View File
@@ -60,11 +60,7 @@ func Publish(ctx context.Context, d *db.DB, pubs Publishers, tags *utm.Tagger, i
return dr, err
}
text, src := dr.Content, dr.SourceURL
if tags != nil {
p := dr.UTM()
text, src = tags.Text(text, p), tags.URL(src, p)
}
text, src := Manual(dr, tags)
postURL, pubErr := pub.Publish(ctx, Post{Text: text, SourceURL: src, Title: dr.Title, Target: dr.Target})
now := formatTime(time.Now())
if pubErr != nil {
@@ -92,3 +88,26 @@ func (d *Draft) UTM() utm.Params {
}
return utm.Params{Source: d.Channel, Medium: "social", Campaign: d.Kind, Content: content}
}
// MarkPosted records a draft the user posted by hand (on a network
// Supermarket can't post to for them), with the post's address if they
// gave one.
func MarkPosted(d *db.DB, id int64, postURL string) error {
now := formatTime(time.Now())
res, err := d.Exec(`UPDATE drafts SET status = ?, error = '', post_url = ?, published_at = ?, updated_at = ?
WHERE id = ? AND status IN (?, ?, ?)`,
StatusPublished, postURL, now, now, id, StatusDraft, StatusFailed, StatusScheduled)
return oneRow(res, err)
}
// Manual is a draft as it would be published, for posting by hand: links
// to the company's sites tagged, and the source link added the way the
// channel's publisher would add it.
func Manual(dr *Draft, tags *utm.Tagger) (text, sourceURL string) {
text, sourceURL = dr.Content, dr.SourceURL
if tags != nil {
p := dr.UTM()
text, sourceURL = tags.Text(text, p), tags.URL(sourceURL, p)
}
return text, sourceURL
}