MOBILE-3320 messages: Fix no error displayed when blocking some users

main
Dani Palou 2021-06-04 09:29:53 +02:00
parent 530ac1a109
commit 51e172cd23
3 changed files with 8 additions and 0 deletions

View File

@ -237,6 +237,7 @@
"addon.messages.blocknoncontacts": "message",
"addon.messages.blockuser": "message",
"addon.messages.blockuserconfirm": "message",
"addon.messages.cantblockuser": "message",
"addon.messages.contactableprivacy": "message",
"addon.messages.contactableprivacy_coursemember": "message",
"addon.messages.contactableprivacy_onlycontacts": "message",

View File

@ -7,6 +7,7 @@
"blocknoncontacts": "Prevent non-contacts from messaging me",
"blockuser": "Block user",
"blockuserconfirm": "Are you sure you want to block {{$a}}?",
"cantblockuser": "You can't block {{$a}} because they have a role with permission to message all users.",
"contactableprivacy": "Accept messages from:",
"contactableprivacy_coursemember": "My contacts and anyone in my courses",
"contactableprivacy_onlycontacts": "My contacts only",

View File

@ -1446,6 +1446,12 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
throw new CoreError('No member selected to be blocked.');
}
if (this.otherMember.canmessageevenifblocked) {
CoreDomUtils.showErrorModal(Translate.instant('addon.messages.cantblockuser', { $a: this.otherMember.fullname }));
return;
}
const template = Translate.instant('addon.messages.blockuserconfirm', { $a: this.otherMember.fullname });
const okText = Translate.instant('addon.messages.blockuser');