From 0b8fbdfbb9cbff476f3184c429993fe4840e6219 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 13 May 2022 17:17:06 -0500 Subject: [PATCH] Contexts: remove unnecessary isReplyTo function (now handled by connectNodes) --- app/soapbox/reducers/contexts.ts | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/app/soapbox/reducers/contexts.ts b/app/soapbox/reducers/contexts.ts index 219914da8..bfc830c93 100644 --- a/app/soapbox/reducers/contexts.ts +++ b/app/soapbox/reducers/contexts.ts @@ -58,31 +58,8 @@ const importStatuses = (state: State, statuses: ContextStatus[]): State => { }); }; -const isReplyTo = ( - state: State, - childId: string | undefined, - parentId: string, - initialId: string | null = null, -): boolean => { - if (!childId) return false; - - // Prevent cycles - if (childId === initialId) return false; - initialId = initialId || childId; - - if (childId === parentId) { - return true; - } else { - const nextId = state.inReplyTos.get(childId); - return isReplyTo(state, nextId, parentId, initialId); - } -}; - /** Insert a fake status ID connecting descendant to ancestor. */ const insertTombstone = (state: State, ancestorId: string, descendantId: string): State => { - // Prevent infinite loop if the API returns a bogus response - if (isReplyTo(state, ancestorId, descendantId)) return state; - const tombstoneId = `${descendantId}-tombstone`; return state.withMutations(state => { importStatus(state, { id: tombstoneId, in_reply_to_id: ancestorId });