Fix regression: threadify stopped working

This is due to status key changed with extra instance string
This commit is contained in:
Lim Chee Aun 2023-02-19 21:16:23 +08:00
parent be35f3a415
commit 5c6c9a43f2
2 changed files with 7 additions and 5 deletions

View file

@ -294,12 +294,12 @@ function Status({
{!withinContext && ( {!withinContext && (
<> <>
{inReplyToAccountId === status.account?.id || {inReplyToAccountId === status.account?.id ||
!!snapStates.statusThreadNumber[id] ? ( !!snapStates.statusThreadNumber[sKey] ? (
<div class="status-thread-badge"> <div class="status-thread-badge">
<Icon icon="thread" size="s" /> <Icon icon="thread" size="s" />
Thread Thread
{snapStates.statusThreadNumber[id] {snapStates.statusThreadNumber[sKey]
? ` ${snapStates.statusThreadNumber[id]}/X` ? ` ${snapStates.statusThreadNumber[sKey]}/X`
: ''} : ''}
</div> </div>
) : ( ) : (

View file

@ -124,7 +124,8 @@ export function threadifyStatus(status, propInstance) {
throw 'Not a thread'; throw 'Not a thread';
// Possibly thread of replies by multiple people? // Possibly thread of replies by multiple people?
} }
let prevStatus = states.statuses[inReplyToId]; const key = statusKey(inReplyToId, instance);
let prevStatus = states.statuses[key];
if (!prevStatus) { if (!prevStatus) {
if (fetchIndex++ > 3) throw 'Too many fetches for thread'; // Some people revive old threads if (fetchIndex++ > 3) throw 'Too many fetches for thread'; // Some people revive old threads
await new Promise((r) => setTimeout(r, 500 * fetchIndex)); // Be nice to rate limits await new Promise((r) => setTimeout(r, 500 * fetchIndex)); // Be nice to rate limits
@ -139,7 +140,8 @@ export function threadifyStatus(status, propInstance) {
if (statuses.length > 1) { if (statuses.length > 1) {
console.debug('THREAD', statuses); console.debug('THREAD', statuses);
statuses.forEach((status, index) => { statuses.forEach((status, index) => {
states.statusThreadNumber[status.id] = index + 1; const key = statusKey(status.id, instance);
states.statusThreadNumber[key] = index + 1;
}); });
} }
}) })