From 1ece7b3fe3a354066c2441d20d0c60b660583614 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 10 Dec 2022 23:24:41 +0100 Subject: [PATCH] Fixed #541 Mastodon does not offer the functionality to group notifications like Twitter does, therefore the best solution is to collapse more content by default, assuming users roughly remember what they have tooted --- src/components/Timeline/Notifications.tsx | 5 ++++- src/components/Timeline/Shared/Content.tsx | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/Timeline/Notifications.tsx b/src/components/Timeline/Notifications.tsx index 04204965..4d7b69a6 100644 --- a/src/components/Timeline/Notifications.tsx +++ b/src/components/Timeline/Notifications.tsx @@ -108,7 +108,10 @@ const TimelineNotifications: React.FC = ({ paddingLeft: highlighted ? 0 : StyleConstants.Avatar.M + StyleConstants.Spacing.S }} > - + diff --git a/src/components/Timeline/Shared/Content.tsx b/src/components/Timeline/Shared/Content.tsx index 5e2578a1..0c187cee 100644 --- a/src/components/Timeline/Shared/Content.tsx +++ b/src/components/Timeline/Shared/Content.tsx @@ -6,10 +6,11 @@ import { useSelector } from 'react-redux' import StatusContext from './Context' export interface Props { + notificationOwnToot?: boolean setSpoilerExpanded?: React.Dispatch> } -const TimelineContent: React.FC = ({ setSpoilerExpanded }) => { +const TimelineContent: React.FC = ({ notificationOwnToot = false, setSpoilerExpanded }) => { const { status, highlighted, disableDetails } = useContext(StatusContext) if (!status || typeof status.content !== 'string' || !status.content.length) return null @@ -38,7 +39,13 @@ const TimelineContent: React.FC = ({ setSpoilerExpanded }) => { emojis={status.emojis} mentions={status.mentions} tags={status.tags} - numberOfLines={instanceAccount.preferences['reading:expand:spoilers'] ? 999 : 1} + numberOfLines={ + instanceAccount.preferences['reading:expand:spoilers'] + ? notificationOwnToot + ? 2 + : 999 + : 1 + } expandHint={t('shared.content.expandHint')} setSpoilerExpanded={setSpoilerExpanded} highlighted={highlighted} @@ -53,7 +60,7 @@ const TimelineContent: React.FC = ({ setSpoilerExpanded }) => { emojis={status.emojis} mentions={status.mentions} tags={status.tags} - numberOfLines={highlighted ? 999 : undefined} + numberOfLines={highlighted ? 999 : notificationOwnToot ? 2 : undefined} disableDetails={disableDetails} /> )}