fix visibility regressions and merge typos

This commit is contained in:
dakkar 2025-06-10 15:13:53 +01:00
parent aba4b537ad
commit d222fafc1b
2 changed files with 13 additions and 12 deletions

View file

@ -168,8 +168,10 @@ export class QueryService {
.orWhere(':meId = note.replyUserId')
// DM to me
.orWhere(':meIdAsList <@ note.visibleUserIds')
// Mentions me
.orWhere(':meIdAsList <@ note.mentions')
// Mentions me (and not a direct message)
.orWhere(new Brackets(qb =>
qb.andWhere(':meIdAsList <@ note.mentions')
.andWhere('note.visibility != \'specified\'')))
// Followers-only post
.orWhere(new Brackets(qb => this
.andFollowingUser(qb, ':meId', 'note.userId')

View file

@ -77,17 +77,21 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
))
.setParameters({ meIdAsList: [me.id] })
, 'source')
.innerJoin(MiNote, 'note', 'note.id = source.id');
.innerJoin(MiNote, 'note', 'note.id = source.id')
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.reply', 'reply')
.leftJoinAndSelect('note.renote', 'renote')
.leftJoinAndSelect('reply.user', 'replyUser')
.leftJoinAndSelect('renote.user', 'renoteUser');
// Mentioned or visible users can always access
//this.queryService.generateVisibilityQuery(query, me);
this.queryService.generateVisibilityQuery(qb, me);
this.queryService.generateBlockedHostQueryForNote(qb);
this.queryService.generateSuspendedUserQueryForNote(query);
this.queryService.generateSuspendedUserQueryForNote(qb);
this.queryService.generateMutedUserQueryForNotes(qb, me);
this.queryService.generateMutedNoteThreadQuery(qb, me);
this.queryService.generateBlockedUserQueryForNotes(qb, me);
// A renote can't mention a user, so it will never appear here anyway.
//this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
//this.queryService.generateMutedUserRenotesQueryForNotes(qb, me);
if (ps.visibility) {
qb.andWhere('note.visibility = :visibility', { visibility: ps.visibility });
@ -101,11 +105,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return qb;
}, 'source', 'source.id = note.id')
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.reply', 'reply')
.leftJoinAndSelect('note.renote', 'renote')
.leftJoinAndSelect('reply.user', 'replyUser')
.leftJoinAndSelect('renote.user', 'renoteUser')
.limit(ps.limit);
const mentions = await query.getMany();