[backend/services] Fix mentionsResolver loop (ISH-50)

This commit is contained in:
Laura Hausmann 2024-02-12 22:13:54 +01:00
parent bf916f7046
commit e0f81a7b21
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -34,8 +34,14 @@ public class MentionsResolver(
var nodesList = nodes.ToList();
// We need to call .ToList() on this so we can modify the collection in the loop
foreach (var mention in nodesList.SelectMany(p => p.Children.Append(p)).OfType<MfmMentionNode>().ToList())
nodesList[nodesList.IndexOf(mention)] = ResolveMention(mention, host, mentionCache, splitDomainMapping);
foreach (var node in nodesList.ToList()) {
if (node is not MfmMentionNode mention) {
node.Children = ResolveMentions(node.Children, host, mentionCache, splitDomainMapping);
continue;
}
nodesList[nodesList.IndexOf(node)] = ResolveMention(mention, host, mentionCache, splitDomainMapping);
}
return nodesList;
}