Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] The unread section is not removed after receiving a new message and swipe to read #3281

Merged
merged 8 commits into from
Aug 27, 2021
1 change: 1 addition & 0 deletions app/presentation/RoomItem/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class Touchable extends React.Component {

toggleRead = () => {
const { toggleRead, rid, isRead } = this.props;

if (toggleRead) {
toggleRead(rid, isRead);
}
Expand Down
2 changes: 2 additions & 0 deletions app/views/RoomsListView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,15 @@ class RoomsListView extends React.Component {
try {
const db = database.active;
const result = await RocketChat.toggleRead(isRead, rid);

if (result.success) {
const subCollection = db.get('subscriptions');
await db.action(async() => {
try {
const subRecord = await subCollection.find(rid);
await subRecord.update((sub) => {
sub.alert = isRead;
sub.unread = 0;
});
} catch (e) {
log(e);
Expand Down