feat(campaign-builder): allow unstarting campaign - #250
Conversation
| ); | ||
| } | ||
|
|
||
| const [campaign] = await r |
There was a problem hiding this comment.
Do we we also stop any queued autosend jobs here? Thinking about the case where messages already waiting in the queue could still be sent after the campaign is unstarted, even though no message records exist yet
There was a problem hiding this comment.
Great catch! I think rather than deleting the jobs, we should just check autosend_status = unstarted as a condition alongside the message one, I think it's fair to say once they hit "start sending" the campaign is truly started and we won't let them unstart at that point
| }; | ||
|
|
||
| export const hasSentMessages = async (campaignId: string) => { | ||
| const { rows } = await r.reader.raw( |
There was a problem hiding this comment.
Curious about the use of r.reader.raw here instead of r.knex.raw. This might be intentional, but wouldn’t it make sense to check the primary db so we don’t miss a recently created message?
There was a problem hiding this comment.
Yep totally makes sense. tbh i think the way it's been used in the codebase for the most part has been very simplistic "reads -> reader, writes -> knex" so i'll fix this and make a followup issue for more comprehensive review of other places this could happen which is definitely needed 😅
Description
This adds an unstart button to the campaign builder page - when a started campaign is shown and no messages have been sent for the campaign yet
Additionally, it keeps the archive button on the page when a campaign is started
Motivation and Context
Admins sometimes start a campaign by accident and end up having to copy the campaign when for example they uploaded the wrong list. Additionally, archiving a campaign after it's started is a common workflow, so having the Archive button hidden didn't really make sense
How Has This Been Tested?
This has been tested locally
Screenshots (if appropriate):
Documentation Changes
Checklist: