Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ export default {
You_can_search_using_RegExp_eg: 'You can use RegExp. e.g. `/^text$/i`',
You_colon: 'You: ',
you_were_mentioned: 'you were mentioned',
You_were_removed_from_channel: 'You were removed from {{channel}}',
you: 'you',
You: 'You',
Logged_out_by_server: 'You\'ve been logged out by the server. Please log in again.',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ export default {
You_can_search_using_RegExp_eg: 'Você pode usar expressões regulares, por exemplo `/^text$/i`',
You_colon: 'Você: ',
you_were_mentioned: 'você foi mencionado',
You_were_removed_from_channel: 'Você foi removido de {{channel}}',
you: 'você',
You: 'Você',
Your_invite_link_will_expire_after__usesLeft__uses: 'Seu link de convite irá vencer depois de {{usesLeft}} usos.',
Expand Down
2 changes: 2 additions & 0 deletions app/lib/methods/subscriptions/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { notificationReceived } from '../../../actions/notification';
import { handlePayloadUserInteraction } from '../actions';
import buildMessage from '../helpers/buildMessage';
import RocketChat from '../../rocketchat';
import EventEmmiter from '../../../utils/events';

const removeListener = listener => listener.stop();

Expand Down Expand Up @@ -238,6 +239,7 @@ export default function subscribeRooms() {
...threadMessagesToDelete
);
});
EventEmmiter.emit('removed', { rid: data.rid });
} catch (e) {
log(e);
}
Expand Down
11 changes: 11 additions & 0 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class RoomView extends React.Component {
if (isTablet) {
EventEmitter.addEventListener(KEY_COMMAND, this.handleCommands);
}
EventEmitter.addEventListener('removed', this.handleRemoved);
console.timeEnd(`${ this.constructor.name } mount`);
}

Expand Down Expand Up @@ -311,6 +312,7 @@ class RoomView extends React.Component {
if (isTablet) {
EventEmitter.removeListener(KEY_COMMAND, this.handleCommands);
}
EventEmitter.removeListener('removed', this.handleRemoved);
console.countReset(`${ this.constructor.name }.render calls`);
}

Expand Down Expand Up @@ -551,6 +553,15 @@ class RoomView extends React.Component {
EventEmitter.removeListener('connected', this.handleConnected);
}

handleRemoved = ({ rid }) => {
const { room } = this.state;
const { navigation } = this.props;
if (rid === this.rid) {
navigation.pop();
Comment thread
djorkaeffalexandre marked this conversation as resolved.
showErrorAlert(I18n.t('You_were_removed_from_channel', { channel: this.getRoomTitle(room) }), I18n.t('Oops'));
}
}

internalSetState = (...args) => {
if (!this.mounted) {
return;
Expand Down