Phase 10, part 7: posting accounts, and who may post to which
Social accounts become posting accounts: several per network, the company's and each person's own, with their tokens kept per account. The old sign-ins are adopted as the company's. Admins say who may post to which (Settings → Posting accounts); a draft can go out from one account or a copy to several, each recording who posted it and as what. Signing an account out, or removing its owner, holds the posts scheduled to it and tells whoever scheduled them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+97
-87
@@ -28,10 +28,12 @@ import (
|
||||
"supermarket/internal/api/reddit"
|
||||
"supermarket/internal/api/twitter"
|
||||
"supermarket/internal/appmail"
|
||||
"supermarket/internal/content"
|
||||
"supermarket/internal/core"
|
||||
"supermarket/internal/db"
|
||||
"supermarket/internal/legacy"
|
||||
"supermarket/internal/metrics"
|
||||
"supermarket/internal/posting"
|
||||
"supermarket/internal/prospects"
|
||||
"supermarket/internal/secrets"
|
||||
"supermarket/internal/seo"
|
||||
@@ -74,6 +76,8 @@ type Server struct {
|
||||
jobsOnce sync.Once
|
||||
setupDone atomic.Bool // the team has its owner (server edition)
|
||||
|
||||
testPublisher func(*posting.Account) content.Publisher // tests: posts nowhere
|
||||
|
||||
// Reddit: an app-only token for reading rules before sign-in, and the
|
||||
// account's recent posts for the warnings.
|
||||
redditAppToken string
|
||||
@@ -338,6 +342,10 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
mux.HandleFunc("POST /settings/backups/upload", s.backupUpload)
|
||||
mux.HandleFunc("GET /settings/about", s.aboutPage)
|
||||
mux.HandleFunc("GET /settings/connections", s.connectionsPage)
|
||||
mux.HandleFunc("GET /settings/posting", s.postingPage)
|
||||
mux.HandleFunc("POST /settings/posting", s.postingSave)
|
||||
mux.HandleFunc("POST /settings/posting/{id}/remove", s.postingRemove)
|
||||
mux.HandleFunc("POST /settings/account/posting/{id}/remove", s.postingRemove)
|
||||
mux.HandleFunc("GET /settings/core", s.corePage)
|
||||
mux.HandleFunc("GET /settings/core/checks", s.coreChecks)
|
||||
|
||||
@@ -659,93 +667,95 @@ func (s *Server) fragment(w http.ResponseWriter, r *http.Request, page, name str
|
||||
|
||||
// Messages shown after a redirect, by code, so no user text is reflected.
|
||||
var flashes = map[string]string{
|
||||
"saved": "Saved.",
|
||||
"welcome": "Welcome: you're the owner. Start with the company's profile.",
|
||||
"signed-out": "Signed out.",
|
||||
"password-reset": "Your new password is saved: sign in with it.",
|
||||
"password-changed": "Password changed. You're signed out everywhere else.",
|
||||
"session-ended": "Signed out there.",
|
||||
"sessions-ended": "Signed out everywhere else.",
|
||||
"two-factor-off": "Two-factor sign-in is off.",
|
||||
"codes-low": "You're running out of recovery codes: make new ones below.",
|
||||
"invited": "Invitation sent.",
|
||||
"withdrawn": "Invitation withdrawn.",
|
||||
"disabled": "The account is turned off, and signed out.",
|
||||
"enabled": "The account is back on.",
|
||||
"unlocked": "Unlocked.",
|
||||
"two-factor-reset": "Two-factor sign-in is reset: they sign in with their password, then can turn it on again.",
|
||||
"signed-out-user": "Signed out everywhere.",
|
||||
"removed": "Removed.",
|
||||
"joined": "Welcome to Supermarket.",
|
||||
"deleted": "Deleted.",
|
||||
"x-connected": "X is connected.",
|
||||
"li-connected": "LinkedIn is connected.",
|
||||
"site-created": "The site is started: its first commit is on Gitea. Build its first pages below.",
|
||||
"li-page-connected": "The LinkedIn page app is connected.",
|
||||
"google-connected": "Search Console is connected. Choose each website's property below, then sync.",
|
||||
"synced": "Synced from Search Console.",
|
||||
"report-written": "This week's report is written.",
|
||||
"setup-opened": "Pull request opened: read it on Gitea, then merge it.",
|
||||
"pinged": "Sent to IndexNow.",
|
||||
"brief-written": "Brief written. Read it, answer its questions, then write the page.",
|
||||
"page-written": "Page drafted. Read it, and confirm or remove every sentence that claims an experience.",
|
||||
"keywords-found": "Looked for keywords: the candidates are below.",
|
||||
"top-read": "Read the live top results.",
|
||||
"proposed": "Proposed: read each one, edit it if you like, then say yes or no.",
|
||||
"approved": "Approved: Supermarket is making the pull request; it shows here in a minute.",
|
||||
"declined": "Declined.",
|
||||
"keyword-picked": "Picked. Write its brief when you're ready.",
|
||||
"keyword-dismissed": "Dismissed: it's under Dismissed if you change your mind.",
|
||||
"keyword-back": "Back among the candidates.",
|
||||
"signups-saved": "Saved. The pages' sign-ups were read again with it.",
|
||||
"next-dismissed": "Hidden for 90 days.",
|
||||
"link-added": "Added, and checked.",
|
||||
"links-checked": "Checked %d links.",
|
||||
"link-forgotten": "Forgotten.",
|
||||
"partners-read": "Looked at the partners' pages: %d new places to ask for a link.",
|
||||
"alternatives-read": "Searched: %d new lists that leave you out.",
|
||||
"optouts-synced": "Synced: %d new on the suppression list.",
|
||||
"listed": "Added to the mailing list.",
|
||||
"bing-read": "Read the links from Bing.",
|
||||
"audited": "The audit is done.",
|
||||
"auditing": "Auditing. It reads up to 300 pages politely, so it takes a few minutes; this page updates when it's done.",
|
||||
"no-data": "There isn't two weeks of Search Console data yet.",
|
||||
"reddit-connected": "Reddit is connected.",
|
||||
"crm-test": "Test Lead queued. Hermes creates it on its next run; or run it now (below).",
|
||||
"crm-sync": "Sync requested: Hermes copies CRM records on its next run.",
|
||||
"accepted": "Accepted: queued for the CRM. Hermes adds it on its next run.",
|
||||
"rejected": "Set aside.",
|
||||
"reconsidered": "Back in New.",
|
||||
"suppressed": "Added to the suppression list.",
|
||||
"unsuppressed": "Taken off the suppression list.",
|
||||
"prospect-added": "Added. Review it below.",
|
||||
"crm-retried": "Queued again: Hermes tries it on its next run.",
|
||||
"crm-cancelled": "Taken back: Hermes won't do it.",
|
||||
"prospect-exists": "Already there: nothing new was added. It's in the list below.",
|
||||
"outcome": "Outcome recorded.",
|
||||
"discovering": "Searching. It takes a few minutes; new companies appear in Review, tagged with this signal.",
|
||||
"rules-refreshed": "Rules refreshed.",
|
||||
"imported": "Imported.",
|
||||
"imported-counts": "Imported: %d new steps in the funnel, %d new people to review, %d new on the suppression list.",
|
||||
"hunter-done": "Hunter.io search done: the result is on the card.",
|
||||
"verified": "Checked with Hunter.io: the result is on each person.",
|
||||
"drafted-outreach": "Drafted. Read it, edit it, then queue it to send.",
|
||||
"queued": "Queued: it goes out in turn, within your sending hours.",
|
||||
"unqueued": "Back in Drafts.",
|
||||
"sent": "Sent.",
|
||||
"marked-sent": "Marked as sent.",
|
||||
"reply-recorded": "Reply recorded.",
|
||||
"checked": "Inbox checked: what it found is above.",
|
||||
"test-sent": "Test email sent: check your inbox.",
|
||||
"oauth-expired": "That sign-in took too long or was already used. Try again.",
|
||||
"dismissed": "Dismissed.",
|
||||
"restored": "Restored.",
|
||||
"drafted": "Drafts written. Review them below.",
|
||||
"published": "Published.",
|
||||
"discarded": "Discarded.",
|
||||
"scheduled": "Scheduled.",
|
||||
"posted": "Marked as posted: it's under Content → Published.",
|
||||
"unscheduled": "Back in Posts: edit it, then publish or schedule it again.",
|
||||
"saved": "Saved.",
|
||||
"welcome": "Welcome: you're the owner. Start with the company's profile.",
|
||||
"signed-out": "Signed out.",
|
||||
"password-reset": "Your new password is saved: sign in with it.",
|
||||
"password-changed": "Password changed. You're signed out everywhere else.",
|
||||
"session-ended": "Signed out there.",
|
||||
"sessions-ended": "Signed out everywhere else.",
|
||||
"two-factor-off": "Two-factor sign-in is off.",
|
||||
"codes-low": "You're running out of recovery codes: make new ones below.",
|
||||
"invited": "Invitation sent.",
|
||||
"withdrawn": "Invitation withdrawn.",
|
||||
"disabled": "The account is turned off, and signed out.",
|
||||
"enabled": "The account is back on.",
|
||||
"unlocked": "Unlocked.",
|
||||
"two-factor-reset": "Two-factor sign-in is reset: they sign in with their password, then can turn it on again.",
|
||||
"signed-out-user": "Signed out everywhere.",
|
||||
"removed": "Removed.",
|
||||
"joined": "Welcome to Supermarket.",
|
||||
"account-removed": "Signed out: posts scheduled to it are back in Posts.",
|
||||
"own-account-connected": "Connected: you can post as it, and an admin can let others.",
|
||||
"deleted": "Deleted.",
|
||||
"x-connected": "X is connected.",
|
||||
"li-connected": "LinkedIn is connected.",
|
||||
"site-created": "The site is started: its first commit is on Gitea. Build its first pages below.",
|
||||
"li-page-connected": "The LinkedIn page app is connected.",
|
||||
"google-connected": "Search Console is connected. Choose each website's property below, then sync.",
|
||||
"synced": "Synced from Search Console.",
|
||||
"report-written": "This week's report is written.",
|
||||
"setup-opened": "Pull request opened: read it on Gitea, then merge it.",
|
||||
"pinged": "Sent to IndexNow.",
|
||||
"brief-written": "Brief written. Read it, answer its questions, then write the page.",
|
||||
"page-written": "Page drafted. Read it, and confirm or remove every sentence that claims an experience.",
|
||||
"keywords-found": "Looked for keywords: the candidates are below.",
|
||||
"top-read": "Read the live top results.",
|
||||
"proposed": "Proposed: read each one, edit it if you like, then say yes or no.",
|
||||
"approved": "Approved: Supermarket is making the pull request; it shows here in a minute.",
|
||||
"declined": "Declined.",
|
||||
"keyword-picked": "Picked. Write its brief when you're ready.",
|
||||
"keyword-dismissed": "Dismissed: it's under Dismissed if you change your mind.",
|
||||
"keyword-back": "Back among the candidates.",
|
||||
"signups-saved": "Saved. The pages' sign-ups were read again with it.",
|
||||
"next-dismissed": "Hidden for 90 days.",
|
||||
"link-added": "Added, and checked.",
|
||||
"links-checked": "Checked %d links.",
|
||||
"link-forgotten": "Forgotten.",
|
||||
"partners-read": "Looked at the partners' pages: %d new places to ask for a link.",
|
||||
"alternatives-read": "Searched: %d new lists that leave you out.",
|
||||
"optouts-synced": "Synced: %d new on the suppression list.",
|
||||
"listed": "Added to the mailing list.",
|
||||
"bing-read": "Read the links from Bing.",
|
||||
"audited": "The audit is done.",
|
||||
"auditing": "Auditing. It reads up to 300 pages politely, so it takes a few minutes; this page updates when it's done.",
|
||||
"no-data": "There isn't two weeks of Search Console data yet.",
|
||||
"reddit-connected": "Reddit is connected.",
|
||||
"crm-test": "Test Lead queued. Hermes creates it on its next run; or run it now (below).",
|
||||
"crm-sync": "Sync requested: Hermes copies CRM records on its next run.",
|
||||
"accepted": "Accepted: queued for the CRM. Hermes adds it on its next run.",
|
||||
"rejected": "Set aside.",
|
||||
"reconsidered": "Back in New.",
|
||||
"suppressed": "Added to the suppression list.",
|
||||
"unsuppressed": "Taken off the suppression list.",
|
||||
"prospect-added": "Added. Review it below.",
|
||||
"crm-retried": "Queued again: Hermes tries it on its next run.",
|
||||
"crm-cancelled": "Taken back: Hermes won't do it.",
|
||||
"prospect-exists": "Already there: nothing new was added. It's in the list below.",
|
||||
"outcome": "Outcome recorded.",
|
||||
"discovering": "Searching. It takes a few minutes; new companies appear in Review, tagged with this signal.",
|
||||
"rules-refreshed": "Rules refreshed.",
|
||||
"imported": "Imported.",
|
||||
"imported-counts": "Imported: %d new steps in the funnel, %d new people to review, %d new on the suppression list.",
|
||||
"hunter-done": "Hunter.io search done: the result is on the card.",
|
||||
"verified": "Checked with Hunter.io: the result is on each person.",
|
||||
"drafted-outreach": "Drafted. Read it, edit it, then queue it to send.",
|
||||
"queued": "Queued: it goes out in turn, within your sending hours.",
|
||||
"unqueued": "Back in Drafts.",
|
||||
"sent": "Sent.",
|
||||
"marked-sent": "Marked as sent.",
|
||||
"reply-recorded": "Reply recorded.",
|
||||
"checked": "Inbox checked: what it found is above.",
|
||||
"test-sent": "Test email sent: check your inbox.",
|
||||
"oauth-expired": "That sign-in took too long or was already used. Try again.",
|
||||
"dismissed": "Dismissed.",
|
||||
"restored": "Restored.",
|
||||
"drafted": "Drafts written. Review them below.",
|
||||
"published": "Published.",
|
||||
"discarded": "Discarded.",
|
||||
"scheduled": "Scheduled.",
|
||||
"posted": "Marked as posted: it's under Content → Published.",
|
||||
"unscheduled": "Back in Posts: edit it, then publish or schedule it again.",
|
||||
}
|
||||
|
||||
// sentence starts a message with a capital letter: errors from deeper
|
||||
|
||||
Reference in New Issue
Block a user