mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 20:33:11 +08:00
Refactor to avoid duplicated code
This commit is contained in:
parent
b0b52146ea
commit
fe1f2858c1
@ -97,20 +97,12 @@ namespace osu.Game.Overlays.Comments
|
|||||||
var orphaned = new List<Comment>();
|
var orphaned = new List<Comment>();
|
||||||
|
|
||||||
// Exclude possible duplicated comments.
|
// 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;
|
continue;
|
||||||
|
|
||||||
addNewComment(topLevel);
|
addNewComment(comment);
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var child in bundle.IncludedComments)
|
|
||||||
{
|
|
||||||
if (commentDictionary.ContainsKey(child.Id))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
addNewComment(child);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comments whose parents were seen later than themselves can now be added.
|
// Comments whose parents were seen later than themselves can now be added.
|
||||||
|
Loading…
Reference in New Issue
Block a user