MOBILE-2620 messages: New interface for blocking/unblocking users

main
Albert Gasset 2018-11-12 12:07:32 +01:00
parent 70dd9302ec
commit 067d674ac6
4 changed files with 24 additions and 16 deletions

View File

@ -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",

View File

@ -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}}"
}

View File

@ -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,

View File

@ -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",