From fa00ef92efa45fef3938afbb92be52b97cb16358 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 4 Jun 2021 17:23:31 -0300 Subject: [PATCH] [IMPROVEMENT] Load team's rooms from local database on team leave (#3185) * [IMPROVEMENT] Search team list rooms of user in watermelon db * Minor nitpick Co-authored-by: Diego Mello --- app/views/RoomActionsView/index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index 0c7267d0a..77a4cc59b 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -461,11 +461,16 @@ class RoomActionsView extends React.Component { const { navigation } = this.props; try { - const result = await RocketChat.teamListRoomsOfUser({ teamId: room.teamId, userId: room.u._id }); + const db = database.active; + const subCollection = db.get('subscriptions'); + const rooms = await subCollection.query( + Q.where('team_id', Q.eq(room.teamId)), + Q.where('team_main', Q.notEq(true)) + ); - if (result.rooms?.length) { - const teamChannels = result.rooms.map(r => ({ - rid: r._id, + if (rooms.length) { + const teamChannels = rooms.map(r => ({ + rid: r.id, name: r.name, teamId: r.teamId, alert: r.isLastOwner