expose prop to force-collapse MkNote / SkNote

This commit is contained in:
Hazel K 2024-09-30 12:04:44 -04:00
parent 58080ad14f
commit c5117552ca
2 changed files with 12 additions and 4 deletions

View file

@ -241,8 +241,12 @@ const props = withDefaults(defineProps<{
pinned?: boolean;
mock?: boolean;
withHardMute?: boolean;
collapseRenote?: boolean;
collapseReplies?: boolean;
}>(), {
mock: false,
collapseRenote: undefined,
collapseReplies: undefined,
});
provide('mock', props.mock);
@ -314,12 +318,12 @@ const translating = ref(false);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
const renoteCollapsed = ref(
defaultStore.state.collapseRenotes && isRenote && (
(props.collapseRenote ?? defaultStore.state.collapseRenotes) && isRenote && (
($i && ($i.id === note.value.userId || $i.id === appearNote.value.userId)) || // `||` must be `||`! See https://github.com/misskey-dev/misskey/issues/13131
(appearNote.value.myReaction != null)
),
);
const inReplyToCollapsed = ref(defaultStore.state.collapseNotesRepliedTo);
const inReplyToCollapsed = ref(props.collapseReplies ?? defaultStore.state.collapseNotesRepliedTo);
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
const animated = computed(() => parsed.value ? checkAnimationFromMfm(parsed.value) : null);
const allowAnim = ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);

View file

@ -241,8 +241,12 @@ const props = withDefaults(defineProps<{
pinned?: boolean;
mock?: boolean;
withHardMute?: boolean;
collapseRenote?: boolean;
collapseReplies?: boolean;
}>(), {
mock: false,
collapseRenote: undefined,
collapseReplies: undefined,
});
provide('mock', props.mock);
@ -314,12 +318,12 @@ const translating = ref(false);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
const renoteCollapsed = ref(
defaultStore.state.collapseRenotes && isRenote && (
(props.collapseRenote ?? defaultStore.state.collapseRenotes) && isRenote && (
($i && ($i.id === note.value.userId || $i.id === appearNote.value.userId)) || // `||` must be `||`! See https://github.com/misskey-dev/misskey/issues/13131
(appearNote.value.myReaction != null)
)
);
const inReplyToCollapsed = ref(defaultStore.state.collapseNotesRepliedTo);
const inReplyToCollapsed = ref(props.collapseReplies ?? defaultStore.state.collapseNotesRepliedTo);
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
const animated = computed(() => parsed.value ? checkAnimationFromMfm(parsed.value) : null);
const allowAnim = ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);