Instant mark all as read. Fixes #830
This commit is contained in:
parent
63fbf70eaa
commit
be3a375cae
1 changed files with 12 additions and 8 deletions
20
ui/src/components/inbox.tsx
vendored
20
ui/src/components/inbox.tsx
vendored
|
@ -123,7 +123,10 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
this.state.unreadOrAll == UnreadOrAll.Unread && (
|
this.state.unreadOrAll == UnreadOrAll.Unread && (
|
||||||
<ul class="list-inline mb-1 text-muted small font-weight-bold">
|
<ul class="list-inline mb-1 text-muted small font-weight-bold">
|
||||||
<li className="list-inline-item">
|
<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')}
|
{i18n.t('mark_all_as_read')}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
@ -392,8 +395,14 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
this.refetch();
|
this.refetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
markAllAsRead() {
|
markAllAsRead(i: Inbox) {
|
||||||
WebSocketService.Instance.markAllAsRead();
|
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) {
|
parseMessage(msg: WebSocketJsonResponse) {
|
||||||
|
@ -447,12 +456,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
setupTippy();
|
setupTippy();
|
||||||
} else if (res.op == UserOperation.MarkAllAsRead) {
|
} else if (res.op == UserOperation.MarkAllAsRead) {
|
||||||
this.state.replies = [];
|
// Moved to be instant
|
||||||
this.state.mentions = [];
|
|
||||||
this.state.messages = [];
|
|
||||||
this.sendUnreadCount();
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
this.setState(this.state);
|
|
||||||
} else if (res.op == UserOperation.EditComment) {
|
} else if (res.op == UserOperation.EditComment) {
|
||||||
let data = res.data as CommentResponse;
|
let data = res.data as CommentResponse;
|
||||||
editCommentRes(data, this.state.replies);
|
editCommentRes(data, this.state.replies);
|
||||||
|
|
Loading…
Reference in a new issue