Fix handling of recursive toots in WebUI (#17041)

This commit is contained in:
Claire 2021-11-25 23:46:39 +01:00 committed by Eugen Rochko
parent 3c18311d86
commit 5e4b04de88

View File

@ -83,7 +83,7 @@ const makeMapStateToProps = () => {
ancestorsIds = ancestorsIds.withMutations(mutable => { ancestorsIds = ancestorsIds.withMutations(mutable => {
let id = statusId; let id = statusId;
while (id) { while (id && !mutable.includes(id)) {
mutable.unshift(id); mutable.unshift(id);
id = inReplyTos.get(id); id = inReplyTos.get(id);
} }
@ -101,7 +101,7 @@ const makeMapStateToProps = () => {
const ids = [statusId]; const ids = [statusId];
while (ids.length > 0) { while (ids.length > 0) {
let id = ids.shift(); let id = ids.pop();
const replies = contextReplies.get(id); const replies = contextReplies.get(id);
if (statusId !== id) { if (statusId !== id) {
@ -110,7 +110,7 @@ const makeMapStateToProps = () => {
if (replies) { if (replies) {
replies.reverse().forEach(reply => { replies.reverse().forEach(reply => {
ids.unshift(reply); if (!ids.includes(reply) && !descendantsIds.includes(reply) && statusId !== reply) ids.push(reply);
}); });
} }
} }