diff --git a/app/constants/settings.js b/app/constants/settings.js index 9f0df886..d684a11c 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -193,5 +193,8 @@ export default { }, Allow_Save_Media_to_Gallery: { type: 'valueAsBoolean' + }, + Accounts_AllowInvisibleStatusOption: { + type: 'valueAsString' } }; diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index e23bb33b..1f37628d 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -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", diff --git a/app/i18n/locales/pt-BR.json b/app/i18n/locales/pt-BR.json index 7eca8b04..29395961 100644 --- a/app/i18n/locales/pt-BR.json +++ b/app/i18n/locales/pt-BR.json @@ -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", diff --git a/app/views/StatusView.js b/app/views/StatusView.js index 3f5a48c1..2ac35834 100644 --- a/app/views/StatusView.js +++ b/app/views/StatusView.js @@ -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 ( 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 => ({