fix(server): アンテナタイムライン(ストリーミング)が、フォローしていないユーザーの鍵投稿も拾ってしまう問題を修正
Fix #9025
This commit is contained in:
		
							parent
							
								
									3cfd017538
								
							
						
					
					
						commit
						e4144a17a4
					
				
					 2 changed files with 7 additions and 14 deletions
				
			
		|  | @ -102,6 +102,7 @@ You should also include the user name that made the change. | ||||||
| - Server: Escape SQL LIKE @mei23 | - Server: Escape SQL LIKE @mei23 | ||||||
| - Server: 特定のPNG画像のアップロードに失敗する問題を修正 @usbharu | - Server: 特定のPNG画像のアップロードに失敗する問題を修正 @usbharu | ||||||
| - Server: 非公開のクリップのURLでOGPレンダリングされる問題を修正 @syuilo | - Server: 非公開のクリップのURLでOGPレンダリングされる問題を修正 @syuilo | ||||||
|  | - Server: アンテナタイムライン(ストリーミング)が、フォローしていないユーザーの鍵投稿も拾ってしまう @syuilo | ||||||
| - Client: case insensitive emoji search @saschanaz | - Client: case insensitive emoji search @saschanaz | ||||||
| - Client: InAppウィンドウが操作できなくなることがあるのを修正 @tamaina | - Client: InAppウィンドウが操作できなくなることがあるのを修正 @tamaina | ||||||
| - Client: use proxied image for instance icon @syuilo | - Client: use proxied image for instance icon @syuilo | ||||||
|  |  | ||||||
|  | @ -15,8 +15,8 @@ import type { Packed } from '@/misc/schema.js'; | ||||||
| import { DI } from '@/di-symbols.js'; | import { DI } from '@/di-symbols.js'; | ||||||
| import type { MutingsRepository, BlockingsRepository, NotesRepository, AntennaNotesRepository, AntennasRepository, UserGroupJoiningsRepository, UserListJoiningsRepository } from '@/models/index.js'; | import type { MutingsRepository, BlockingsRepository, NotesRepository, AntennaNotesRepository, AntennasRepository, UserGroupJoiningsRepository, UserListJoiningsRepository } from '@/models/index.js'; | ||||||
| import { UtilityService } from '@/core/UtilityService.js'; | import { UtilityService } from '@/core/UtilityService.js'; | ||||||
| import type { OnApplicationShutdown } from '@nestjs/common'; |  | ||||||
| import { bindThis } from '@/decorators.js'; | import { bindThis } from '@/decorators.js'; | ||||||
|  | import type { OnApplicationShutdown } from '@nestjs/common'; | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable() | ||||||
| export class AntennaService implements OnApplicationShutdown { | export class AntennaService implements OnApplicationShutdown { | ||||||
|  | @ -135,7 +135,7 @@ export class AntennaService implements OnApplicationShutdown { | ||||||
| 					this.globalEventServie.publishMainStream(antenna.userId, 'unreadAntenna', antenna); | 					this.globalEventServie.publishMainStream(antenna.userId, 'unreadAntenna', antenna); | ||||||
| 					this.pushNotificationService.pushNotification(antenna.userId, 'unreadAntennaNote', { | 					this.pushNotificationService.pushNotification(antenna.userId, 'unreadAntennaNote', { | ||||||
| 						antenna: { id: antenna.id, name: antenna.name }, | 						antenna: { id: antenna.id, name: antenna.name }, | ||||||
| 						note: await this.noteEntityService.pack(note) | 						note: await this.noteEntityService.pack(note), | ||||||
| 					}); | 					}); | ||||||
| 				} | 				} | ||||||
| 			}, 2000); | 			}, 2000); | ||||||
|  | @ -144,27 +144,19 @@ export class AntennaService implements OnApplicationShutdown { | ||||||
| 
 | 
 | ||||||
| 	// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
 | 	// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
 | ||||||
| 
 | 
 | ||||||
| 	/** |  | ||||||
| 	 * noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい |  | ||||||
| 	 */ |  | ||||||
| 	@bindThis | 	@bindThis | ||||||
| 	public async checkHitAntenna(antenna: Antenna, note: (Note | Packed<'Note'>), noteUser: { id: User['id']; username: string; host: string | null; }, noteUserFollowers?: User['id'][], antennaUserFollowing?: User['id'][]): Promise<boolean> { | 	public async checkHitAntenna(antenna: Antenna, note: (Note | Packed<'Note'>), noteUser: { id: User['id']; username: string; host: string | null; }): Promise<boolean> { | ||||||
| 		if (note.visibility === 'specified') return false; | 		if (note.visibility === 'specified') return false; | ||||||
|  | 		if (note.visibility === 'followers') return false; | ||||||
| 
 | 
 | ||||||
| 		// アンテナ作成者がノート作成者にブロックされていたらスキップ
 | 		// アンテナ作成者がノート作成者にブロックされていたらスキップ
 | ||||||
| 		const blockings = await this.blockingCache.fetch(noteUser.id, () => this.blockingsRepository.findBy({ blockerId: noteUser.id }).then(res => res.map(x => x.blockeeId))); | 		const blockings = await this.blockingCache.fetch(noteUser.id, () => this.blockingsRepository.findBy({ blockerId: noteUser.id }).then(res => res.map(x => x.blockeeId))); | ||||||
| 		if (blockings.some(blocking => blocking === antenna.userId)) return false; | 		if (blockings.some(blocking => blocking === antenna.userId)) return false; | ||||||
| 	 | 	 | ||||||
| 		if (note.visibility === 'followers') { |  | ||||||
| 			if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) return false; |  | ||||||
| 			if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false; |  | ||||||
| 		} |  | ||||||
| 	 |  | ||||||
| 		if (!antenna.withReplies && note.replyId != null) return false; | 		if (!antenna.withReplies && note.replyId != null) return false; | ||||||
| 	 | 	 | ||||||
| 		if (antenna.src === 'home') { | 		if (antenna.src === 'home') { | ||||||
| 			if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) return false; | 			// TODO
 | ||||||
| 			if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false; |  | ||||||
| 		} else if (antenna.src === 'list') { | 		} else if (antenna.src === 'list') { | ||||||
| 			const listUsers = (await this.userListJoiningsRepository.findBy({ | 			const listUsers = (await this.userListJoiningsRepository.findBy({ | ||||||
| 				userListId: antenna.userListId!, | 				userListId: antenna.userListId!, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue