refetch inbox when marking a message as read (#2131)

This commit is contained in:
biosfood 2023-09-13 15:27:50 +02:00 committed by GitHub
parent d7a80a184f
commit a97e608f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -918,12 +918,20 @@ export class Inbox extends Component<any, InboxState> {
async handleCommentReplyRead(form: MarkCommentReplyAsRead) { async handleCommentReplyRead(form: MarkCommentReplyAsRead) {
const res = await HttpService.client.markCommentReplyAsRead(form); const res = await HttpService.client.markCommentReplyAsRead(form);
this.findAndUpdateCommentReply(res); if (this.state.unreadOrAll === UnreadOrAll.All) {
this.findAndUpdateCommentReply(res);
} else {
await this.refetch();
}
} }
async handlePersonMentionRead(form: MarkPersonMentionAsRead) { async handlePersonMentionRead(form: MarkPersonMentionAsRead) {
const res = await HttpService.client.markPersonMentionAsRead(form); const res = await HttpService.client.markPersonMentionAsRead(form);
this.findAndUpdateMention(res); if (this.state.unreadOrAll === UnreadOrAll.All) {
this.findAndUpdateMention(res);
} else {
await this.refetch();
}
} }
async handleBanFromCommunity(form: BanFromCommunity) { async handleBanFromCommunity(form: BanFromCommunity) {
@ -948,7 +956,11 @@ export class Inbox extends Component<any, InboxState> {
async handleMarkMessageAsRead(form: MarkPrivateMessageAsRead) { async handleMarkMessageAsRead(form: MarkPrivateMessageAsRead) {
const res = await HttpService.client.markPrivateMessageAsRead(form); const res = await HttpService.client.markPrivateMessageAsRead(form);
this.findAndUpdateMessage(res); if (this.state.unreadOrAll === UnreadOrAll.All) {
this.findAndUpdateMessage(res);
} else {
await this.refetch();
}
} }
async handleMessageReport(form: CreatePrivateMessageReport) { async handleMessageReport(form: CreatePrivateMessageReport) {