[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 <diegolmello@gmail.com>
This commit is contained in:
parent
abf3945f32
commit
fa00ef92ef
|
@ -461,11 +461,16 @@ class RoomActionsView extends React.Component {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
|
|
||||||
try {
|
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) {
|
if (rooms.length) {
|
||||||
const teamChannels = result.rooms.map(r => ({
|
const teamChannels = rooms.map(r => ({
|
||||||
rid: r._id,
|
rid: r.id,
|
||||||
name: r.name,
|
name: r.name,
|
||||||
teamId: r.teamId,
|
teamId: r.teamId,
|
||||||
alert: r.isLastOwner
|
alert: r.isLastOwner
|
||||||
|
|
Loading…
Reference in New Issue