1
0
mirror of https://github.com/tooot-app/app synced 2025-01-18 12:15:42 +01:00

Fix remote toot level is not applied

This commit is contained in:
xmflsct 2023-01-07 11:32:50 +01:00
parent ea02561cdb
commit 1704c0401c

View File

@ -94,11 +94,13 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
{ {
body: statuses.map((status, index) => { body: statuses.map((status, index) => {
if (index < highlightIndex.current || status.id === toot.id) { if (index < highlightIndex.current || status.id === toot.id) {
return { ...status, _level: 0 } status._level = 0
return status
} else { } else {
const repliedLevel: number = const repliedLevel: number =
statuses.find(s => s.id === status.in_reply_to_id)?._level || 0 statuses.find(s => s.id === status.in_reply_to_id)?._level || 0
return { ...status, _level: repliedLevel + 1 } status._level = repliedLevel + 1
return status
} }
}) })
} }
@ -169,11 +171,13 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
return statuses.map((status, index) => { return statuses.map((status, index) => {
if (index < highlightIndex.current || status.id === toot.id) { if (index < highlightIndex.current || status.id === toot.id) {
return { ...status, _level: 0 } status._level = 0
return status
} }
const repliedLevel: number = statuses.find(s => s.id === status.in_reply_to_id)?._level || 0 const repliedLevel: number = statuses.find(s => s.id === status.in_reply_to_id)?._level || 0
return { ...status, _level: repliedLevel + 1 } status._level = repliedLevel + 1
return status
}) })
}, },
{ {
@ -206,7 +210,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
) )
if (localMatch) { if (localMatch) {
delete localMatch.key delete localMatch.key
return localMatch return { ...localMatch, _level: remote._level }
} else { } else {
return { return {
...remote, ...remote,
@ -372,8 +376,8 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
} }
}) })
: null} : null}
{/* <CustomText <CustomText
children={finalData.current[index - 1]?._level} children={query.data.pages[0].body[index - 1]?._level}
style={{ position: 'absolute', top: 4, left: 4, color: colors.red }} style={{ position: 'absolute', top: 4, left: 4, color: colors.red }}
/> />
<CustomText <CustomText
@ -381,9 +385,9 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
style={{ position: 'absolute', top: 20, left: 4, color: colors.yellow }} style={{ position: 'absolute', top: 20, left: 4, color: colors.yellow }}
/> />
<CustomText <CustomText
children={finalData.current[index + 1]?._level} children={query.data.pages[0].body[index + 1]?._level}
style={{ position: 'absolute', top: 36, left: 4, color: colors.green }} style={{ position: 'absolute', top: 36, left: 4, color: colors.green }}
/> */} />
</View> </View>
) )
}} }}