mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-18 21:20:55 -05:00
Fix new badge notifications not correct
This commit is contained in:
parent
155750c16a
commit
0faac11560
|
|
@ -76,15 +76,14 @@ export const action: ActionFunction = async ({ request, params }) => {
|
|||
"No permissions to edit owners",
|
||||
);
|
||||
|
||||
const oldOwners = await BadgeRepository.findOwnersByBadgeId(badgeId);
|
||||
const oldOwners: number[] = (
|
||||
await BadgeRepository.findOwnersByBadgeId(badgeId)
|
||||
).flatMap((owner) => new Array(owner.count).fill(owner.id));
|
||||
|
||||
await BadgeRepository.replaceOwners({ badgeId, ownerIds: data.ownerIds });
|
||||
|
||||
notify({
|
||||
userIds: diff(
|
||||
oldOwners.map((o) => o.id),
|
||||
data.ownerIds,
|
||||
),
|
||||
userIds: diff(oldOwners, data.ownerIds),
|
||||
notification: {
|
||||
type: "BADGE_ADDED",
|
||||
meta: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user