mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-56398 core_message: make modals consistent across themes
This commit is contained in:
parent
0b8e0c374f
commit
27a5b91f45
File diff suppressed because one or more lines are too long
@ -434,36 +434,42 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
|
||||
Messages.prototype._deleteAllMessages = function() {
|
||||
// Create the confirmation modal if we haven't already.
|
||||
if (!this._confirmationModal) {
|
||||
ModalFactory.create({
|
||||
type: ModalFactory.types.CONFIRM,
|
||||
body: Str.get_string('deleteallconfirm', 'message'),
|
||||
}, this.messageArea.find(SELECTORS.DELETEALLMESSAGES))
|
||||
.done(function(modal) {
|
||||
this._confirmationModal = modal;
|
||||
Str.get_strings([
|
||||
{key: 'confirm'},
|
||||
{key: 'deleteallconfirm', component: 'message'}
|
||||
]).done(function(s) {
|
||||
ModalFactory.create({
|
||||
title: s[0],
|
||||
type: ModalFactory.types.CONFIRM,
|
||||
body: s[1]
|
||||
}, this.messageArea.find(SELECTORS.DELETEALLMESSAGES))
|
||||
.done(function(modal) {
|
||||
this._confirmationModal = modal;
|
||||
|
||||
// Only delete the conversation if the user agreed in the confirmation modal.
|
||||
modal.getRoot().on(ModalEvents.yes, function() {
|
||||
var otherUserId = this._getUserId();
|
||||
var request = {
|
||||
methodname: 'core_message_delete_conversation',
|
||||
args: {
|
||||
userid: this.messageArea.getCurrentUserId(),
|
||||
otheruserid: otherUserId
|
||||
}
|
||||
};
|
||||
// Only delete the conversation if the user agreed in the confirmation modal.
|
||||
modal.getRoot().on(ModalEvents.yes, function() {
|
||||
var otherUserId = this._getUserId();
|
||||
var request = {
|
||||
methodname: 'core_message_delete_conversation',
|
||||
args: {
|
||||
userid: this.messageArea.getCurrentUserId(),
|
||||
otheruserid: otherUserId
|
||||
}
|
||||
};
|
||||
|
||||
// Delete the conversation.
|
||||
Ajax.call([request])[0].then(function() {
|
||||
// Clear the message area.
|
||||
this.messageArea.find(SELECTORS.MESSAGESAREA).empty();
|
||||
// Let the app know a conversation was deleted.
|
||||
this.messageArea.trigger(Events.CONVERSATIONDELETED, otherUserId);
|
||||
this._hideDeleteAction();
|
||||
}.bind(this), Notification.exeption);
|
||||
}.bind(this));
|
||||
// Delete the conversation.
|
||||
Ajax.call([request])[0].then(function() {
|
||||
// Clear the message area.
|
||||
this.messageArea.find(SELECTORS.MESSAGESAREA).empty();
|
||||
// Let the app know a conversation was deleted.
|
||||
this.messageArea.trigger(Events.CONVERSATIONDELETED, otherUserId);
|
||||
this._hideDeleteAction();
|
||||
}.bind(this), Notification.exception);
|
||||
}.bind(this));
|
||||
|
||||
// Display the confirmation.
|
||||
modal.show();
|
||||
// Display the confirmation.
|
||||
modal.show();
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
} else {
|
||||
// Otherwise just show the existing modal.
|
||||
|
Loading…
x
Reference in New Issue
Block a user