From 8b35f5c2b2ac9b810227aea6e2fc1931c1bf2a39 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 27 Aug 2021 13:33:29 -0300 Subject: [PATCH] [FIX] The unread section is not removed after receiving a new message and swipe to read (#3281) * Fix unread section from direct messages and thread messages * Minor tweak * removed the thread unread, but the thread unread is on branch fix.unread-thread-from-listview Co-authored-by: Diego Mello --- app/presentation/RoomItem/Touchable.js | 1 + app/views/RoomsListView/index.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/presentation/RoomItem/Touchable.js b/app/presentation/RoomItem/Touchable.js index bbf7cbf8..52f2c094 100644 --- a/app/presentation/RoomItem/Touchable.js +++ b/app/presentation/RoomItem/Touchable.js @@ -178,6 +178,7 @@ class Touchable extends React.Component { toggleRead = () => { const { toggleRead, rid, isRead } = this.props; + if (toggleRead) { toggleRead(rid, isRead); } diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index 214f213e..8b905fb2 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -637,6 +637,7 @@ 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() => { @@ -644,6 +645,7 @@ class RoomsListView extends React.Component { const subRecord = await subCollection.find(rid); await subRecord.update((sub) => { sub.alert = isRead; + sub.unread = 0; }); } catch (e) { log(e);