diff options
author | Dessalines <tyhou13@gmx.com> | 2020-06-22 19:21:13 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-06-22 19:21:13 -0400 |
commit | be3a375caef2529d57598a2e3f2daa49eb27b441 (patch) | |
tree | c1435983a35e250df316ecd5b4cdf7b4fe5e57de /ui/src/components/inbox.tsx | |
parent | 63fbf70eaa448730abbb54370441056f0a5f9487 (diff) |
Instant mark all as read. Fixes #830
Diffstat (limited to 'ui/src/components/inbox.tsx')
-rw-r--r-- | ui/src/components/inbox.tsx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ui/src/components/inbox.tsx b/ui/src/components/inbox.tsx index 4fa1498a..edbacd51 100644 --- a/ui/src/components/inbox.tsx +++ b/ui/src/components/inbox.tsx @@ -123,7 +123,10 @@ export class Inbox extends Component<any, InboxState> { this.state.unreadOrAll == UnreadOrAll.Unread && ( <ul class="list-inline mb-1 text-muted small font-weight-bold"> <li className="list-inline-item"> - <span class="pointer" onClick={this.markAllAsRead}> + <span + class="pointer" + onClick={linkEvent(this, this.markAllAsRead)} + > {i18n.t('mark_all_as_read')} </span> </li> @@ -392,8 +395,14 @@ export class Inbox extends Component<any, InboxState> { this.refetch(); } - markAllAsRead() { + markAllAsRead(i: Inbox) { WebSocketService.Instance.markAllAsRead(); + i.state.replies = []; + i.state.mentions = []; + i.state.messages = []; + i.sendUnreadCount(); + window.scrollTo(0, 0); + i.setState(i.state); } parseMessage(msg: WebSocketJsonResponse) { @@ -447,12 +456,7 @@ export class Inbox extends Component<any, InboxState> { this.setState(this.state); setupTippy(); } else if (res.op == UserOperation.MarkAllAsRead) { - this.state.replies = []; - this.state.mentions = []; - this.state.messages = []; - this.sendUnreadCount(); - window.scrollTo(0, 0); - this.setState(this.state); + // Moved to be instant } else if (res.op == UserOperation.EditComment) { let data = res.data as CommentResponse; editCommentRes(data, this.state.replies); |