Reddit warnings: count posts recorded by Supermarket when Reddit can't be asked

Without Reddit's API (no approved app), the account's history is unknown,
so posts marked as posted didn't count. Now the Reddit posts Supermarket
published or recorded feed the "posted in this subreddit in the past
week" warning in that case. They aren't the whole account, so the
own-link share and new-account warnings still need the API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 11:52:45 -07:00
co-authored by Claude Opus 5.5
parent 013e30bf40
commit 3c62f780bb
3 changed files with 57 additions and 3 deletions
+5 -1
View File
@@ -119,6 +119,10 @@ func (s *Server) redditViews(ctx context.Context, drafts []content.Draft) map[in
var history []reddit.Submission
historyRead := false
tags := s.tagger()
recorded, err := content.RecordedRedditPosts(s.DB, time.Now().Add(-8*24*time.Hour))
if err != nil {
s.Log.Error("reading recorded Reddit posts", "err", err)
}
for _, d := range drafts {
if d.Channel != content.ChannelReddit {
continue
@@ -131,7 +135,7 @@ func (s *Server) redditViews(ctx context.Context, drafts []content.Draft) map[in
}
info, _ := content.GetSubreddit(s.DB, d.Target)
check := content.RedditCheck{Target: d.Target, HasLink: d.SourceURL != "", Info: info, History: history, Now: time.Now(),
Promo: d.Kind == content.KindProduct}
Promo: d.Kind == content.KindProduct, Recorded: recorded}
if tags != nil {
check.Own = tags.Own
check.OwnLink = tags.Own(d.SourceURL) || tags.HasOwnLink(d.Content)