Decline a friend request
This commit is contained in:
parent
67e39253cf
commit
06a07d069e
@ -30,7 +30,15 @@ define([
|
||||
var content = data.content;
|
||||
var msg = content.msg;
|
||||
$(el).find('.cp-notification-content p')
|
||||
.html('Friend request accepted: <b>'+msg.content.displayName+'</b>');
|
||||
.html(Messages._getKey('friendRequest_accepted', [msg.content.displayName])
|
||||
$(el).find('.cp-notification-dismiss').css('display', 'flex');
|
||||
};
|
||||
|
||||
handlers['DECLINE_FRIEND_REQUEST'] = function (common, data, el) {
|
||||
var content = data.content;
|
||||
var msg = content.msg;
|
||||
$(el).find('.cp-notification-content p')
|
||||
.html(Messages._getKey('friendRequest_declined', [msg.content.displayName])
|
||||
$(el).find('.cp-notification-dismiss').css('display', 'flex');
|
||||
};
|
||||
|
||||
|
||||
@ -945,6 +945,12 @@ define([
|
||||
return;
|
||||
}
|
||||
// Otherwise, just remove the notification
|
||||
store.mailbox.sendTo('DECLINE_FRIEND_REQUEST', {}, {
|
||||
channel: msg.content.notifications,
|
||||
curvePublic: msg.content.curvePublic
|
||||
}, function (obj) {
|
||||
cb(obj);
|
||||
});
|
||||
dismiss();
|
||||
};
|
||||
Store.sendFriendRequest = function (clientId, data, cb) {
|
||||
|
||||
@ -15,6 +15,13 @@ define([
|
||||
}
|
||||
cb();
|
||||
};
|
||||
handlers['DECLINE_FRIEND_REQUEST'] = function (ctx, box, data, cb) {
|
||||
// Our friend request was declined.
|
||||
if (!ctx.store.proxy.friends_pending[data.msg.author]) { return void cb(true); }
|
||||
delete ctx.store.proxy.friends_pending[data.msg.author];
|
||||
ctx.updateMetadata();
|
||||
cb();
|
||||
};
|
||||
handlers['ACCEPT_FRIEND_REQUEST'] = function (ctx, box, data, cb) {
|
||||
// Our friend request was accepted.
|
||||
// Make sure we really sent it
|
||||
|
||||
@ -8,7 +8,6 @@ define([
|
||||
'/customize/messages.js'
|
||||
], function ($, Util, UI, UIElements, Notifications, h, Messages) {
|
||||
var Mailbox = {};
|
||||
Messages = Messages; // XXX
|
||||
|
||||
Mailbox.create = function (Common) {
|
||||
var mailbox = Common.mailbox;
|
||||
|
||||
@ -959,7 +959,7 @@ MessengerUI, Messages) {
|
||||
};
|
||||
var $newPadBlock = UIElements.createDropdown(dropdownConfig);
|
||||
var $button = $newPadBlock.find('button');
|
||||
$button.attr('title', Messages.notifications_title);
|
||||
$button.attr('title', Messages.notifications_empty);
|
||||
$button.addClass('fa fa-bell-o');
|
||||
var $n = $button.find('.cp-dropdown-button-title').hide();
|
||||
var $empty = $(div).find('.cp-notifications-empty');
|
||||
@ -970,10 +970,12 @@ MessengerUI, Messages) {
|
||||
$button.removeClass('fa-bell-o').removeClass('fa-bell');
|
||||
$n.removeClass('cp-notifications-small');
|
||||
if (n === 0) {
|
||||
$button.attr('title', Messages.notifications_empty);
|
||||
$empty.show();
|
||||
$n.hide();
|
||||
return void $button.addClass('fa-bell-o');
|
||||
}
|
||||
$button.attr('title', Messages.notifications_title);
|
||||
if (n > 99) {
|
||||
n = '99+';
|
||||
$n.addClass('cp-notifications-small');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user