diff --git a/osu.Game/Overlays/Comments/CommentsPage.cs b/osu.Game/Overlays/Comments/CommentsPage.cs index 3f63481458..ebce2177cf 100644 --- a/osu.Game/Overlays/Comments/CommentsPage.cs +++ b/osu.Game/Overlays/Comments/CommentsPage.cs @@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Comments // We may receive already loaded comments receivedComments.ForEach(c => { - if (!drawableComment.LoadedReplies.ContainsKey(c.Id)) + if (!drawableComment.ContainsReply(c.Id)) uniqueComments.Add(c); }); diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 7334c89eb5..8bc989761e 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Comments public readonly BindableBool ShowDeleted = new BindableBool(); public readonly Bindable Sort = new Bindable(); - public readonly Dictionary LoadedReplies = new Dictionary(); + private readonly Dictionary loadedReplies = new Dictionary(); /// /// s which will be added to this as replies on initial load. @@ -290,6 +290,8 @@ namespace osu.Game.Overlays.Comments base.LoadComplete(); } + public bool ContainsReply(long replyId) => loadedReplies.ContainsKey(replyId); + public void AddReplies(IEnumerable replies) { if (LoadState == LoadState.NotLoaded) @@ -311,7 +313,7 @@ namespace osu.Game.Overlays.Comments childCommentsContainer.Add(page); var newReplies = replies.Select(reply => reply.Comment); - newReplies.ForEach(reply => LoadedReplies.Add(reply.Id, reply)); + newReplies.ForEach(reply => loadedReplies.Add(reply.Id, reply)); deletedCommentsCounter.Count.Value += newReplies.Count(reply => reply.IsDeleted); updateButtonsState(); } @@ -326,7 +328,7 @@ namespace osu.Game.Overlays.Comments private void updateButtonsState() { - var loadedReplesCount = LoadedReplies.Count; + var loadedReplesCount = loadedReplies.Count; var hasUnloadedReplies = loadedReplesCount != Comment.RepliesCount; loadMoreCommentsButton.FadeTo(hasUnloadedReplies && loadedReplesCount == 0 ? 1 : 0);