xmpp.chapril.org-conversejs/src/plugins/profile/utils.js
JC Brand 5f38a914b1 Update and clean up password-reset feature
- No need for it to be in a separate plugin
- Make all UI strings translateable
- Remove the "Are you sure?" prompt
- Add tests

Fixes #326
2022-12-27 21:07:23 +01:00

29 lines
757 B
JavaScript

import { __ } from 'i18n';
import { api, converse, _converse } from '@converse/headless/core';
const { Strophe, $iq, sizzle, u } = converse.env;
export function getPrettyStatus (stat) {
if (stat === 'chat') {
return __('online');
} else if (stat === 'dnd') {
return __('busy');
} else if (stat === 'xa') {
return __('away for long');
} else if (stat === 'away') {
return __('away');
} else if (stat === 'offline') {
return __('offline');
} else {
return __(stat) || __('online');
}
}
export async function logOut (ev) {
ev?.preventDefault();
const result = await api.confirm(__("Are you sure you want to log out?"));
if (result) {
api.user.logout();
}
}