add instance.isSilencedForMe
This commit is contained in:
parent
e4316e9721
commit
bc16dc78d4
7 changed files with 37 additions and 23 deletions
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
|
@ -12096,6 +12096,10 @@ export interface Locale extends ILocale {
|
|||
* {name} has been silenced by {host} staff
|
||||
*/
|
||||
"silencedUserSaysSomething": ParameterizedString<"name" | "host">;
|
||||
/**
|
||||
* {name} has been silenced by {host} staff
|
||||
*/
|
||||
"silencedInstanceSaysSomething": ParameterizedString<"name" | "host">;
|
||||
/**
|
||||
* {name} is flagged: "{cw}"
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -593,6 +593,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
faviconUrl: instance.faviconUrl,
|
||||
themeColor: instance.themeColor,
|
||||
isSilenced: instance.isSilenced,
|
||||
isSilencedForMe: !bypassSilence && instance.isSilenced,
|
||||
mandatoryCW: instance.mandatoryCW,
|
||||
} : undefined),
|
||||
followersCount: followersCount ?? 0,
|
||||
|
|
|
|||
|
|
@ -232,6 +232,10 @@ export const packedUserLiteSchema = {
|
|||
type: 'boolean',
|
||||
nullable: false, optional: false,
|
||||
},
|
||||
isSilencedForMe: {
|
||||
type: 'boolean',
|
||||
nullable: false, optional: false,
|
||||
},
|
||||
mandatoryCW: {
|
||||
type: 'string',
|
||||
nullable: true, optional: false,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Displays a placeholder for a muted note.
|
|||
</I18n>
|
||||
<I18n v-if="mute.userMandatoryCW" :src="i18n.ts.userIsFlaggedAs" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
<template #cw>
|
||||
{{ mute.userMandatoryCW }}
|
||||
|
|
@ -38,19 +38,27 @@ Displays a placeholder for a muted note.
|
|||
<!-- Muted notes/threads -->
|
||||
<I18n v-if="mute.noteMuted" :src="i18n.ts.userSaysSomethingInMutedNote" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
</I18n>
|
||||
<I18n v-else-if="mute.threadMuted" :src="i18n.ts.userSaysSomethingInMutedThread" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
</I18n>
|
||||
|
||||
<!-- Silenced users/instances -->
|
||||
<I18n v-if="mute.isSilenced" :src="i18n.ts.silencedUserSaysSomething" tag="small">
|
||||
<I18n v-if="mute.userSilenced" :src="i18n.ts.silencedUserSaysSomething" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
<template #host>
|
||||
{{ host }}
|
||||
</template>
|
||||
</I18n>
|
||||
<I18n v-if="mute.instanceSilenced" :src="i18n.ts.silencedInstanceSaysSomething" tag="small">
|
||||
<template #name>
|
||||
{{ instanceName }}
|
||||
</template>
|
||||
<template #host>
|
||||
{{ host }}
|
||||
|
|
@ -61,7 +69,7 @@ Displays a placeholder for a muted note.
|
|||
<template v-if="mutedWords">
|
||||
<I18n v-if="prefer.s.showSoftWordMutedWord" :src="i18n.ts.userSaysSomethingAbout" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
<template #word>
|
||||
{{ mutedWords }}
|
||||
|
|
@ -69,7 +77,7 @@ Displays a placeholder for a muted note.
|
|||
</I18n>
|
||||
<I18n v-else :src="i18n.ts.userSaysSomething" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
</I18n>
|
||||
</template>
|
||||
|
|
@ -77,7 +85,7 @@ Displays a placeholder for a muted note.
|
|||
<!-- Sensitive mute -->
|
||||
<I18n v-if="mute.sensitiveMuted" :src="i18n.ts.userSaysSomethingSensitive" tag="small">
|
||||
<template #name>
|
||||
<MkUserName :user="note.user"/>
|
||||
{{ userName }}
|
||||
</template>
|
||||
</I18n>
|
||||
</div>
|
||||
|
|
@ -123,17 +131,10 @@ const mutedWords = computed(() => mute.value.softMutedWords?.join(', '));
|
|||
const isExpanded = computed(() => props.skipMute || expandNote.value || !mute.value.hasMute);
|
||||
const rootClass = computed(() => isExpanded.value ? props.expandedClass : undefined);
|
||||
|
||||
const instanceName = computed(() => {
|
||||
if (props.note.user.instance?.name) {
|
||||
if (props.note.user.instance.name.length <= 32) {
|
||||
return props.note.user.instance.name;
|
||||
}
|
||||
|
||||
return `${props.note.user.instance.name.substring(0, 30)}...`;
|
||||
}
|
||||
|
||||
return props.note.user.host ?? host;
|
||||
});
|
||||
const userName = computed(() => props.note.user.host
|
||||
? `@${props.note.user.username}@${props.note.user.host}`
|
||||
: `@${props.note.user.username}`);
|
||||
const instanceName = computed(() => props.note.user.host ?? host);
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
defineExpose({
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ export interface Mute {
|
|||
softMutedWords?: string[];
|
||||
sensitiveMuted?: boolean;
|
||||
|
||||
isSilenced?: boolean;
|
||||
userSilenced?: boolean;
|
||||
instanceSilenced?: boolean;
|
||||
|
||||
threadMuted?: boolean;
|
||||
noteMuted?: boolean;
|
||||
|
|
@ -110,7 +111,8 @@ function getMutes(note: Misskey.entities.Note, withHardMute: boolean, overrides:
|
|||
const hardMuted = override.hardMuted ?? (!isMe && withHardMute && isHardMuted(note));
|
||||
const softMutedWords = override.softMutedWords ?? (isMe ? [] : isSoftMuted(note));
|
||||
const sensitiveMuted = override.sensitiveMuted ?? isSensitiveMuted(note);
|
||||
const isSilenced = override.isSilenced ?? note.user.isSilencedForMe;
|
||||
const userSilenced = override.userSilenced ?? note.user.isSilencedForMe;
|
||||
const instanceSilenced = override.instanceSilenced ?? note.user.instance?.isSilencedForMe ?? false;
|
||||
const threadMuted = override.threadMuted ?? (!isMe && note.isMutingThread);
|
||||
const noteMuted = override.noteMuted ?? (!isMe && note.isMutingNote);
|
||||
const noteMandatoryCW = override.noteMandatoryCW !== undefined
|
||||
|
|
@ -125,9 +127,9 @@ function getMutes(note: Misskey.entities.Note, withHardMute: boolean, overrides:
|
|||
? note.user.instance.mandatoryCW
|
||||
: null;
|
||||
|
||||
const hasMute = hardMuted || softMutedWords.length > 0 || sensitiveMuted || isSilenced || threadMuted || noteMuted || !!noteMandatoryCW || !!userMandatoryCW || !!instanceMandatoryCW;
|
||||
const hasMute = hardMuted || softMutedWords.length > 0 || sensitiveMuted || userSilenced || instanceSilenced || threadMuted || noteMuted || !!noteMandatoryCW || !!userMandatoryCW || !!instanceMandatoryCW;
|
||||
|
||||
return { hasMute, hardMuted, softMutedWords, sensitiveMuted, isSilenced, threadMuted, noteMuted, noteMandatoryCW, userMandatoryCW, instanceMandatoryCW };
|
||||
return { hasMute, hardMuted, softMutedWords, sensitiveMuted, userSilenced, instanceSilenced, threadMuted, noteMuted, noteMandatoryCW, userMandatoryCW, instanceMandatoryCW };
|
||||
}
|
||||
|
||||
function isHardMuted(note: Misskey.entities.Note): boolean {
|
||||
|
|
|
|||
|
|
@ -4319,6 +4319,7 @@ export type components = {
|
|||
faviconUrl: string | null;
|
||||
themeColor: string | null;
|
||||
isSilenced: boolean;
|
||||
isSilencedForMe: boolean;
|
||||
mandatoryCW: string | null;
|
||||
};
|
||||
followersCount: number;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ unmuteNote: "Unmute note"
|
|||
userSaysSomethingInMutedNote: "{name} said something in a muted post"
|
||||
userSaysSomethingInMutedThread: "{name} said something in a muted thread"
|
||||
silencedUserSaysSomething: "{name} has been silenced by {host} staff"
|
||||
silencedInstanceSaysSomething: "{name} has been silenced by {host} staff"
|
||||
userIsFlaggedAs: "{name} is flagged: \"{cw}\""
|
||||
noteIsFlaggedAs: "Note is flagged: \"{cw}\""
|
||||
instanceIsFlaggedAs: "{name} is flagged: \"{cw}\""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue