Skip to content

Commit

Permalink
Fixes event type rule constraints registering as user constraints (#168)
Browse files Browse the repository at this point in the history
* Fixes event type rule constraints registering as user constraints

* Proactively abort if already sent
  • Loading branch information
pushchris authored May 21, 2023
1 parent 8400ea3 commit 4cdf8c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions apps/platform/src/providers/MessageTriggerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export async function loadSendJob<T extends TemplateType>({ campaign_id, user_id
// If user or project is deleted, abort and discard job
if (!user || !project) return

// If there is a send and it's in an aborted state, abort
if (send && send.state === 'aborted') return
// If there is a send and it's in an aborted state or has already
// sent, abort this job to prevent duplicate sends
if (send && (send.state === 'aborted' || send.state === 'sent')) return

// Fetch campaign and templates
const campaign = await Campaign.find(campaign_id)
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/views/users/RuleBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const RuleSet = ({ group, onChange, onDelete }: RuleSetParams) => {
children: [...group.children ?? [], {
path: '',
type: 'string',
group: 'user',
group: group.group,
value: null,
operator: '=',
}],
Expand Down

0 comments on commit 4cdf8c1

Please sign in to comment.