summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-20 08:02:32 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-20 08:02:32 +0900
commit216b20d2dbbc042c59bf421502904da468c931fb (patch)
tree634ed05894c1fd9c8b93db725a641c117e0730c6 /packages/backend/src/server/api/stream
parentclean up (diff)
downloadsharkey-216b20d2dbbc042c59bf421502904da468c931fb.tar.gz
sharkey-216b20d2dbbc042c59bf421502904da468c931fb.tar.bz2
sharkey-216b20d2dbbc042c59bf421502904da468c931fb.zip
fix(backend): 自分のフォロワー限定ノートがWebsoketに乗ってこない
Fix #12081
Diffstat (limited to 'packages/backend/src/server/api/stream')
-rw-r--r--packages/backend/src/server/api/stream/channels/home-timeline.ts8
-rw-r--r--packages/backend/src/server/api/stream/channels/hybrid-timeline.ts8
-rw-r--r--packages/backend/src/server/api/stream/channels/user-list.ts6
3 files changed, 14 insertions, 8 deletions
diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts
index 2b235b9822..46071e82fa 100644
--- a/packages/backend/src/server/api/stream/channels/home-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts
@@ -39,20 +39,22 @@ class HomeTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
+ const isMe = this.user!.id === note.userId;
+
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
if (note.channelId) {
if (!this.followingChannels.has(note.channelId)) return;
} else {
// その投稿のユーザーをフォローしていなかったら弾く
- if ((this.user!.id !== note.userId) && !Object.hasOwn(this.following, note.userId)) return;
+ if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
}
// Ignore notes from instances the user has muted
if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
if (note.visibility === 'followers') {
- if (!Object.hasOwn(this.following, note.userId)) return;
+ if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
} else if (note.visibility === 'specified') {
if (!note.visibleUserIds!.includes(this.user!.id)) return;
}
@@ -61,7 +63,7 @@ class HomeTimelineChannel extends Channel {
if (note.reply && !this.following[note.userId]?.withReplies) {
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
- if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
+ if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return;
}
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
index 4e90912084..2722ebcd50 100644
--- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
@@ -49,6 +49,8 @@ class HybridTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
+ const isMe = this.user!.id === note.userId;
+
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
// チャンネルの投稿ではなく、自分自身の投稿 または
@@ -56,14 +58,14 @@ class HybridTimelineChannel extends Channel {
// チャンネルの投稿ではなく、全体公開のローカルの投稿 または
// フォローしているチャンネルの投稿 の場合だけ
if (!(
- (note.channelId == null && this.user!.id === note.userId) ||
+ (note.channelId == null && isMe) ||
(note.channelId == null && Object.hasOwn(this.following, note.userId)) ||
(note.channelId == null && (note.user.host == null && note.visibility === 'public')) ||
(note.channelId != null && this.followingChannels.has(note.channelId))
)) return;
if (note.visibility === 'followers') {
- if (!Object.hasOwn(this.following, note.userId)) return;
+ if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
} else if (note.visibility === 'specified') {
if (!note.visibleUserIds!.includes(this.user!.id)) return;
}
@@ -75,7 +77,7 @@ class HybridTimelineChannel extends Channel {
if (note.reply && !this.following[note.userId]?.withReplies && !this.withReplies) {
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
- if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
+ if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return;
}
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts
index 6d83d4cb5b..68927987d6 100644
--- a/packages/backend/src/server/api/stream/channels/user-list.ts
+++ b/packages/backend/src/server/api/stream/channels/user-list.ts
@@ -78,12 +78,14 @@ class UserListChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
+ const isMe = this.user!.id === note.userId;
+
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
if (!Object.hasOwn(this.membershipsMap, note.userId)) return;
if (note.visibility === 'followers') {
- if (!Object.hasOwn(this.following, note.userId)) return;
+ if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
} else if (note.visibility === 'specified') {
if (!note.visibleUserIds!.includes(this.user!.id)) return;
}
@@ -92,7 +94,7 @@ class UserListChannel extends Channel {
if (note.reply && !this.membershipsMap[note.userId]?.withReplies) {
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
- if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
+ if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return;
}
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する