mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
27 lines
681 B
TypeScript
27 lines
681 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import {MessageNotifications} from '@fluxer/constants/src/NotificationConstants';
|
|
|
|
export interface UnreadInboxVisibilityInput {
|
|
unreadBadgesLevel: number | null;
|
|
isMuted: boolean;
|
|
hasUnread: boolean;
|
|
hasMentions: boolean;
|
|
}
|
|
|
|
export function resolveUnreadInboxVisibility(input: UnreadInboxVisibilityInput): boolean {
|
|
if (!input.hasUnread && !input.hasMentions) {
|
|
return false;
|
|
}
|
|
if (input.unreadBadgesLevel === MessageNotifications.NO_MESSAGES) {
|
|
return false;
|
|
}
|
|
if (input.hasMentions) {
|
|
return true;
|
|
}
|
|
if (input.isMuted) {
|
|
return false;
|
|
}
|
|
return input.unreadBadgesLevel !== MessageNotifications.ONLY_MENTIONS;
|
|
}
|