Commit 3c107824 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Friend removal confirmation

parent 85080c7b
......@@ -41,6 +41,7 @@ $accept = get_string('accept');
$reject = get_string('reject');
$allviews = get_string('allviews');
$friendcontrolfailed = get_string('friendlistfailure');
$enc_confirm_remove = json_encode(get_string('confirmremovefriend'));
$inlinejs = <<<EOF
var friendslist = new TableRenderer(
......@@ -96,6 +97,12 @@ friendslist.updateOnLoad();
function friendControl(type, id, reason) {
var pd = {'id': id, 'control': 1};
if (type == 'remove' && !confirm({$enc_confirm_remove})) {
logDebug(type, id);
return false;
}
if (type == 'reject') {
type = 'accept';
pd['rejectsubmit'] = 'reject';
......@@ -106,12 +113,13 @@ function friendControl(type, id, reason) {
pd['type'] = type;
var d = loadJSONDoc('index.json.php', pd);
d.addCallbacks(function (data) {
$('messagediv').innerHTML = data.message;
},
function () {
$('messagediv').innerHTML = '{$friendcontrolfailed}';
}
d.addCallbacks(
function (data) {
$('messagediv').innerHTML = data.message;
},
function () {
$('messagediv').innerHTML = '{$friendcontrolfailed}';
}
);
friendslist.doupdate();
}
......
......@@ -495,6 +495,7 @@ $string['requestedfriendlistmessagereason'] = '%s has requested that you add the
. 'Their reason was: ';
$string['removefromfriendslist'] = 'Remove from friends';
$string['confirmremovefriend'] = 'Are you sure you want to remove this user from your friends list?';
$string['removedfromfriendslistsubject'] = 'Removed from friends list';
$string['removedfromfriendslistmessage'] = '%s has removed you from their friends list.';
$string['removedfromfriendslistmessagereason'] = '%s has removed you from their friends list. Their reason was: ';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment