Misskey: 通知ミュートの判定がおかしい

Created on 28 Aug 2020  ·  7Comments  ·  Source: syuilo/misskey

💡 Summary

create-notificationサービスのisMutedの判定がおかしいっぽい?

多分だけど、includingNotificationTypesがnullの場合に判定がおかしくなる?

🐛Bug

Most helpful comment

excludeNotificationTypes でよかったのかも

All 7 comments

includingNotificationTypesってそもそもどうしてnullableにしたんだろう

デフォルトのNULLは全許可にしないといけないからたぶんこう

- const isMuted = !profile?.includingNotificationTypes?.includes(type);
+ const isMuted = !(profile?.includingNotificationTypes == null || profile.includingNotificationTypes.includes(type));

includingNotificationTypesってそもそもどうしてnullableにしたんだろう

['follow', 'mention', 'reply',みたいにデフォルトで全部列挙するようにしちゃうと
新しい通知種別が出来たときにそれがオフになってしまう

あー、これホワイトリストだっけ

たぶんスキーマに、通知設定全体が未定義 と この種別の通知については未定義 の両方の概念があったほうが良かったのかなと

notificationTypes?: Record<string, boolean | undefined>;

if (notificationTypes == null) return true;
if (notificationTypes[key] == null) return true;
return notificationTypes[key];

そもそもブラックリスト形式でよかったような気も

excludeNotificationTypes でよかったのかも

直接コミットした(

Was this page helpful?
0 / 5 - 0 ratings