Merge branch 'feat/fold' into 'develop'
feat: For NotificationFold posts, set a smaller collepsing threshold Co-authored-by: Lhcfl <Lhcfl@outlook.com> See merge request firefish/firefish!10768
This commit is contained in:
commit
23e57737a6
3 changed files with 34 additions and 11 deletions
|
@ -113,6 +113,7 @@
|
|||
:detailed="true"
|
||||
:detailed-view="detailedView"
|
||||
:parent-id="appearNote.id"
|
||||
:is-long-judger="isLongJudger"
|
||||
@push="(e) => router.push(notePage(e))"
|
||||
@focusfooter="footerEl!.focus()"
|
||||
@expanded="(e) => setPostExpanded(e)"
|
||||
|
@ -325,6 +326,7 @@ const props = defineProps<{
|
|||
collapsedReply?: boolean;
|
||||
hideFooter?: boolean;
|
||||
hideEmojiViewer?: boolean;
|
||||
isLongJudger?: (note: entities.Note) => boolean;
|
||||
}>();
|
||||
|
||||
const inChannel = inject("inChannel", null);
|
||||
|
|
|
@ -60,12 +60,14 @@
|
|||
class="content"
|
||||
:note="removeReplyTo(notification.note.renote)"
|
||||
:hide-emoji-viewer="true"
|
||||
:is-long-judger="isLongJudger"
|
||||
/>
|
||||
<XNote
|
||||
v-else
|
||||
class="content"
|
||||
:note="removeReplyTo(notification.note)"
|
||||
:hide-emoji-viewer="true"
|
||||
:is-long-judger="isLongJudger"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -120,6 +122,15 @@ const userleft = ref(props.notification.users.length - users.value.length);
|
|||
let readObserver: IntersectionObserver | undefined;
|
||||
let connection: Connection<Channels["main"]> | null = null;
|
||||
|
||||
function isLongJudger(note: entities.Note) {
|
||||
return (
|
||||
note.text != null &&
|
||||
(note.text.split("\n").length > 5 ||
|
||||
note.text.length > 300 ||
|
||||
note.files.length > 4)
|
||||
);
|
||||
}
|
||||
|
||||
function getText() {
|
||||
let res = "";
|
||||
switch (props.notification.type) {
|
||||
|
|
|
@ -196,13 +196,26 @@ import { i18n } from "@/i18n";
|
|||
import { defaultStore } from "@/store";
|
||||
import icon from "@/scripts/icon";
|
||||
|
||||
const props = defineProps<{
|
||||
note: entities.Note;
|
||||
parentId?: string;
|
||||
conversation?: entities.Note[];
|
||||
detailed?: boolean;
|
||||
detailedView?: boolean;
|
||||
}>();
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
note: entities.Note;
|
||||
parentId?: string;
|
||||
conversation?: entities.Note[];
|
||||
detailed?: boolean;
|
||||
detailedView?: boolean;
|
||||
isLongJudger?: (note: entities.Note) => boolean;
|
||||
}>(),
|
||||
{
|
||||
isLongJudger: (note: entities.Note) => {
|
||||
return (
|
||||
note.text != null &&
|
||||
(note.text.split("\n").length > 10 ||
|
||||
note.text.length > 800 ||
|
||||
note.files.length > 4)
|
||||
);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: "push", v): void;
|
||||
|
@ -216,10 +229,7 @@ const showMoreButton = ref<HTMLElement>();
|
|||
const isLong =
|
||||
!props.detailedView &&
|
||||
props.note.cw == null &&
|
||||
((props.note.text != null &&
|
||||
(props.note.text.split("\n").length > 10 ||
|
||||
props.note.text.length > 800)) ||
|
||||
props.note.files.length > 4);
|
||||
props.isLongJudger(props.note);
|
||||
const collapsed = ref(props.note.cw == null && isLong);
|
||||
const urls = props.note.text
|
||||
? extractUrlFromMfm(mfm.parse(props.note.text)).slice(0, 5)
|
||||
|
|
Loading…
Reference in a new issue