summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2024-02-28 09:49:34 +0900
committerGitHub <noreply@github.com>2024-02-28 09:49:34 +0900
commit0d47877db1e1012aaba78a2926b165cf9e039d3d (patch)
treee545cd513ee43ece2a7c6431f741982ef1ca169c /packages/backend/src
parentEnhance: コンディショナルロールの条件に「マニュアルロ... (diff)
downloadmisskey-0d47877db1e1012aaba78a2926b165cf9e039d3d.tar.gz
misskey-0d47877db1e1012aaba78a2926b165cf9e039d3d.tar.bz2
misskey-0d47877db1e1012aaba78a2926b165cf9e039d3d.zip
enhance(backend): フォロー・フォロワー関連の通知の受信設定の強化 (#13468)
* enhance(backend): 通知の受信設定に「フォロー中またはフォロワー」を追加 * fix(backend): 通知の受信設定で「相互フォロー」が正しく動作しない問題を修正 * Update CHANGELOG.md
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/core/NotificationService.ts8
-rw-r--r--packages/backend/src/models/UserProfile.ts2
-rw-r--r--packages/backend/src/models/json-schema/user.ts2
3 files changed, 11 insertions, 1 deletions
diff --git a/packages/backend/src/core/NotificationService.ts b/packages/backend/src/core/NotificationService.ts
index ee16193579..7224341991 100644
--- a/packages/backend/src/core/NotificationService.ts
+++ b/packages/backend/src/core/NotificationService.ts
@@ -126,6 +126,14 @@ export class NotificationService implements OnApplicationShutdown {
this.cacheService.userFollowingsCache.fetch(notifieeId).then(followings => Object.hasOwn(followings, notifierId)),
this.cacheService.userFollowingsCache.fetch(notifierId).then(followings => Object.hasOwn(followings, notifieeId)),
]);
+ if (!(isFollowing && isFollower)) {
+ return null;
+ }
+ } else if (recieveConfig?.type === 'followingOrFollower') {
+ const [isFollowing, isFollower] = await Promise.all([
+ this.cacheService.userFollowingsCache.fetch(notifieeId).then(followings => Object.hasOwn(followings, notifierId)),
+ this.cacheService.userFollowingsCache.fetch(notifierId).then(followings => Object.hasOwn(followings, notifieeId)),
+ ]);
if (!isFollowing && !isFollower) {
return null;
}
diff --git a/packages/backend/src/models/UserProfile.ts b/packages/backend/src/models/UserProfile.ts
index 1ca2f55850..7dbe0b3717 100644
--- a/packages/backend/src/models/UserProfile.ts
+++ b/packages/backend/src/models/UserProfile.ts
@@ -250,6 +250,8 @@ export class MiUserProfile {
} | {
type: 'mutualFollow';
} | {
+ type: 'followingOrFollower';
+ } | {
type: 'list';
userListId: MiUserList['id'];
};
diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts
index 952cd6bf80..947a9317d7 100644
--- a/packages/backend/src/models/json-schema/user.ts
+++ b/packages/backend/src/models/json-schema/user.ts
@@ -13,7 +13,7 @@ export const notificationRecieveConfig = {
type: {
type: 'string',
nullable: false,
- enum: ['all', 'following', 'follower', 'mutualFollow', 'never'],
+ enum: ['all', 'following', 'follower', 'mutualFollow', 'followingOrFollower', 'never'],
},
},
required: ['type'],