1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Refactor to avoid duplicated code

This commit is contained in:
Andrei Zavatski 2020-02-24 23:10:37 +03:00
parent b0b52146ea
commit fe1f2858c1

View File

@ -97,20 +97,12 @@ namespace osu.Game.Overlays.Comments
var orphaned = new List<Comment>();
// Exclude possible duplicated comments.
foreach (var topLevel in bundle.Comments)
foreach (var comment in bundle.Comments.Concat(bundle.IncludedComments))
{
if (commentDictionary.ContainsKey(topLevel.Id))
if (commentDictionary.ContainsKey(comment.Id))
continue;
addNewComment(topLevel);
}
foreach (var child in bundle.IncludedComments)
{
if (commentDictionary.ContainsKey(child.Id))
continue;
addNewComment(child);
addNewComment(comment);
}
// Comments whose parents were seen later than themselves can now be added.