Skip to content

Commit

Permalink
fix: display notice to supervols
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohn25 committed Aug 2, 2023
1 parent 0f4a310 commit 9c7b0ce
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/server/lib/notices/register-10dlc-brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const get10DlcBrandNotices: OrgLevelNotificationGetter = async (
user_id: userId,
active: true
})
.whereIn("role", ["OWNER", "ADMIN"])
.whereIn("role", ["OWNER", "ADMIN", "SUPERVOLUNTEER"])
.where({
"user_organization.organization_id": organizationId
});
Expand Down Expand Up @@ -110,7 +110,11 @@ export const get10DlcBrandNotices: OrgLevelNotificationGetter = async (
}
];

const { messaging_service_sid: messagingServiceSid } = ownedProfiles[0];
const messagingServiceSid =
ownedProfiles.length > 0
? ownedProfiles[0].messaging_service_sid
: profiles[0].messaging_service_sid;

let brand: { campaigns: { nodes: { state: string }[] } } | undefined;

for (const profile of profiles) {
Expand Down Expand Up @@ -150,7 +154,10 @@ export const get10DlcBrandNotices: OrgLevelNotificationGetter = async (
{
__typename: "Register10DlcBrandNotice",
id: messagingServiceSid,
tcrRegistrationUrl: `https://portal.spokerewired.com/10dlc-registration/${messagingServiceSid}`
tcrRegistrationUrl:
ownedProfiles.length > 0
? `https://portal.spokerewired.com/10dlc-registration/${messagingServiceSid}`
: null
}
];

Expand All @@ -164,7 +171,10 @@ export const get10DlcBrandNotices: OrgLevelNotificationGetter = async (
{
__typename: "Register10DlcCampaignNotice",
id: messagingServiceSid,
tcrRegistrationUrl: `https://portal.spokerewired.com/10dlc-registration/${messagingServiceSid}`
tcrRegistrationUrl:
ownedProfiles.length > 0
? `https://portal.spokerewired.com/10dlc-registration/${messagingServiceSid}`
: null
}
];

Expand Down

0 comments on commit 9c7b0ce

Please sign in to comment.