Delete channel / group merge

pull/740/head
Vincent 5 years ago
parent 0a525629ee
commit ff7d2468ca

@ -1,4 +1,4 @@
/* global Backbone, Whisper, storage, _, ConversationController, $ */
/* global Backbone, i18n, Whisper, storage, _, ConversationController, $ */
/* eslint-disable more/no-then */
@ -238,8 +238,19 @@
this.el.append(dialog.el);
},
showLeaveGroupDialog(groupConvo) {
const dialog = new Whisper.LeaveGroupDialogView(groupConvo);
this.el.append(dialog.el);
const title = groupConvo.isPublic()
? i18n('deletePublicChannel')
: i18n('deleteContact');
const message = groupConvo.isPublic()
? i18n('deletePublicChannelConfirmation')
: i18n('deleteContactConfirmation');
window.confirmationDialog({
title,
message,
resolve: () => ConversationController.deleteContact(groupConvo.id),
});
},
showInviteFriendsDialog(groupConvo) {
const dialog = new Whisper.InviteFriendsDialogView(groupConvo);

@ -47,47 +47,6 @@
},
});
Whisper.LeaveGroupDialogView = Whisper.View.extend({
className: 'loki-dialog modal',
initialize(groupConvo) {
this.groupConvo = groupConvo;
this.titleText = groupConvo.get('name');
this.messageText = i18n('leaveGroupDialogTitle');
this.okText = i18n('yes');
this.cancelText = i18n('cancel');
this.close = this.close.bind(this);
this.confirm = this.confirm.bind(this);
this.$el.focus();
this.render();
},
render() {
this.dialogView = new Whisper.ReactWrapperView({
className: 'leave-group-dialog',
Component: window.Signal.Components.ConfirmDialog,
props: {
titleText: this.titleText,
messageText: this.messageText,
okText: this.okText,
cancelText: this.cancelText,
onConfirm: this.confirm,
onClose: this.close,
},
});
this.$el.append(this.dialogView.el);
return this;
},
async confirm() {
await this.groupConvo.leaveGroup();
this.close();
},
close() {
this.remove();
},
});
Whisper.UpdateGroupDialogView = Whisper.View.extend({
className: 'loki-dialog modal',
initialize(groupConvo) {

Loading…
Cancel
Save