merge: Remove visibility of DMs for non-recipient users (!912)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/912 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
3a6bba3306
3 changed files with 5 additions and 3 deletions
|
@ -866,7 +866,8 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) {
|
private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) {
|
||||||
for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) {
|
// Only create mention events for local users, and users for whom the note is visible
|
||||||
|
for (const u of mentionedUsers.filter(u => (note.visibility !== 'specified' || note.visibleUserIds.some(x => x === u.id)) && this.userEntityService.isLocalUser(u))) {
|
||||||
const isThreadMuted = await this.noteThreadMutingsRepository.exists({
|
const isThreadMuted = await this.noteThreadMutingsRepository.exists({
|
||||||
where: {
|
where: {
|
||||||
userId: u.id,
|
userId: u.id,
|
||||||
|
|
|
@ -806,6 +806,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
// TODO why is this unused?
|
// TODO why is this unused?
|
||||||
@bindThis
|
@bindThis
|
||||||
private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) {
|
private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) {
|
||||||
|
// FIXME only users the note is visible to should receive a notification, same as when a note is created
|
||||||
for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) {
|
for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) {
|
||||||
const isThreadMuted = await this.noteThreadMutingsRepository.exists({
|
const isThreadMuted = await this.noteThreadMutingsRepository.exists({
|
||||||
where: {
|
where: {
|
||||||
|
|
|
@ -213,7 +213,6 @@ export class QueryService {
|
||||||
.orWhere('note.userId = :meId')
|
.orWhere('note.userId = :meId')
|
||||||
// または 自分宛て
|
// または 自分宛て
|
||||||
.orWhere(':meIdAsList <@ note.visibleUserIds')
|
.orWhere(':meIdAsList <@ note.visibleUserIds')
|
||||||
.orWhere(':meIdAsList <@ note.mentions')
|
|
||||||
.orWhere(new Brackets(qb => {
|
.orWhere(new Brackets(qb => {
|
||||||
qb
|
qb
|
||||||
// または フォロワー宛ての投稿であり、
|
// または フォロワー宛ての投稿であり、
|
||||||
|
@ -223,7 +222,8 @@ export class QueryService {
|
||||||
// 自分がフォロワーである
|
// 自分がフォロワーである
|
||||||
.where(`note.userId IN (${ followingQuery.getQuery() })`)
|
.where(`note.userId IN (${ followingQuery.getQuery() })`)
|
||||||
// または 自分の投稿へのリプライ
|
// または 自分の投稿へのリプライ
|
||||||
.orWhere('note.replyUserId = :meId');
|
.orWhere('note.replyUserId = :meId')
|
||||||
|
.orWhere(':meIdAsList <@ note.mentions');
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue