summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/users
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-10 20:06:02 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-10 20:06:02 +0900
commit854ac95511ef017b891185b17921291bb27c1ef2 (patch)
tree7315c9e4bf18d24124a393999ec3af194ec2bedb /packages/backend/src/server/api/endpoints/users
parentfix(frontend): ユーザープロフィールページでセンシティブ... (diff)
downloadsharkey-854ac95511ef017b891185b17921291bb27c1ef2.tar.gz
sharkey-854ac95511ef017b891185b17921291bb27c1ef2.tar.bz2
sharkey-854ac95511ef017b891185b17921291bb27c1ef2.zip
fix(backend): センシティブ設定されたチャンネルの投稿をusers/notesで返さないように
Diffstat (limited to 'packages/backend/src/server/api/endpoints/users')
-rw-r--r--packages/backend/src/server/api/endpoints/users/notes.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts
index d2a65142a5..dfef35986e 100644
--- a/packages/backend/src/server/api/endpoints/users/notes.ts
+++ b/packages/backend/src/server/api/endpoints/users/notes.ts
@@ -77,6 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null);
const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null);
const isRangeSpecified = untilId != null && sinceId != null;
+ const isSelf = me && (me.id === ps.userId);
if (isRangeSpecified || sinceId == null) {
const [
@@ -100,7 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
noteIds = noteIds.slice(0, ps.limit);
if (noteIds.length > 0) {
- const isFollowing = me ? me.id === ps.userId || Object.hasOwn(await this.cacheService.userFollowingsCache.fetch(me.id), ps.userId) : false;
+ const isFollowing = me && Object.hasOwn(await this.cacheService.userFollowingsCache.fetch(me.id), ps.userId);
const query = this.notesRepository.createQueryBuilder('note')
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
@@ -122,8 +123,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
+ if (note.channel?.isSensitive && !isSelf) return false;
if (note.visibility === 'specified' && (!me || (me.id !== note.userId && !note.visibleUserIds.some(v => v === me.id)))) return false;
- if (note.visibility === 'followers' && !isFollowing) return false;
+ if (note.visibility === 'followers' && !isFollowing && !isSelf) return false;
return true;
});