diff --git a/CHANGELOG.md b/CHANGELOG.md index ecb2d96e6a..b078168a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,3 @@ -## 2024.9.2 (eGirlskey) -- Improvements to user block: posts should now get properly hidden if they are replies to or mentions of a blocked user. - ## 2024.9.1 (eGirlskey) - Impersonate `misskey` upstream in nodeinfo to fix issues with client apps - Fix two-factor-auth login with `secureApiMode: true` by returning a stub user to unauthorized clients. diff --git a/package.json b/package.json index 08f585a0f5..30f683fd28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "egirlskey", - "version": "2024.9.2", + "version": "2024.9.1", "codename": "boobdog", "repository": { "type": "git", diff --git a/packages/backend/src/core/QueryService.ts b/packages/backend/src/core/QueryService.ts index 37dc79880a..c4feeaf971 100644 --- a/packages/backend/src/core/QueryService.ts +++ b/packages/backend/src/core/QueryService.ts @@ -70,38 +70,27 @@ export class QueryService { // ここでいうBlockedは被Blockedの意 @bindThis public generateBlockedUserQuery(q: SelectQueryBuilder, me: { id: MiUser['id'] }): void { - const blockedQuery = this.blockingsRepository.createQueryBuilder('blocking') - .select('blocking.blockeeId') - .where('blocking.blockerId = :blockerId', { blockerId: me.id }); - const blockingQuery = this.blockingsRepository.createQueryBuilder('blocking') .select('blocking.blockerId') .where('blocking.blockeeId = :blockeeId', { blockeeId: me.id }); - const mentionQuery = `SELECT COUNT(*) FROM unnest(note.mentions) mention WHERE mention IN (${blockingQuery.getQuery()}) OR mention IN (${blockedQuery.getQuery()}) LIMIT 1`; - // 投稿の作者にブロックされていない かつ // 投稿の返信先の作者にブロックされていない かつ // 投稿の引用元の作者にブロックされていない q .andWhere(`note.userId NOT IN (${ blockingQuery.getQuery() })`) - .andWhere(`note.userId NOT IN (${ blockedQuery.getQuery() })`) .andWhere(new Brackets(qb => { qb .where('note.replyUserId IS NULL') - .orWhere(`note.replyUserId NOT IN (${ blockedQuery.getQuery() })`) .orWhere(`note.replyUserId NOT IN (${ blockingQuery.getQuery() })`); })) .andWhere(new Brackets(qb => { qb .where('note.renoteUserId IS NULL') - .orWhere(`note.renoteUserId NOT IN (${ blockedQuery.getQuery() })`) .orWhere(`note.renoteUserId NOT IN (${ blockingQuery.getQuery() })`); - })) - .andWhere(`(${mentionQuery}) = 0`); + })); q.setParameters(blockingQuery.getParameters()); - q.setParameters(blockedQuery.getParameters()); } @bindThis diff --git a/packages/backend/src/misc/is-user-related.ts b/packages/backend/src/misc/is-user-related.ts index 09d572499b..862d6e6a38 100644 --- a/packages/backend/src/misc/is-user-related.ts +++ b/packages/backend/src/misc/is-user-related.ts @@ -4,8 +4,6 @@ */ export function isUserRelated(note: any, userIds: Set, ignoreAuthor = false): boolean { - console.log(note); - if (!note) { return false; } @@ -22,13 +20,5 @@ export function isUserRelated(note: any, userIds: Set, ignoreAuthor = fa return true; } - if (!ignoreAuthor && note.mentions != null && note.mentions.some(mention => userIds.has(mention))) { - return true; - } - - if (!ignoreAuthor && note.renote != null && note.renote.mentions != null && note.renote.mentions.some(mention => userIds.has(mention))) { - return true; - } - return false; } diff --git a/packages/backend/src/server/api/stream/Connection.ts b/packages/backend/src/server/api/stream/Connection.ts index 528c4e06c7..f102cb42e1 100644 --- a/packages/backend/src/server/api/stream/Connection.ts +++ b/packages/backend/src/server/api/stream/Connection.ts @@ -42,7 +42,6 @@ export default class Connection { public followingChannels: Set = new Set(); public userIdsWhoMeMuting: Set = new Set(); public userIdsWhoBlockingMe: Set = new Set(); - public userIdsWhoMeBlocking: Set = new Set(); public userIdsWhoMeMutingRenotes: Set = new Set(); public userMutedInstances: Set = new Set(); private fetchIntervalId: NodeJS.Timeout | null = null; @@ -73,13 +72,12 @@ export default class Connection { @bindThis public async fetch() { if (this.user == null) return; - const [userProfile, following, followingChannels, userIdsWhoMeMuting, userIdsWhoBlockingMe, userIdsWhoMeBlocking, userIdsWhoMeMutingRenotes] = await Promise.all([ + const [userProfile, following, followingChannels, userIdsWhoMeMuting, userIdsWhoBlockingMe, userIdsWhoMeMutingRenotes] = await Promise.all([ this.cacheService.userProfileCache.fetch(this.user.id), this.cacheService.userFollowingsCache.fetch(this.user.id), this.channelFollowingService.userFollowingChannelsCache.fetch(this.user.id), this.cacheService.userMutingsCache.fetch(this.user.id), this.cacheService.userBlockedCache.fetch(this.user.id), - this.cacheService.userBlockingCache.fetch(this.user.id), this.cacheService.renoteMutingsCache.fetch(this.user.id), ]); this.userProfile = userProfile; @@ -87,7 +85,6 @@ export default class Connection { this.followingChannels = followingChannels; this.userIdsWhoMeMuting = userIdsWhoMeMuting; this.userIdsWhoBlockingMe = userIdsWhoBlockingMe; - this.userIdsWhoMeBlocking = userIdsWhoMeBlocking; this.userIdsWhoMeMutingRenotes = userIdsWhoMeMutingRenotes; this.userMutedInstances = new Set(userProfile.mutedInstances); } @@ -256,9 +253,6 @@ export default class Connection { if (this.userIdsWhoBlockingMe.has(noteUserId)) { return; } - if (this.userIdsWhoMeBlocking.has(noteUserId)) { - return; - } } } diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts index 620d22cdf7..ae9c7e3e99 100644 --- a/packages/backend/src/server/api/stream/channel.ts +++ b/packages/backend/src/server/api/stream/channel.ts @@ -47,10 +47,6 @@ export default abstract class Channel { return this.connection.userIdsWhoBlockingMe; } - protected get userIdsWhoMeBlocking() { - return this.connection.userIdsWhoMeBlocking; - } - protected get userMutedInstances() { return this.connection.userMutedInstances; } @@ -74,7 +70,6 @@ export default abstract class Channel { if (isUserRelated(note, this.userIdsWhoMeMuting)) return true; // 流れてきたNoteがブロックされているユーザーが関わる if (isUserRelated(note, this.userIdsWhoBlockingMe)) return true; - if (isUserRelated(note, this.userIdsWhoMeBlocking)) return true; // 流れてきたNoteがリノートをミュートしてるユーザが行ったもの if (isRenotePacked(note) && !isQuotePacked(note) && this.userIdsWhoMeMutingRenotes.has(note.user.id)) return true;