This commit is contained in:
syuilo 2023-11-01 12:46:51 +09:00
parent 42aec3c21e
commit c6808701e1
9 changed files with 14 additions and 14 deletions

View File

@ -471,7 +471,7 @@ export class UserEntityService implements OnModuleInit {
hasUnreadChannel: false, // 後方互換性のため
hasUnreadNotification: notificationsInfo?.hasUnread, // 後方互換性のため
hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id),
unreadNotificationCount: notificationsInfo?.unreadCount,
unreadNotificationsCount: notificationsInfo?.unreadCount,
mutedWords: profile!.mutedWords,
mutedInstances: profile!.mutedInstances,
mutingNotificationTypes: [], // 後方互換性のため

View File

@ -399,7 +399,7 @@ export const packedMeDetailedOnlySchema = {
type: 'boolean',
nullable: false, optional: false,
},
unreadNotificationCount: {
unreadNotificationsCount: {
type: 'number',
nullable: false, optional: false,
},

View File

@ -164,7 +164,7 @@ describe('ユーザー', () => {
hasUnreadAntenna: user.hasUnreadAntenna,
hasUnreadChannel: user.hasUnreadChannel,
hasUnreadNotification: user.hasUnreadNotification,
unreadNotificationCount: user.unreadNotificationCount,
unreadNotificationsCount: user.unreadNotificationsCount,
hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest,
unreadAnnouncements: user.unreadAnnouncements,
mutedWords: user.mutedWords,
@ -415,7 +415,7 @@ describe('ユーザー', () => {
assert.strictEqual(response.hasUnreadAntenna, false);
assert.strictEqual(response.hasUnreadChannel, false);
assert.strictEqual(response.hasUnreadNotification, false);
assert.strictEqual(response.unreadNotificationCount, 0);
assert.strictEqual(response.unreadNotificationsCount, 0);
assert.strictEqual(response.hasPendingReceivedFollowRequest, false);
assert.deepStrictEqual(response.unreadAnnouncements, []);
assert.deepStrictEqual(response.mutedWords, []);

View File

@ -228,15 +228,15 @@ export async function mainBoot() {
main.on('readAllNotifications', () => {
updateAccount({
hasUnreadNotification: false,
unreadNotificationCount: 0,
unreadNotificationsCount: 0,
});
});
main.on('unreadNotification', () => {
const unreadNotificationCount = ($i?.unreadNotificationCount ?? 0) + 1;
const unreadNotificationsCount = ($i?.unreadNotificationsCount ?? 0) + 1;
updateAccount({
hasUnreadNotification: true,
unreadNotificationCount,
unreadNotificationsCount,
});
});

View File

@ -20,12 +20,12 @@ export const navbarItemDef = reactive({
show: computed(() => $i != null),
indicated: computed(() => $i != null && $i.hasUnreadNotification),
indicateValue: computed(() => {
if (!$i || $i.unreadNotificationCount === 0) return '';
if (!$i || $i.unreadNotificationsCount === 0) return '';
if ($i.unreadNotificationCount > 99) {
if ($i.unreadNotificationsCount > 99) {
return '99+';
} else {
return $i.unreadNotificationCount.toString();
return $i.unreadNotificationsCount.toString();
}
}),
to: '/my/notifications',

View File

@ -55,7 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button :class="$style.navButton" class="_button" @click="mainRouter.push('/my/notifications')">
<i :class="$style.navButtonIcon" class="ti ti-bell"></i>
<span v-if="$i?.hasUnreadNotification" :class="$style.navButtonIndicator">
<span class="_indicateCounter" :class="$style.itemIndicateValueIcon">{{ $i.unreadNotificationCount > 99 ? '99+' : $i.unreadNotificationCount }}</span>
<span class="_indicateCounter" :class="$style.itemIndicateValueIcon">{{ $i.unreadNotificationsCount > 99 ? '99+' : $i.unreadNotificationsCount }}</span>
</span>
</button>
<button :class="$style.postButton" class="_button" @click="os.post()"><i :class="$style.navButtonIcon" class="ti ti-pencil"></i></button>

View File

@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button :class="$style.navButton" class="_button" @click="mainRouter.push('/my/notifications')">
<i :class="$style.navButtonIcon" class="ti ti-bell"></i>
<span v-if="$i?.hasUnreadNotification" :class="$style.navButtonIndicator">
<span class="_indicateCounter" :class="$style.itemIndicateValueIcon">{{ $i.unreadNotificationCount > 99 ? '99+' : $i.unreadNotificationCount }}</span>
<span class="_indicateCounter" :class="$style.itemIndicateValueIcon">{{ $i.unreadNotificationsCount > 99 ? '99+' : $i.unreadNotificationsCount }}</span>
</span>
</button>
<button :class="$style.navButton" class="_button" @click="widgetsShowing = true"><i :class="$style.navButtonIcon" class="ti ti-apps"></i></button>

View File

@ -2488,7 +2488,7 @@ type MeDetailed = UserDetailed & {
hasUnreadMessagingMessage: boolean;
hasUnreadNotification: boolean;
hasUnreadSpecifiedNotes: boolean;
unreadNotificationCount: number;
unreadNotificationsCount: number;
hideOnlineStatus: boolean;
injectFeaturedNote: boolean;
integrations: Record<string, any>;

View File

@ -106,7 +106,7 @@ export type MeDetailed = UserDetailed & {
hasUnreadMessagingMessage: boolean;
hasUnreadNotification: boolean;
hasUnreadSpecifiedNotes: boolean;
unreadNotificationCount: number;
unreadNotificationsCount: number;
hideOnlineStatus: boolean;
injectFeaturedNote: boolean;
integrations: Record<string, any>;