limit length of instance name in mutes
This commit is contained in:
parent
9f0fdbbb51
commit
376997cbcc
1 changed files with 14 additions and 1 deletions
|
|
@ -28,7 +28,7 @@ Displays a placeholder for a muted note.
|
||||||
</I18n>
|
</I18n>
|
||||||
<I18n v-if="mute.instanceMandatoryCW" :src="i18n.ts.instanceIsFlaggedAs" tag="small">
|
<I18n v-if="mute.instanceMandatoryCW" :src="i18n.ts.instanceIsFlaggedAs" tag="small">
|
||||||
<template #name>
|
<template #name>
|
||||||
{{ note.user.instance?.name ?? note.user.host }}
|
{{ instanceName }}
|
||||||
</template>
|
</template>
|
||||||
<template #cw>
|
<template #cw>
|
||||||
{{ mute.instanceMandatoryCW }}
|
{{ mute.instanceMandatoryCW }}
|
||||||
|
|
@ -77,6 +77,7 @@ Displays a placeholder for a muted note.
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { computed, ref, useTemplateRef, defineExpose } from 'vue';
|
import { computed, ref, useTemplateRef, defineExpose } from 'vue';
|
||||||
|
import { host } from '@@/js/config.js';
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
|
|
@ -109,6 +110,18 @@ const mutedWords = computed(() => mute.value.softMutedWords?.join(', '));
|
||||||
const isExpanded = computed(() => expandNote.value || !mute.value.hasMute);
|
const isExpanded = computed(() => expandNote.value || !mute.value.hasMute);
|
||||||
const rootClass = computed(() => isExpanded.value ? props.expandedClass : undefined);
|
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 rootEl = useTemplateRef('rootEl');
|
const rootEl = useTemplateRef('rootEl');
|
||||||
defineExpose({
|
defineExpose({
|
||||||
rootEl: rootEl as Ref<HTMLElement | null>,
|
rootEl: rootEl as Ref<HTMLElement | null>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue