diff --git a/scripts/langindex.json b/scripts/langindex.json index 5ca395007..bf86af502 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -132,9 +132,9 @@ "addon.files.sitefiles": "moodle", "addon.messageoutput_airnotifier.processorsettingsdesc": "local_moodlemobileapp", "addon.messages.addcontact": "message", - "addon.messages.blockcontact": "message", - "addon.messages.blockcontactconfirm": "local_moodlemobileapp", "addon.messages.blocknoncontacts": "message", + "addon.messages.blockuser": "message", + "addon.messages.blockuserconfirm": "message", "addon.messages.contactableprivacy": "message", "addon.messages.contactableprivacy_coursemember": "message", "addon.messages.contactableprivacy_onlycontacts": "message", @@ -163,7 +163,8 @@ "addon.messages.type_online": "local_moodlemobileapp", "addon.messages.type_search": "local_moodlemobileapp", "addon.messages.type_strangers": "local_moodlemobileapp", - "addon.messages.unblockcontact": "message", + "addon.messages.unblockuser": "message", + "addon.messages.unblockuserconfirm": "message", "addon.messages.warningmessagenotsent": "local_moodlemobileapp", "addon.mod_assign.acceptsubmissionstatement": "local_moodlemobileapp", "addon.mod_assign.addattempt": "assign", diff --git a/src/addon/messages/lang/en.json b/src/addon/messages/lang/en.json index c89f8ccf8..0edcae15a 100644 --- a/src/addon/messages/lang/en.json +++ b/src/addon/messages/lang/en.json @@ -1,8 +1,8 @@ { "addcontact": "Add contact", - "blockcontact": "Block contact", - "blockcontactconfirm": "You will no longer receive messages from this contact.", "blocknoncontacts": "Prevent non-contacts from messaging me", + "blockuser": "Block user", + "blockuserconfirm": "Are you sure you want to block {{$a}}?", "contactableprivacy": "Accept messages from:", "contactableprivacy_coursemember": "My contacts and anyone in my courses", "contactableprivacy_onlycontacts": "My contacts only", @@ -31,6 +31,7 @@ "type_online": "Online", "type_search": "Search results", "type_strangers": "Others", - "unblockcontact": "Unblock contact", + "unblockuser": "Unblock user", + "unblockuserconfirm": "Are you sure you want to unblock {{$a}}?", "warningmessagenotsent": "Couldn't send message(s) to user {{user}}. {{error}}" } \ No newline at end of file diff --git a/src/addon/messages/providers/user-block-contact-handler.ts b/src/addon/messages/providers/user-block-contact-handler.ts index bc63f6f30..0b325420c 100644 --- a/src/addon/messages/providers/user-block-contact-handler.ts +++ b/src/addon/messages/providers/user-block-contact-handler.ts @@ -96,12 +96,17 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand this.messagesProvider.isBlocked(user.id).then((isBlocked) => { if (isBlocked) { - return this.messagesProvider.unblockContact(user.id); - } else { - const template = this.translate.instant('addon.messages.blockcontactconfirm'), - title = this.translate.instant('addon.messages.blockcontact'); + const template = this.translate.instant('addon.messages.unblockuserconfirm', {$a: user.fullname}); + const okText = this.translate.instant('addon.messages.unblockuser'); - return this.domUtils.showConfirm(template, title, title).then(() => { + return this.domUtils.showConfirm(template, undefined, okText).then(() => { + return this.messagesProvider.unblockContact(user.id); + }); + } else { + const template = this.translate.instant('addon.messages.blockuserconfirm', {$a: user.fullname}); + const okText = this.translate.instant('addon.messages.blockuser'); + + return this.domUtils.showConfirm(template, undefined, okText).then(() => { return this.messagesProvider.blockContact(user.id); }); } @@ -129,7 +134,7 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand return this.messagesProvider.isBlocked(userId).then((isBlocked) => { if (isBlocked) { this.updateButton(userId, { - title: 'addon.messages.unblockcontact', + title: 'addon.messages.unblockuser', class: 'addon-messages-unblockcontact-handler', icon: 'checkmark-circle', hidden: false, @@ -137,7 +142,7 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand }); } else { this.updateButton(userId, { - title: 'addon.messages.blockcontact', + title: 'addon.messages.blockuser', class: 'addon-messages-blockcontact-handler', icon: 'close-circle', hidden: false, diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index cc1fa5926..f2a4f0631 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -132,9 +132,9 @@ "addon.files.sitefiles": "Site files", "addon.messageoutput_airnotifier.processorsettingsdesc": "Configure devices", "addon.messages.addcontact": "Add contact", - "addon.messages.blockcontact": "Block contact", - "addon.messages.blockcontactconfirm": "You will no longer receive messages from this contact.", "addon.messages.blocknoncontacts": "Prevent non-contacts from messaging me", + "addon.messages.blockuser": "Block user", + "addon.messages.blockuserconfirm": "Are you sure you want to block {{$a}}?", "addon.messages.contactableprivacy": "Accept messages from:", "addon.messages.contactableprivacy_coursemember": "My contacts and anyone in my courses", "addon.messages.contactableprivacy_onlycontacts": "My contacts only", @@ -163,7 +163,8 @@ "addon.messages.type_online": "Online", "addon.messages.type_search": "Search results", "addon.messages.type_strangers": "Others", - "addon.messages.unblockcontact": "Unblock contact", + "addon.messages.unblockuser": "Unblock user", + "addon.messages.unblockuserconfirm": "Are you sure you want to unblock {{$a}}?", "addon.messages.warningmessagenotsent": "Couldn't send message(s) to user {{user}}. {{error}}", "addon.mod_assign.acceptsubmissionstatement": "Please accept the submission statement.", "addon.mod_assign.addattempt": "Allow another attempt",