diff --git a/locales/en-US.yml b/locales/en-US.yml index 10a9fca3bd..8844cf9be8 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1116,6 +1116,7 @@ enableServerMachineStats: "Enable server hardware statistics" enableIdenticonGeneration: "Enable Identicon generation" showPopup: "Notify users about this announcement with a popup" isGoodNews: "This is a good news" +youHaveUnreadAnnouncements: "You have unread announcements" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 1d23fc8cfe..873eed1cf3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -982,6 +982,7 @@ enableServerMachineStats: "サーバーのマシン情報を公開する" enableIdenticonGeneration: "ユーザーごとのIdenticon生成を有効にする" showPopup: "ポップアップを表示してユーザーに知らせる" isGoodNews: "これは良いニュースです" +youHaveUnreadAnnouncements: "未読のお知らせがあります" _sensitiveMediaDetection: description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。" diff --git a/packages/client/src/components/MkManyAnnouncements.vue b/packages/client/src/components/MkManyAnnouncements.vue new file mode 100644 index 0000000000..30cdcf99e8 --- /dev/null +++ b/packages/client/src/components/MkManyAnnouncements.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index ff4dee309e..2b99dd4d5f 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -272,14 +272,24 @@ function checkForSplash() { } } - if ($i) { + if ( + $i && + !["/announcements", "/announcements/"].includes(window.location.pathname) + ) { api("announcements", { withUnreads: true, limit: 10 }) .then((announcements) => { const unreadAnnouncements = announcements.filter((item) => { return !item.isRead; }); if (unreadAnnouncements.length > 3) { - // TODO: navigate to the announcements page when there are too many unreads + popup( + defineAsyncComponent( + () => import("@/components/MkManyAnnouncements.vue"), + ), + {}, + {}, + "closed", + ); } else { unreadAnnouncements.forEach((item) => { if (item.showPopup)