Unverified Commit 2502b275 authored by Reinaldo Neto's avatar Reinaldo Neto Committed by GitHub
Browse files

[FIX] Option to prevent users from using Invisible status (#3186)



* [FIX] Option to prevent users from using Invisible status

* Added error to pt-BR

Co-authored-by: default avatarDiego Mello <diegolmello@gmail.com>
parent fa00ef92
......@@ -193,5 +193,8 @@ export default {
},
Allow_Save_Media_to_Gallery: {
type: 'valueAsBoolean'
},
Accounts_AllowInvisibleStatusOption: {
type: 'valueAsString'
}
};
......@@ -79,6 +79,7 @@
"error-user-registration-disabled": "User registration is disabled",
"error-user-registration-secret": "User registration is only allowed via Secret URL",
"error-you-are-last-owner": "You are the last owner. Please set new owner before leaving the room.",
"error-status-not-allowed": "Invisible status is disabled",
"Actions": "Actions",
"activity": "activity",
"Activity": "Activity",
......
......@@ -75,6 +75,7 @@
"error-user-registration-disabled": "O registro do usuário está desativado",
"error-user-registration-secret": "O registro de usuário é permitido somente via URL secreta",
"error-you-are-last-owner": "Você é o último proprietário da sala. Por favor defina um novo proprietário antes de sair.",
"error-status-not-allowed": "O status invisível está desativado",
"Actions": "Ações",
"activity": "atividade",
"Activity": "Atividade",
......
......@@ -8,6 +8,7 @@ import * as List from '../containers/List';
import Status from '../containers/Status/Status';
import TextInput from '../containers/TextInput';
import EventEmitter from '../utils/events';
import { showErrorAlert } from '../utils/info';
import Loading from '../containers/Loading';
import RocketChat from '../lib/rocketchat';
import log, { logEvent, events } from '../utils/log';
......@@ -58,7 +59,8 @@ class StatusView extends React.Component {
theme: PropTypes.string,
navigation: PropTypes.object,
isMasterDetail: PropTypes.bool,
setUser: PropTypes.func
setUser: PropTypes.func,
Accounts_AllowInvisibleStatusOption: PropTypes.bool
}
constructor(props) {
......@@ -168,6 +170,7 @@ class StatusView extends React.Component {
setUser({ status: item.id });
}
} catch (e) {
showErrorAlert(I18n.t(e.data.errorType));
logEvent(events.SET_STATUS_FAIL);
log(e);
}
......@@ -181,10 +184,14 @@ class StatusView extends React.Component {
render() {
const { loading } = this.state;
const { Accounts_AllowInvisibleStatusOption } = this.props;
const status = Accounts_AllowInvisibleStatusOption ? STATUS : STATUS.filter(s => s.id !== 'offline');
return (
<SafeAreaView testID='status-view'>
<FlatList
data={STATUS}
data={status}
keyExtractor={item => item.id}
renderItem={this.renderItem}
ListHeaderComponent={this.renderHeader}
......@@ -199,7 +206,8 @@ class StatusView extends React.Component {
const mapStateToProps = state => ({
user: getUserSelector(state),
isMasterDetail: state.app.isMasterDetail
isMasterDetail: state.app.isMasterDetail,
Accounts_AllowInvisibleStatusOption: state.settings.Accounts_AllowInvisibleStatusOption ?? true
});
const mapDispatchToProps = dispatch => ({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment