toast adding moderator to remind that the user needs to be registered

pull/1436/head
Audric Ackermann 4 years ago
parent 3476b54d43
commit 39c64b9fbf
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1752,6 +1752,18 @@
"message": "You cannot remove this user as they are the creator of the group.",
"description": "Toast description when the user tries to remove the creator from a closed group v2 member list."
},
"userNeedsToHaveJoined": {
"message": "User needs to have joined",
"description": "Toast title when the user tries to remove the creator from a closed group v2 member list."
},
"userNeedsToHaveJoinedDesc": {
"message": "Remember that this user needs to have already joined the server for this ADD to work.",
"description": "Toast description when the user adds a moderator for an open group."
},
"addToTheListBelow": {
"message": "Add to the list below",
"description": "Button action to add a moderator by pubkey"
},
"noContactsForGroup": {
"message": "You don't have any contacts yet",
"androidKey": "activity_create_closed_group_empty_state_message"

@ -59,11 +59,16 @@
this.remove();
},
async onSubmit(pubKeys) {
log.info(`asked to add ${pubKeys}`);
log.info(`asked to add moderators: ${pubKeys}`);
window.libsession.Utils.ToastUtils.pushUserNeedsToHaveJoined();
const res = await this.channelAPI.serverAPI.addModerators(pubKeys);
if (res !== true) {
// we have errors, deal with them...
// how?
window.log.warn('failed to add moderators:', res);
} else {
window.log.info(`${pubKeys} added as moderators...`);
}
},
});

@ -56,10 +56,15 @@
this.remove();
},
async onSubmit(pubKeys) {
window.log.info(`asked to remove moderators ${pubKeys}`);
const res = await this.channelAPI.serverAPI.removeModerators(pubKeys);
if (res !== true) {
// we have errors, deal with them...
// how?
window.log.warn('failed to remove moderators:', res);
} else {
window.log.info(`${pubKeys} removed from moderators...`);
}
},
});

@ -4,8 +4,6 @@ import { QRCode } from 'react-qr-svg';
import { SessionModal } from './session/SessionModal';
import { SessionButton, SessionButtonColor } from './session/SessionButton';
import { SessionSpinner } from './session/SessionSpinner';
import { toast } from 'react-toastify';
import { SessionToast, SessionToastType } from './session/SessionToast';
import { ToastUtils } from '../session/utils';
import { DefaultTheme } from 'styled-components';
import { ConversationController } from '../session/conversations';

@ -120,7 +120,7 @@ export class AddModeratorsDialog extends React.Component<Props, State> {
}
public render() {
const i18n = window.i18n;
const { i18n } = window;
const hasContacts = this.state.contactList.length !== 0;
@ -143,7 +143,7 @@ export class AddModeratorsDialog extends React.Component<Props, State> {
buttonType={SessionButtonType.Brand}
buttonColor={SessionButtonColor.Primary}
onClick={this.add}
text={i18n('add')}
text={i18n('addToTheListBelow')}
/>
</div>
<div className="moderatorList">

@ -259,3 +259,11 @@ export function pushCannotRemoveCreatorFromGroup() {
window.i18n('cannotRemoveCreatorFromGroupDesc')
);
}
export function pushUserNeedsToHaveJoined() {
pushToastInfo(
'userNeedsToHaveJoined',
window.i18n('userNeedsToHaveJoined'),
window.i18n('userNeedsToHaveJoinedDesc')
);
}

Loading…
Cancel
Save