Skip to content

Commit

Permalink
fix: CRT notifications bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanakram3 committed Mar 7, 2024
1 parent 0bd120b commit fdb1684
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/mappings/token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export async function processAmmActivatedEvent({
channelTitle: parseChannelTitle(channel),
})

await notifyTokenHolders(overlay.getEm(), tokenId.toString(), notificationData, eventEntity)
await notifyTokenHolders(overlay, tokenId.toString(), notificationData, eventEntity)
await notifyChannelFollowers(overlay, channel.id, notificationData, eventEntity)
}

Expand Down Expand Up @@ -330,7 +330,7 @@ export async function processTokenSaleInitializedEvent({
channelTitle: parseChannelTitle(channel),
})

await notifyTokenHolders(overlay.getEm(), tokenId.toString(), notificationData, eventEntity)
await notifyTokenHolders(overlay, tokenId.toString(), notificationData, eventEntity)
await notifyChannelFollowers(overlay, channel.id, notificationData, eventEntity)
}

Expand Down Expand Up @@ -640,7 +640,7 @@ export async function processRevenueSplitIssuedEvent({
tokenSymbol: parseCreatorTokenSymbol(token),
})
await notifyTokenHolders(
overlay.getEm(),
overlay,
tokenId.toString(),
revenueShareStartedNotification,
undefined,
Expand All @@ -657,7 +657,7 @@ export async function processRevenueSplitIssuedEvent({
tokenSymbol: parseCreatorTokenSymbol(token),
})

await notifyTokenHolders(overlay.getEm(), tokenId.toString(), revenueSharePlannedNotification)
await notifyTokenHolders(overlay, tokenId.toString(), revenueSharePlannedNotification)
}

const revenueSharedEndedNotification = new CreatorTokenRevenueShareEnded({
Expand All @@ -668,7 +668,7 @@ export async function processRevenueSplitIssuedEvent({
tokenId: tokenId.toString(),
})
await notifyTokenHolders(
overlay.getEm(),
overlay,
tokenId.toString(),
revenueSharedEndedNotification,
undefined,
Expand Down
6 changes: 3 additions & 3 deletions src/mappings/token/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ITokenMetadata } from '@joystream/metadata-protobuf'
import { DecodedMetadataObject } from '@joystream/metadata-protobuf/types'
import { isSet } from '@joystream/metadata-protobuf/utils'
import pLimit from 'p-limit'
import { EntityManager } from 'typeorm'
import {
Account,
Benefit,
Expand Down Expand Up @@ -321,9 +320,10 @@ export async function processTokenMetadata(
}

export async function getHolderAccountsForToken(
em: EntityManager,
overlay: EntityManagerOverlay,
tokenId: string
): Promise<Account[]> {
const em = overlay.getEm()
const holders = await em.getRepository(TokenAccount).findBy({ tokenId })

const holdersMemberIds = holders
Expand All @@ -341,7 +341,7 @@ export async function getHolderAccountsForToken(
}

export async function notifyTokenHolders(
em: EntityManager,
em: EntityManagerOverlay,
tokenId: string,
notificationType: NotificationType,
event?: Event,
Expand Down

0 comments on commit fdb1684

Please sign in to comment.