Only show replies count if ancestors is a thread

pull/97/head
Lim Chee Aun 2023-04-08 19:47:54 +08:00
rodzic 8f45f2cb4d
commit eebb55ba38
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -142,6 +142,9 @@ function StatusPage() {
skipThreading: true, skipThreading: true,
}); });
}); });
const ancestorsIsThread = ancestors.every(
(s) => s.account.id === heroStatus.account.id,
);
const nestedDescendants = []; const nestedDescendants = [];
descendants.forEach((status) => { descendants.forEach((status) => {
saveStatus(status, instance, { saveStatus(status, instance, {
@ -184,6 +187,7 @@ function StatusPage() {
...ancestors.map((s) => ({ ...ancestors.map((s) => ({
id: s.id, id: s.id,
ancestor: true, ancestor: true,
isThread: ancestorsIsThread,
accountID: s.account.id, accountID: s.account.id,
repliesCount: s.repliesCount, repliesCount: s.repliesCount,
})), })),
@ -625,6 +629,7 @@ function StatusPage() {
const { const {
id: statusID, id: statusID,
ancestor, ancestor,
isThread,
descendant, descendant,
thread, thread,
replies, replies,
@ -731,7 +736,7 @@ function StatusPage() {
size={thread || ancestor ? 'm' : 's'} size={thread || ancestor ? 'm' : 's'}
enableTranslate enableTranslate
/> />
{ancestor && !!repliesCount && ( {ancestor && isThread && !!repliesCount && (
<div class="replies-link"> <div class="replies-link">
<Icon icon="comment" />{' '} <Icon icon="comment" />{' '}
<span title={repliesCount}> <span title={repliesCount}>