mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	Fix #4703
This commit is contained in:
		
							parent
							
								
									683e5b6abe
								
							
						
					
					
						commit
						d78a5c0863
					
				
					 2 changed files with 27 additions and 2 deletions
				
			
		| 
						 | 
					@ -20,11 +20,11 @@ export default class extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@autobind
 | 
						@autobind
 | 
				
			||||||
	private async onNote(note: any) {
 | 
						private async onNote(note: any) {
 | 
				
			||||||
		// 自分自身の投稿 または その投稿のユーザーをフォローしている または ローカルの投稿 の場合だけ
 | 
							// 自分自身の投稿 または その投稿のユーザーをフォローしている または ホームのローカルの投稿 の場合だけ
 | 
				
			||||||
		if (!(
 | 
							if (!(
 | 
				
			||||||
			this.user!.id === note.userId ||
 | 
								this.user!.id === note.userId ||
 | 
				
			||||||
			this.following.includes(note.userId) ||
 | 
								this.following.includes(note.userId) ||
 | 
				
			||||||
			note.user.host == null
 | 
								(note.user.host == null && note.visibility === 'home')
 | 
				
			||||||
		)) return;
 | 
							)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (['followers', 'specified'].includes(note.visibility)) {
 | 
							if (['followers', 'specified'].includes(note.visibility)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -484,6 +484,31 @@ describe('Streaming', () => {
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		}));
 | 
							}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							it('フォローしていないローカルユーザーのホーム投稿は流れない', () => new Promise(async done => {
 | 
				
			||||||
 | 
								const alice = await signup({ username: 'alice' });
 | 
				
			||||||
 | 
								const bob = await signup({ username: 'bob' });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								let fired = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const ws = await connectStream(alice, 'hybridTimeline', ({ type, body }) => {
 | 
				
			||||||
 | 
									if (type == 'note') {
 | 
				
			||||||
 | 
										fired = true;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// ホーム投稿
 | 
				
			||||||
 | 
								post(bob, {
 | 
				
			||||||
 | 
									text: 'foo',
 | 
				
			||||||
 | 
									visibility: 'home'
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								setTimeout(() => {
 | 
				
			||||||
 | 
									assert.strictEqual(fired, false);
 | 
				
			||||||
 | 
									ws.close();
 | 
				
			||||||
 | 
									done();
 | 
				
			||||||
 | 
								}, 3000);
 | 
				
			||||||
 | 
							}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', () => new Promise(async done => {
 | 
							it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', () => new Promise(async done => {
 | 
				
			||||||
			const alice = await signup({ username: 'alice' });
 | 
								const alice = await signup({ username: 'alice' });
 | 
				
			||||||
			const bob = await signup({ username: 'bob' });
 | 
								const bob = await signup({ username: 'bob' });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue