add bypassSilence property at note level to fix silenced users' self-boosts showing a warning even when the user is followed
This commit is contained in:
parent
b9778e7fc8
commit
f1fc8bc357
4 changed files with 19 additions and 4 deletions
|
|
@ -600,6 +600,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
skipHide?: boolean;
|
skipHide?: boolean;
|
||||||
withReactionAndUserPairCache?: boolean;
|
withReactionAndUserPairCache?: boolean;
|
||||||
|
bypassSilence?: boolean;
|
||||||
_hint_?: {
|
_hint_?: {
|
||||||
bufferedReactions: Map<MiNote['id'], { deltas: Record<string, number>; pairs: ([MiUser['id'], string])[] }> | null;
|
bufferedReactions: Map<MiNote['id'], { deltas: Record<string, number>; pairs: ([MiUser['id'], string])[] }> | null;
|
||||||
myReactions: Map<MiNote['id'], string | null>;
|
myReactions: Map<MiNote['id'], string | null>;
|
||||||
|
|
@ -721,6 +722,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
isMutingNote: mutedNotes.has(note.id),
|
isMutingNote: mutedNotes.has(note.id),
|
||||||
isFavorited,
|
isFavorited,
|
||||||
isRenoted,
|
isRenoted,
|
||||||
|
bypassSilence: opts.bypassSilence ?? false,
|
||||||
|
|
||||||
...(meId && Object.keys(reactions).length > 0 ? {
|
...(meId && Object.keys(reactions).length > 0 ? {
|
||||||
myReaction: this.populateMyReaction({
|
myReaction: this.populateMyReaction({
|
||||||
|
|
@ -739,6 +741,9 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
skipHide: opts.skipHide,
|
skipHide: opts.skipHide,
|
||||||
withReactionAndUserPairCache: opts.withReactionAndUserPairCache,
|
withReactionAndUserPairCache: opts.withReactionAndUserPairCache,
|
||||||
_hint_: options?._hint_,
|
_hint_: options?._hint_,
|
||||||
|
|
||||||
|
// Don't silence target of self-renote, since the outer note will already be silenced.
|
||||||
|
bypassSilence: options?.bypassSilence || note.userId === note.replyUserId,
|
||||||
}) : undefined,
|
}) : undefined,
|
||||||
|
|
||||||
renote: note.renoteId ? this.pack(note.renote ?? opts._hint_?.notes.get(note.renoteId) ?? note.renoteId, me, {
|
renote: note.renoteId ? this.pack(note.renote ?? opts._hint_?.notes.get(note.renoteId) ?? note.renoteId, me, {
|
||||||
|
|
@ -746,6 +751,9 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
skipHide: opts.skipHide,
|
skipHide: opts.skipHide,
|
||||||
withReactionAndUserPairCache: opts.withReactionAndUserPairCache,
|
withReactionAndUserPairCache: opts.withReactionAndUserPairCache,
|
||||||
_hint_: options?._hint_,
|
_hint_: options?._hint_,
|
||||||
|
|
||||||
|
// Don't silence target of self-reply, since the outer note will already be silenced.
|
||||||
|
bypassSilence: options?.bypassSilence || note.userId === note.renoteUserId,
|
||||||
}) : undefined,
|
}) : undefined,
|
||||||
} : {}),
|
} : {}),
|
||||||
});
|
});
|
||||||
|
|
@ -771,6 +779,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
options?: {
|
options?: {
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
skipHide?: boolean;
|
skipHide?: boolean;
|
||||||
|
bypassSilence?: boolean;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
if (notes.length === 0) return [];
|
if (notes.length === 0) return [];
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,10 @@ export const packedNoteSchema = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
|
bypassSilence: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
emojis: {
|
emojis: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
optional: true, nullable: false,
|
optional: true, nullable: false,
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,13 @@ function getMutes(note: Misskey.entities.Note, withHardMute: boolean, overrides:
|
||||||
) : {};
|
) : {};
|
||||||
|
|
||||||
const isMe = $i != null && $i.id === note.userId;
|
const isMe = $i != null && $i.id === note.userId;
|
||||||
|
const bypassSilence = note.bypassSilence || note.user.bypassSilence;
|
||||||
|
|
||||||
const hardMuted = override.hardMuted ?? (!isMe && withHardMute && isHardMuted(note));
|
const hardMuted = override.hardMuted ?? (!isMe && withHardMute && isHardMuted(note));
|
||||||
const softMutedWords = override.softMutedWords ?? (isMe ? [] : isSoftMuted(note));
|
const softMutedWords = override.softMutedWords ?? (isMe ? [] : isSoftMuted(note));
|
||||||
const sensitiveMuted = override.sensitiveMuted ?? isSensitiveMuted(note);
|
const sensitiveMuted = override.sensitiveMuted ?? isSensitiveMuted(note);
|
||||||
const userSilenced = override.userSilenced ?? (note.user.isSilenced && !note.user.bypassSilence);
|
const userSilenced = override.userSilenced ?? (note.user.isSilenced && !bypassSilence);
|
||||||
const instanceSilenced = override.instanceSilenced ?? (note.user.instance?.isSilenced && !note.user.bypassSilence) ?? false;
|
const instanceSilenced = override.instanceSilenced ?? (note.user.instance?.isSilenced && !bypassSilence) ?? false;
|
||||||
const threadMuted = override.threadMuted ?? (!isMe && note.isMutingThread);
|
const threadMuted = override.threadMuted ?? (!isMe && note.isMutingThread);
|
||||||
const noteMuted = override.noteMuted ?? (!isMe && note.isMutingNote);
|
const noteMuted = override.noteMuted ?? (!isMe && note.isMutingNote);
|
||||||
const noteMandatoryCW = override.noteMandatoryCW !== undefined
|
const noteMandatoryCW = override.noteMandatoryCW !== undefined
|
||||||
|
|
@ -120,13 +121,13 @@ function getMutes(note: Misskey.entities.Note, withHardMute: boolean, overrides:
|
||||||
: (isMe ? null : note.mandatoryCW);
|
: (isMe ? null : note.mandatoryCW);
|
||||||
const userMandatoryCW = override.userMandatoryCW !== undefined
|
const userMandatoryCW = override.userMandatoryCW !== undefined
|
||||||
? override.userMandatoryCW
|
? override.userMandatoryCW
|
||||||
: !note.user.bypassSilence
|
: !bypassSilence
|
||||||
? note.user.mandatoryCW
|
? note.user.mandatoryCW
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const instanceMandatoryCW = override.instanceMandatoryCW !== undefined
|
const instanceMandatoryCW = override.instanceMandatoryCW !== undefined
|
||||||
? override.instanceMandatoryCW
|
? override.instanceMandatoryCW
|
||||||
: (!note.user.bypassSilence && note.user.instance)
|
: (!bypassSilence && note.user.instance)
|
||||||
? note.user.instance.mandatoryCW
|
? note.user.instance.mandatoryCW
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4732,6 +4732,7 @@ export type components = {
|
||||||
isMutingNote: boolean;
|
isMutingNote: boolean;
|
||||||
isFavorited: boolean;
|
isFavorited: boolean;
|
||||||
isRenoted: boolean;
|
isRenoted: boolean;
|
||||||
|
bypassSilence: boolean;
|
||||||
emojis?: {
|
emojis?: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue