mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	fix(backend): 自分のフォローしているユーザーの自分のフォローしていないユーザーの visibility: followers な投稿への返信がストリーミングで流れてくる問題を修正
Fix #12117
This commit is contained in:
		
							parent
							
								
									e6c54de814
								
							
						
					
					
						commit
						9dcccbc8e1
					
				
					 5 changed files with 29 additions and 12 deletions
				
			
		| 
						 | 
					@ -28,6 +28,7 @@
 | 
				
			||||||
- Enhance: RedisへのTLのキャッシュをオフにできるように
 | 
					- Enhance: RedisへのTLのキャッシュをオフにできるように
 | 
				
			||||||
- Fix: リストTLに自分のフォロワー限定投稿が含まれない問題を修正
 | 
					- Fix: リストTLに自分のフォロワー限定投稿が含まれない問題を修正
 | 
				
			||||||
- Fix: ローカルタイムラインに投稿者自身の投稿への返信が含まれない問題を修正
 | 
					- Fix: ローカルタイムラインに投稿者自身の投稿への返信が含まれない問題を修正
 | 
				
			||||||
 | 
					- Fix: 自分のフォローしているユーザーの自分のフォローしていないユーザーの visibility: followers な投稿への返信がストリーミングで流れてくる問題を修正
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 2023.10.2
 | 
					## 2023.10.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,12 +59,16 @@ class HomeTimelineChannel extends Channel {
 | 
				
			||||||
			if (!note.visibleUserIds!.includes(this.user!.id)) return;
 | 
								if (!note.visibleUserIds!.includes(this.user!.id)) return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 関係ない返信は除外
 | 
							if (note.reply) {
 | 
				
			||||||
		if (note.reply && !this.following[note.userId]?.withReplies) {
 | 
					 | 
				
			||||||
			const reply = note.reply;
 | 
								const reply = note.reply;
 | 
				
			||||||
 | 
								if (this.following[note.userId]?.withReplies) {
 | 
				
			||||||
 | 
									// 自分のフォローしていないユーザーの visibility: followers な投稿への返信は弾く
 | 
				
			||||||
 | 
									if (reply.visibility === 'followers' && !Object.hasOwn(this.following, reply.userId)) return;
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
				// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
 | 
									// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
 | 
				
			||||||
				if (reply.userId !== this.user!.id && !isMe && 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;
 | 
							if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,12 +73,16 @@ class HybridTimelineChannel extends Channel {
 | 
				
			||||||
		// Ignore notes from instances the user has muted
 | 
							// Ignore notes from instances the user has muted
 | 
				
			||||||
		if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
 | 
							if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 関係ない返信は除外
 | 
							if (note.reply) {
 | 
				
			||||||
		if (note.reply && !this.following[note.userId]?.withReplies && !this.withReplies) {
 | 
					 | 
				
			||||||
			const reply = note.reply;
 | 
								const reply = note.reply;
 | 
				
			||||||
 | 
								if ((this.following[note.userId]?.withReplies ?? false) || this.withReplies) {
 | 
				
			||||||
 | 
									// 自分のフォローしていないユーザーの visibility: followers な投稿への返信は弾く
 | 
				
			||||||
 | 
									if (reply.visibility === 'followers' && !Object.hasOwn(this.following, reply.userId)) return;
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
				// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
 | 
									// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
 | 
				
			||||||
				if (reply.userId !== this.user!.id && !isMe && 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;
 | 
							if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,12 +90,16 @@ class UserListChannel extends Channel {
 | 
				
			||||||
			if (!note.visibleUserIds!.includes(this.user!.id)) return;
 | 
								if (!note.visibleUserIds!.includes(this.user!.id)) return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 関係ない返信は除外
 | 
							if (note.reply) {
 | 
				
			||||||
		if (note.reply && !this.membershipsMap[note.userId]?.withReplies) {
 | 
					 | 
				
			||||||
			const reply = note.reply;
 | 
								const reply = note.reply;
 | 
				
			||||||
 | 
								if (this.membershipsMap[note.userId]?.withReplies) {
 | 
				
			||||||
 | 
									// 自分のフォローしていないユーザーの visibility: followers な投稿への返信は弾く
 | 
				
			||||||
 | 
									if (reply.visibility === 'followers' && !Object.hasOwn(this.following, reply.userId)) return;
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
				// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
 | 
									// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
 | 
				
			||||||
				if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return;
 | 
									if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
							// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
				
			||||||
		if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
 | 
							if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,6 +159,10 @@ describe('Streaming', () => {
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
			*/
 | 
								*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								test('フォローしているユーザーのフォローしていないユーザーの visibility: followers な投稿への返信が流れない', async () => {
 | 
				
			||||||
 | 
									// TODO
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			test('フォローしていないユーザーの投稿は流れない', async () => {
 | 
								test('フォローしていないユーザーの投稿は流れない', async () => {
 | 
				
			||||||
				const fired = await waitFire(
 | 
									const fired = await waitFire(
 | 
				
			||||||
					kyoko, 'homeTimeline',	// kyoko:home
 | 
										kyoko, 'homeTimeline',	// kyoko:home
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue