* Never return broken notifications #409
Since notifications are stored in Redis, we can't expect relational
integrity: deleting a user will *not* delete notifications that
mention it.
But if we return notifications with missing bits (a `follow` without a
`user`, for example), the frontend will get very confused and throw an
exception while trying to render them.
This change makes sure we never expose those broken notifications. For
uniformity, I've applied the same logic to notes and roles mentioned
in notifications, even if nobody reported breakage in those cases.
Tested by creating a few types of notifications with a `notifierId`,
then deleting their user.
(cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb)
* Update Changelog
* Update CHANGELOG.md
* enhance: 通知がミュートを考慮するようにする
* enhance: 通知が凍結も考慮するようにする
* fix: notifierIdがない通知が消えてしまう問題
* Add tests (通知がミュートを考慮しているかどうか)
* fix: notifierIdがない通知が消えてしまう問題 (grouped)
* Remove unused import
* Fix: typo
* Revert "enhance: 通知が凍結も考慮するようにする"
This reverts commit b1e57e571d.
* Revert API handling
* Remove unused imports
* enhance: Check if notifierId is valid in NotificationEntityService
* 通知作成時にpackしてnullになったらあとの処理をやめる
* Remove duplication of valid notifier check
* add filter notification is not null
* Revert "Remove duplication of valid notifier check"
This reverts commit 239a6952f7.
* Improve performance
* Fix packGrouped
* Refactor: 判定部分を共通化
* Fix condition
* use isNotNull
* Update CHANGELOG.md
* filterの改善
* Refactor: DONT REPEAT YOURSELF
Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる
* Add groupedNotificationTypes
* Update misskey-js typedef
* Refactor: less sql calls
* refactor
* clean up
* filter notes to mark as read
* packed noteがmapなのでそちらを使う
* if (notesToRead.size > 0)
* if (notes.length === 0) return;
* fix
* Revert "if (notes.length === 0) return;"
This reverts commit 22e2324f96.
* 🎨
* console.error
* err
* remove try-catch
* 不要なジェネリクスを除去
* Revert (既読処理をpack内で行うものを元に戻す)
* Clean
* Update packages/backend/src/core/entities/NotificationEntityService.ts
* Update packages/backend/src/core/entities/NotificationEntityService.ts
* Update packages/backend/src/core/entities/NotificationEntityService.ts
* Update packages/backend/src/core/entities/NotificationEntityService.ts
* Update packages/backend/src/core/NotificationService.ts
* Clean
---------
Co-authored-by: dakkar <dakkar@thenautilus.net>
Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com>
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
* feat(backend,misskey-js): hard mute storage in backend
* fix(backend,misskey-js): mute word record type
* chore(frontend): generalize XWordMute
* feat(frontend): configure hard mute
* feat(frontend): hard mute notes on the timelines
* lint(backend,frontend): fix lint failure
* chore(misskey-js): update api.md
* fix(backend): test failure
* chore(frontend): check word mute for reply
* chore: limit hard mute count
* feat: add defaultWithReplies to MiUser
* feat: use defaultWithReplies when creating MiFollowing
* feat: update defaultWithReplies from API
* feat: return defaultWithReplies as a part of $i
* feat(frontend): configure defaultWithReplies
* docs(changelog): 新規にフォローした人のをデフォルトでTL二追加できるように
* fix: typo
* style: fix lint failure
* chore: improve UI text
* chore: make optional params of UserFollowingService.follow() object
* chore: UserFollowingService.follow() accept withReplies
* chore: add withReplies to MiFollowRequest
* chore: process withReplies for follow request
* feat: accept withReplies on 'following/create' endpoint
* feat: store defaultWithReplies in client store
* Revert "feat: return defaultWithReplies as a part of $i"
This reverts commit f2cc4fe6
* Revert "feat: update defaultWithReplies from API"
This reverts commit 95e3cee6
* Revert "feat: add defaultWithReplies to MiUser"
This reverts commit 9f5ab14d70.
* feat: configuring withReplies in import-following
* feat(frontend): configure withReplies
* fix(frontend): incorrectly showRepliesToOthersInTimeline can be shown
* fix(backend): withReplies of following/create not working
* fix(frontend): importFollowing error
* fix: withReplies is not working with follow import
* fix(frontend): use v-model
* style: fix lint
---------
Co-authored-by: Sayamame-beans <61457993+sayamame-beans@users.noreply.github.com>
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
* chore: Add the SPDX information to each file
Add copyright and licensing information as defined in version 3.0 of
the REUSE Specification.
* tweak format
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>