名前の変更と変更不要の差分をロールバック
This commit is contained in:
		
							parent
							
								
									a56c680136
								
							
						
					
					
						commit
						b5ccf1b484
					
				|  | @ -15,7 +15,7 @@ import { RedisKVCache } from '@/misc/cache.js'; | |||
| 
 | ||||
| @Injectable() | ||||
| export class ChannelMutingService { | ||||
| 	public userMutingChannelsCache: RedisKVCache<Set<string>>; | ||||
| 	public mutingChannelsCache: RedisKVCache<Set<string>>; | ||||
| 
 | ||||
| 	constructor( | ||||
| 		@Inject(DI.redis) | ||||
|  | @ -29,7 +29,7 @@ export class ChannelMutingService { | |||
| 		private idService: IdService, | ||||
| 		private globalEventService: GlobalEventService, | ||||
| 	) { | ||||
| 		this.userMutingChannelsCache = new RedisKVCache<Set<string>>(this.redisClient, 'channelMutingChannels', { | ||||
| 		this.mutingChannelsCache = new RedisKVCache<Set<string>>(this.redisClient, 'channelMutingChannels', { | ||||
| 			lifetime: 1000 * 60 * 30, // 30m
 | ||||
| 			memoryCacheLifetime: 1000 * 60, // 1m
 | ||||
| 			fetcher: (userId) => this.channelMutingRepository.find({ | ||||
|  | @ -115,7 +115,7 @@ export class ChannelMutingService { | |||
| 		requestUserId: MiUser['id'], | ||||
| 		targetChannelId: MiChannel['id'], | ||||
| 	}): Promise<boolean> { | ||||
| 		const mutedChannels = await this.userMutingChannelsCache.get(params.requestUserId); | ||||
| 		const mutedChannels = await this.mutingChannelsCache.get(params.requestUserId); | ||||
| 		return (mutedChannels?.has(params.targetChannelId) ?? false); | ||||
| 	} | ||||
| 
 | ||||
|  | @ -173,7 +173,7 @@ export class ChannelMutingService { | |||
| 
 | ||||
| 		const userIds = [...new Set(expiredMutings.map(x => x.userId))]; | ||||
| 		for (const userId of userIds) { | ||||
| 			this.userMutingChannelsCache.refresh(userId).then(); | ||||
| 			this.mutingChannelsCache.refresh(userId).then(); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | @ -185,11 +185,11 @@ export class ChannelMutingService { | |||
| 			const { type, body } = obj.message as GlobalEvents['internal']['payload']; | ||||
| 			switch (type) { | ||||
| 				case 'muteChannel': { | ||||
| 					this.userMutingChannelsCache.refresh(body.userId).then(); | ||||
| 					this.mutingChannelsCache.refresh(body.userId).then(); | ||||
| 					break; | ||||
| 				} | ||||
| 				case 'unmuteChannel': { | ||||
| 					this.userMutingChannelsCache.delete(body.userId).then(); | ||||
| 					this.mutingChannelsCache.delete(body.userId).then(); | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
|  | @ -198,7 +198,7 @@ export class ChannelMutingService { | |||
| 
 | ||||
| 	@bindThis | ||||
| 	public dispose(): void { | ||||
| 		this.userMutingChannelsCache.dispose(); | ||||
| 		this.mutingChannelsCache.dispose(); | ||||
| 	} | ||||
| 
 | ||||
| 	@bindThis | ||||
|  |  | |||
|  | @ -111,7 +111,7 @@ export class FanoutTimelineEndpointService { | |||
| 					this.cacheService.renoteMutingsCache.fetch(ps.me.id), | ||||
| 					this.cacheService.userBlockedCache.fetch(ps.me.id), | ||||
| 					this.cacheService.userProfileCache.fetch(me.id).then(p => new Set(p.mutedInstances)), | ||||
| 					ps.excludeMutedChannels ? this.channelMutingService.userMutingChannelsCache.fetch(me.id) : Promise.resolve(new Set<string>()), | ||||
| 					ps.excludeMutedChannels ? this.channelMutingService.mutingChannelsCache.fetch(me.id) : Promise.resolve(new Set<string>()), | ||||
| 				]); | ||||
| 
 | ||||
| 				const parentFilter = filter; | ||||
|  |  | |||
|  | @ -39,7 +39,6 @@ export default class Connection { | |||
| 	public userIdsWhoBlockingMe: Set<string> = new Set(); | ||||
| 	public userIdsWhoMeMutingRenotes: Set<string> = new Set(); | ||||
| 	public userMutedInstances: Set<string> = new Set(); | ||||
| 	public userMutedChannels: Set<string> = new Set(); | ||||
| 	private fetchIntervalId: NodeJS.Timeout | null = null; | ||||
| 
 | ||||
| 	constructor( | ||||
|  | @ -71,7 +70,7 @@ export default class Connection { | |||
| 			this.cacheService.userProfileCache.fetch(this.user.id), | ||||
| 			this.cacheService.userFollowingsCache.fetch(this.user.id), | ||||
| 			this.channelFollowingService.userFollowingChannelsCache.fetch(this.user.id), | ||||
| 			this.channelMutingService.userMutingChannelsCache.fetch(this.user.id), | ||||
| 			this.channelMutingService.mutingChannelsCache.fetch(this.user.id), | ||||
| 			this.cacheService.userMutingsCache.fetch(this.user.id), | ||||
| 			this.cacheService.userBlockedCache.fetch(this.user.id), | ||||
| 			this.cacheService.renoteMutingsCache.fetch(this.user.id), | ||||
|  | @ -125,37 +124,16 @@ export default class Connection { | |||
| 		const { type, body } = obj; | ||||
| 
 | ||||
| 		switch (type) { | ||||
| 			case 'readNotification': | ||||
| 				this.onReadNotification(body); | ||||
| 				break; | ||||
| 			case 'subNote': | ||||
| 				this.onSubscribeNote(body); | ||||
| 				break; | ||||
| 			case 's': | ||||
| 				this.onSubscribeNote(body); | ||||
| 				break; // alias
 | ||||
| 			case 'sr': | ||||
| 				this.onSubscribeNote(body); | ||||
| 				this.readNote(body); | ||||
| 				break; | ||||
| 			case 'unsubNote': | ||||
| 				this.onUnsubscribeNote(body); | ||||
| 				break; | ||||
| 			case 'un': | ||||
| 				this.onUnsubscribeNote(body); | ||||
| 				break; // alias
 | ||||
| 			case 'connect': | ||||
| 				this.onChannelConnectRequested(body); | ||||
| 				break; | ||||
| 			case 'disconnect': | ||||
| 				this.onChannelDisconnectRequested(body); | ||||
| 				break; | ||||
| 			case 'channel': | ||||
| 				this.onChannelMessageRequested(body); | ||||
| 				break; | ||||
| 			case 'ch': | ||||
| 				this.onChannelMessageRequested(body); | ||||
| 				break; // alias
 | ||||
| 			case 'readNotification': this.onReadNotification(body); break; | ||||
| 			case 'subNote': this.onSubscribeNote(body); break; | ||||
| 			case 's': this.onSubscribeNote(body); break; // alias
 | ||||
| 			case 'sr': this.onSubscribeNote(body); this.readNote(body); break; | ||||
| 			case 'unsubNote': this.onUnsubscribeNote(body); break; | ||||
| 			case 'un': this.onUnsubscribeNote(body); break; // alias
 | ||||
| 			case 'connect': this.onChannelConnectRequested(body); break; | ||||
| 			case 'disconnect': this.onChannelDisconnectRequested(body); break; | ||||
| 			case 'channel': this.onChannelMessageRequested(body); break; | ||||
| 			case 'ch': this.onChannelMessageRequested(body); break; // alias
 | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -63,7 +63,7 @@ class HybridTimelineChannel extends Channel { | |||
| 			(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)) || | ||||
| 			(note.channelId != null && !isChannelRelated(note, this.mutingChannels)) | ||||
| 			(note.channelId != null && isChannelRelated(note, this.mutingChannels)) | ||||
| 		)) return; | ||||
| 
 | ||||
| 		if (note.visibility === 'followers') { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue