Skip to content

Commit

Permalink
enhance: 通知が凍結も考慮するようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
tai-cha committed Feb 19, 2024
1 parent 35609b4 commit b1e57e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
notifications = notifications.filter(notification => !excludeTypes.includes(notification.type));
}

//#region Check muting
//#region Check muting & suspended

const [
userIdsWhoMeMuting,
Expand All @@ -128,10 +128,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (notifier === null) return null;
if (notifier.host && userMutedInstances.has(notifier.host)) return null;

if (notifier.isSuspended) return null;

return notification;
}))).filter((notification): notification is MiNotification => notification !== null);

//#endregion Check muting
//#endregion Check muting & suspended

if (notifications.length === 0) {
return [];
Expand Down
6 changes: 4 additions & 2 deletions packages/backend/src/server/api/endpoints/i/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
notifications = notifications.filter(notification => !excludeTypes.includes(notification.type));
}

//#region Check muting
//#region Check muting & suspended

const [
userIdsWhoMeMuting,
Expand All @@ -126,10 +126,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (notifier === null) return null;
if (notifier.host && userMutedInstances.has(notifier.host)) return null;

if (notifier.isSuspended) return null;

return notification;
}))).filter((notification): notification is MiNotification => notification !== null);

//#endregion Check muting
//#endregion Check muting & suspended

if (notifications.length === 0) {
return [];
Expand Down

0 comments on commit b1e57e5

Please sign in to comment.