diff --git a/app/lib/database/schema/app.js b/app/lib/database/schema/app.js index 883e6dfd9..ac7b97e78 100644 --- a/app/lib/database/schema/app.js +++ b/app/lib/database/schema/app.js @@ -59,7 +59,7 @@ export default appSchema({ { name: 'e2e_key_id', type: 'string', isOptional: true }, { name: 'avatar_etag', type: 'string', isOptional: true }, { name: 'team_id', type: 'string', isIndexed: true }, - { name: 'team_main', type: 'boolean', isOptional: true } + { name: 'team_main', type: 'boolean', isOptional: true } // Use `Q.notEq(true)` to get false or null ] }), tableSchema({ diff --git a/app/sagas/room.js b/app/sagas/room.js index 978944786..e17a06da9 100644 --- a/app/sagas/room.js +++ b/app/sagas/room.js @@ -72,6 +72,8 @@ const handleLeaveRoom = function* handleLeaveRoom({ room, roomType, selected }) logEvent(events.RA_LEAVE_F); if (e.data && e.data.errorType === 'error-you-are-last-owner') { Alert.alert(I18n.t('Oops'), I18n.t(e.data.errorType)); + } else if (e?.data?.error === 'last-owner-can-not-be-removed') { + Alert.alert(I18n.t('Oops'), I18n.t(e.data.error)); } else { Alert.alert(I18n.t('Oops'), I18n.t('There_was_an_error_while_action', { action: I18n.t('leaving_room') })); } diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index f055b3649..e5c630ebb 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -515,7 +515,7 @@ class RoomActionsView extends React.Component { const db = database.active; const subCollection = db.get('subscriptions'); const teamRooms = await subCollection.query( - Q.where('team_main', Q.notEq(null)) + Q.where('team_main', true) ); if (teamRooms.length) { @@ -558,7 +558,7 @@ class RoomActionsView extends React.Component { const teams = await db.collections .get('subscriptions') .query( - Q.where('team_main', Q.notEq(null)), + Q.where('team_main', true), Q.where('name', Q.like(`%${ onChangeText }%`)), Q.experimentalTake(QUERY_SIZE), Q.experimentalSortBy('room_updated_at', Q.desc) diff --git a/app/views/RoomInfoEditView/index.js b/app/views/RoomInfoEditView/index.js index 8905e5ee1..d5dd7f0c5 100644 --- a/app/views/RoomInfoEditView/index.js +++ b/app/views/RoomInfoEditView/index.js @@ -326,7 +326,7 @@ class RoomInfoEditView extends React.Component { const subCollection = db.get('subscriptions'); const teamChannels = await subCollection.query( Q.where('team_id', room.teamId), - Q.where('team_main', null) + Q.where('team_main', Q.notEq(true)) ); if (teamChannels.length) { diff --git a/e2e/tests/team/02-team.spec.js b/e2e/tests/team/02-team.spec.js index f6f4d0329..b10fc8206 100644 --- a/e2e/tests/team/02-team.spec.js +++ b/e2e/tests/team/02-team.spec.js @@ -286,9 +286,7 @@ describe('Team', () => { await element(by.text('OK')).tap(); await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000); await element(by.id('select-list-view-submit')).tap(); - await waitFor(element(by.text(`You were removed from ${ team }`))).toExist().withTimeout(8000); - await element(by.text('OK')).tap(); - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); + await waitFor(element(by.id(`rooms-list-view-item-${ team }`))).toBeNotVisible().withTimeout(60000); }); }); });