[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: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
fa00ef92ef
commit
2502b27564
|
@ -193,5 +193,8 @@ export default {
|
||||||
},
|
},
|
||||||
Allow_Save_Media_to_Gallery: {
|
Allow_Save_Media_to_Gallery: {
|
||||||
type: 'valueAsBoolean'
|
type: 'valueAsBoolean'
|
||||||
|
},
|
||||||
|
Accounts_AllowInvisibleStatusOption: {
|
||||||
|
type: 'valueAsString'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
"error-user-registration-disabled": "User registration is disabled",
|
"error-user-registration-disabled": "User registration is disabled",
|
||||||
"error-user-registration-secret": "User registration is only allowed via Secret URL",
|
"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-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",
|
"Actions": "Actions",
|
||||||
"activity": "activity",
|
"activity": "activity",
|
||||||
"Activity": "Activity",
|
"Activity": "Activity",
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
"error-user-registration-disabled": "O registro do usuário está desativado",
|
"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-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-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",
|
"Actions": "Ações",
|
||||||
"activity": "atividade",
|
"activity": "atividade",
|
||||||
"Activity": "Atividade",
|
"Activity": "Atividade",
|
||||||
|
|
|
@ -8,6 +8,7 @@ import * as List from '../containers/List';
|
||||||
import Status from '../containers/Status/Status';
|
import Status from '../containers/Status/Status';
|
||||||
import TextInput from '../containers/TextInput';
|
import TextInput from '../containers/TextInput';
|
||||||
import EventEmitter from '../utils/events';
|
import EventEmitter from '../utils/events';
|
||||||
|
import { showErrorAlert } from '../utils/info';
|
||||||
import Loading from '../containers/Loading';
|
import Loading from '../containers/Loading';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import log, { logEvent, events } from '../utils/log';
|
import log, { logEvent, events } from '../utils/log';
|
||||||
|
@ -58,7 +59,8 @@ class StatusView extends React.Component {
|
||||||
theme: PropTypes.string,
|
theme: PropTypes.string,
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
isMasterDetail: PropTypes.bool,
|
isMasterDetail: PropTypes.bool,
|
||||||
setUser: PropTypes.func
|
setUser: PropTypes.func,
|
||||||
|
Accounts_AllowInvisibleStatusOption: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -168,6 +170,7 @@ class StatusView extends React.Component {
|
||||||
setUser({ status: item.id });
|
setUser({ status: item.id });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
showErrorAlert(I18n.t(e.data.errorType));
|
||||||
logEvent(events.SET_STATUS_FAIL);
|
logEvent(events.SET_STATUS_FAIL);
|
||||||
log(e);
|
log(e);
|
||||||
}
|
}
|
||||||
|
@ -181,10 +184,14 @@ class StatusView extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading } = this.state;
|
const { loading } = this.state;
|
||||||
|
const { Accounts_AllowInvisibleStatusOption } = this.props;
|
||||||
|
|
||||||
|
const status = Accounts_AllowInvisibleStatusOption ? STATUS : STATUS.filter(s => s.id !== 'offline');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView testID='status-view'>
|
<SafeAreaView testID='status-view'>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={STATUS}
|
data={status}
|
||||||
keyExtractor={item => item.id}
|
keyExtractor={item => item.id}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ListHeaderComponent={this.renderHeader}
|
ListHeaderComponent={this.renderHeader}
|
||||||
|
@ -199,7 +206,8 @@ class StatusView extends React.Component {
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
user: getUserSelector(state),
|
user: getUserSelector(state),
|
||||||
isMasterDetail: state.app.isMasterDetail
|
isMasterDetail: state.app.isMasterDetail,
|
||||||
|
Accounts_AllowInvisibleStatusOption: state.settings.Accounts_AllowInvisibleStatusOption ?? true
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
Loading…
Reference in New Issue