forked from Ivasoft/mattermost-mobile
49 lines
1.7 KiB
JavaScript
49 lines
1.7 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {
|
|
Alert,
|
|
} from 'react-native';
|
|
import {toTitleCase} from 'app/utils/general';
|
|
import {t} from 'app/utils/i18n';
|
|
|
|
export function confirmOutOfOfficeDisabled(intl, status, updateStatus) {
|
|
const userStatusId = 'modal.manual_status.auto_responder.message_' + status;
|
|
t('modal.manual_status.auto_responder.message_');
|
|
t('modal.manual_status.auto_responder.message_away');
|
|
t('modal.manual_status.auto_responder.message_dnd');
|
|
t('modal.manual_status.auto_responder.message_offline');
|
|
t('modal.manual_status.auto_responder.message_online');
|
|
|
|
let translatedStatus;
|
|
if (status === 'dnd') {
|
|
translatedStatus = intl.formatMessage({
|
|
id: 'mobile.set_status.dnd',
|
|
defaultMessage: 'Do Not Disturb',
|
|
});
|
|
} else {
|
|
translatedStatus = intl.formatMessage({
|
|
id: `mobile.set_status.${status}`,
|
|
defaultMessage: toTitleCase(status),
|
|
});
|
|
}
|
|
|
|
Alert.alert(
|
|
intl.formatMessage({
|
|
id: 'mobile.reset_status.title_ooo',
|
|
defaultMessage: 'Disable "Out Of Office"?',
|
|
}),
|
|
intl.formatMessage({
|
|
id: userStatusId,
|
|
defaultMessage: 'Would you like to switch your status to "{status}" and disable Automatic Replies?',
|
|
}, {status: translatedStatus}),
|
|
[{
|
|
text: intl.formatMessage({id: 'mobile.reset_status.alert_cancel', defaultMessage: 'Cancel'}),
|
|
style: 'cancel',
|
|
}, {
|
|
text: intl.formatMessage({id: 'mobile.reset_status.alert_ok', defaultMessage: 'OK'}),
|
|
onPress: () => updateStatus(status),
|
|
}],
|
|
);
|
|
}
|