mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 15:03:10 +08:00
Remove initial filed
This commit is contained in:
parent
3c714dc013
commit
eb5dad08aa
@ -78,6 +78,6 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
return WebUtility.HtmlDecode(Regex.Replace(MessageHtml, @"<(.|\n)*?>", string.Empty));
|
return WebUtility.HtmlDecode(Regex.Replace(MessageHtml, @"<(.|\n)*?>", string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetDeletedChildrenCount => ChildComments.Select(c => c.IsDeleted).Count(c => c);
|
public int DeletedChildrenCount => ChildComments.Count(c => c.IsDeleted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Margin = new MarginPadding(5),
|
Margin = new MarginPadding(5),
|
||||||
Action = () => getComments(false),
|
Action = getComments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,11 +119,22 @@ namespace osu.Game.Overlays.Comments
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSortChanged(ValueChangedEvent<CommentsSortCriteria> sort) => getComments();
|
private void onSortChanged(ValueChangedEvent<CommentsSortCriteria> sort)
|
||||||
|
|
||||||
private void getComments(bool initial = true)
|
|
||||||
{
|
{
|
||||||
if (initial)
|
clearComments();
|
||||||
|
getComments();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getComments()
|
||||||
|
{
|
||||||
|
request?.Cancel();
|
||||||
|
loadCancellation?.Cancel();
|
||||||
|
request = new GetCommentsRequest(type, id, Sort.Value, currentPage++);
|
||||||
|
request.Success += response => onSuccess(response);
|
||||||
|
api.Queue(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearComments()
|
||||||
{
|
{
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
loadedTopLevelComments = 0;
|
loadedTopLevelComments = 0;
|
||||||
@ -132,14 +143,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
content.Clear();
|
content.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
request?.Cancel();
|
private void onSuccess(CommentBundle response)
|
||||||
loadCancellation?.Cancel();
|
|
||||||
request = new GetCommentsRequest(type, id, Sort.Value, currentPage++);
|
|
||||||
request.Success += response => onSuccess(response, initial);
|
|
||||||
api.Queue(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSuccess(CommentBundle response, bool initial)
|
|
||||||
{
|
{
|
||||||
loadCancellation = new CancellationTokenSource();
|
loadCancellation = new CancellationTokenSource();
|
||||||
|
|
||||||
@ -163,9 +167,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
content.Add(loaded);
|
content.Add(loaded);
|
||||||
|
|
||||||
int deletedComments = response.Comments.Select(c => c.IsDeleted && c.IsTopLevel).Count(c => c);
|
deletedChildrenPlaceholder.DeletedCount.Value += response.Comments.Count(c => c.IsDeleted && c.IsTopLevel);
|
||||||
|
|
||||||
deletedChildrenPlaceholder.DeletedCount.Value = initial ? deletedComments : deletedChildrenPlaceholder.DeletedCount.Value + deletedComments;
|
|
||||||
|
|
||||||
if (response.HasMore)
|
if (response.HasMore)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
deletedChildrenPlaceholder.DeletedCount.Value = comment.GetDeletedChildrenCount;
|
deletedChildrenPlaceholder.DeletedCount.Value = comment.DeletedChildrenCount;
|
||||||
|
|
||||||
if (comment.UserId.HasValue)
|
if (comment.UserId.HasValue)
|
||||||
username.AddUserLink(comment.User);
|
username.AddUserLink(comment.User);
|
||||||
|
Loading…
Reference in New Issue
Block a user