Skip to content

Commit

Permalink
Merge branch 'fix--duplicate-CRT-notifications' of https://github.com…
Browse files Browse the repository at this point in the history
…/zeeshanakram3/orion into fix--duplicate-CRT-notifications
  • Loading branch information
zeeshanakram3 committed Jul 17, 2024
2 parents 7bd4b13 + c9121a8 commit 8f83ffb
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/mappings/token/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,40 @@ export async function notifyChannelFollowersAndTokenHolders(
)
)
}

export async function notifyChannelFollowersAndTokenHolders(

Check failure on line 408 in src/mappings/token/utils.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 18.x)

Multiple exports of name 'notifyChannelFollowersAndTokenHolders'
overlay: EntityManagerOverlay,
channelId: string,
tokenId: string,
notificationType: NotificationType,
event?: Event,
dispatchBlock?: number
) {
const [followersAccounts, holderAccounts] = await Promise.all([
getFollowersAccountsForChannel(overlay, channelId),
getHolderAccountsForToken(overlay, tokenId),
])

// Combine followers and holders, removing duplicates
const allAccounts = [...followersAccounts, ...holderAccounts]
const accounts = Array.from(new Set(allAccounts.map((a) => a.id)))
.map((id) => allAccounts.find((account) => account.id === id))
.filter((account): account is Account => account !== undefined)

const limit = pLimit(10) // Limit to 10 concurrent promises

await Promise.all(
accounts.map((account) =>
limit(() =>
addNotification(
overlay,
account,
new MemberRecipient({ membership: account.membershipId }),
notificationType,
event,
dispatchBlock
)
)
)
)
}

0 comments on commit 8f83ffb

Please sign in to comment.