Skip to content

Commit

Permalink
fix(frontend): 個人宛てダイアログお知らせが即時表示されない問題 (#14260)
Browse files Browse the repository at this point in the history
* fix(frontend): 個人向けお知らせが即時ダイアログで出ない問題

* Update CHANGELOG
  • Loading branch information
tai-cha authored Jul 19, 2024
1 parent 615e60f commit 54d0a46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/574)
- Fix: Twitchの埋め込みが開けない問題を修正
- Fix: 子メニューの高さがウィンドウからはみ出ることがある問題を修正
- Fix: 個人宛てのダイアログ形式のお知らせが即時表示されない問題を修正

### Server
- Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949)
Expand Down
10 changes: 8 additions & 2 deletions packages/frontend/src/boot/main-boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { createApp, defineAsyncComponent, markRaw } from 'vue';
import { common } from './common.js';
import type * as Misskey from 'misskey-js';
import { ui } from '@/config.js';
import { i18n } from '@/i18n.js';
import { alert, confirm, popup, post, toast } from '@/os.js';
Expand Down Expand Up @@ -113,7 +114,7 @@ export async function mainBoot() {
});
}

stream.on('announcementCreated', (ev) => {
function onAnnouncementCreated (ev: { announcement: Misskey.entities.Announcement }) {
const announcement = ev.announcement;
if (announcement.display === 'dialog') {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkAnnouncementDialog.vue')), {
Expand All @@ -122,7 +123,9 @@ export async function mainBoot() {
closed: () => dispose(),
});
}
});
}

stream.on('announcementCreated', onAnnouncementCreated);

if ($i.isDeleted) {
alert({
Expand Down Expand Up @@ -315,6 +318,9 @@ export async function mainBoot() {
updateAccount({ hasUnreadAnnouncement: false });
});

// 個人宛てお知らせが発行されたとき
main.on('announcementCreated', onAnnouncementCreated);

// トークンが再生成されたとき
// このままではMisskeyが利用できないので強制的にサインアウトさせる
main.on('myTokenRegenerated', () => {
Expand Down

0 comments on commit 54d0a46

Please sign in to comment.