]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix handling of recursive toots in WebUI
authorClaire <claire.github-309c@sitedethib.com>
Thu, 25 Nov 2021 22:46:39 +0000 (23:46 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Thu, 25 Nov 2021 22:52:22 +0000 (23:52 +0100)
Port b1fd6d44901a13450d22884b02eb6e9ae4fc1248 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/features/status/index.js

index bddf1a2efa0380e60a5e0fbed83554042a703bdc..12ea407ad377616f0c82644c77379129167d9402 100644 (file)
@@ -70,7 +70,7 @@ const makeMapStateToProps = () => {
     ancestorsIds = ancestorsIds.withMutations(mutable => {
       let id = statusId;
 
-      while (id) {
+      while (id && !mutable.includes(id)) {
         mutable.unshift(id);
         id = inReplyTos.get(id);
       }
@@ -88,7 +88,7 @@ const makeMapStateToProps = () => {
     const ids = [statusId];
 
     while (ids.length > 0) {
-      let id        = ids.shift();
+      let id        = ids.pop();
       const replies = contextReplies.get(id);
 
       if (statusId !== id) {
@@ -97,7 +97,7 @@ const makeMapStateToProps = () => {
 
       if (replies) {
         replies.reverse().forEach(reply => {
-          ids.unshift(reply);
+          if (!ids.includes(reply) && !descendantsIds.includes(reply) && statusId !== reply) ids.push(reply);
         });
       }
     }