Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
cdb98ee27f
@ -134,54 +134,54 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
// if not archived, add handlers
|
// if not archived, add handlers
|
||||||
content.handler = function () {
|
|
||||||
var metadataMgr = common.getMetadataMgr();
|
|
||||||
var priv = metadataMgr.getPrivateData();
|
|
||||||
|
|
||||||
var link = h('a', {
|
|
||||||
href: '#'
|
|
||||||
}, Messages.requestEdit_viewPad);
|
|
||||||
var verified = h('p');
|
|
||||||
var $verified = $(verified);
|
|
||||||
|
|
||||||
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
|
|
||||||
var title = Util.fixHTML(msg.content.title);
|
|
||||||
|
|
||||||
if (priv.friends && priv.friends[msg.author]) {
|
|
||||||
$verified.addClass('cp-notifications-requestedit-verified');
|
|
||||||
var f = priv.friends[msg.author];
|
|
||||||
$verified.append(h('span.fa.fa-certificate'));
|
|
||||||
var $avatar = $(h('span.cp-avatar')).appendTo($verified);
|
|
||||||
$verified.append(h('p', Messages._getKey('requestEdit_fromFriend', [f.displayName])));
|
|
||||||
common.displayAvatar($avatar, f.avatar, f.displayName);
|
|
||||||
} else {
|
|
||||||
$verified.append(Messages._getKey('requestEdit_fromStranger', [name]));
|
|
||||||
}
|
|
||||||
|
|
||||||
var div = h('div', [
|
|
||||||
UI.setHTML(h('p'), Messages._getKey('requestEdit_confirm', [title, name])),
|
|
||||||
verified,
|
|
||||||
link
|
|
||||||
]);
|
|
||||||
$(link).click(function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
common.openURL(msg.content.href);
|
|
||||||
});
|
|
||||||
UI.confirm(div, function (yes) {
|
|
||||||
if (!yes) { return; }
|
|
||||||
common.getSframeChannel().event('EV_GIVE_ACCESS', {
|
|
||||||
channel: msg.content.channel,
|
|
||||||
user: msg.content.user
|
|
||||||
});
|
|
||||||
defaultDismiss(common, data)();
|
|
||||||
}, {
|
|
||||||
ok: Messages.friendRequest_accept,
|
|
||||||
cancel: Messages.later
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!content.archived) {
|
if (!content.archived) {
|
||||||
|
content.handler = function () {
|
||||||
|
var metadataMgr = common.getMetadataMgr();
|
||||||
|
var priv = metadataMgr.getPrivateData();
|
||||||
|
|
||||||
|
var link = h('a', {
|
||||||
|
href: '#'
|
||||||
|
}, Messages.requestEdit_viewPad);
|
||||||
|
var verified = h('p');
|
||||||
|
var $verified = $(verified);
|
||||||
|
|
||||||
|
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
|
||||||
|
var title = Util.fixHTML(msg.content.title);
|
||||||
|
|
||||||
|
if (priv.friends && priv.friends[msg.author]) {
|
||||||
|
$verified.addClass('cp-notifications-requestedit-verified');
|
||||||
|
var f = priv.friends[msg.author];
|
||||||
|
$verified.append(h('span.fa.fa-certificate'));
|
||||||
|
var $avatar = $(h('span.cp-avatar')).appendTo($verified);
|
||||||
|
$verified.append(h('p', Messages._getKey('requestEdit_fromFriend', [f.displayName])));
|
||||||
|
common.displayAvatar($avatar, f.avatar, f.displayName);
|
||||||
|
} else {
|
||||||
|
$verified.append(Messages._getKey('requestEdit_fromStranger', [name]));
|
||||||
|
}
|
||||||
|
|
||||||
|
var div = h('div', [
|
||||||
|
UI.setHTML(h('p'), Messages._getKey('requestEdit_confirm', [title, name])),
|
||||||
|
verified,
|
||||||
|
link
|
||||||
|
]);
|
||||||
|
$(link).click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
common.openURL(msg.content.href);
|
||||||
|
});
|
||||||
|
UI.confirm(div, function (yes) {
|
||||||
|
if (!yes) { return; }
|
||||||
|
common.getSframeChannel().event('EV_GIVE_ACCESS', {
|
||||||
|
channel: msg.content.channel,
|
||||||
|
user: msg.content.user
|
||||||
|
});
|
||||||
|
defaultDismiss(common, data)();
|
||||||
|
}, {
|
||||||
|
ok: Messages.friendRequest_accept,
|
||||||
|
cancel: Messages.later
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
content.dismissHandler = defaultDismiss(common, data);
|
content.dismissHandler = defaultDismiss(common, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -284,5 +284,6 @@ define([
|
|||||||
remove: function (common, data) {
|
remove: function (common, data) {
|
||||||
common.removeFriendRequest(data.hash);
|
common.removeFriendRequest(data.hash);
|
||||||
},
|
},
|
||||||
|
allowed: Object.keys(handlers)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -343,6 +343,7 @@ proxy.mailboxes = {
|
|||||||
try {
|
try {
|
||||||
var decrypted = box.encryptor.decrypt(_msg[4]);
|
var decrypted = box.encryptor.decrypt(_msg[4]);
|
||||||
message = JSON.parse(decrypted.content);
|
message = JSON.parse(decrypted.content);
|
||||||
|
message.author = decrypted.author;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,6 +105,8 @@
|
|||||||
p {
|
p {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 1rem 1rem;
|
margin: 1rem 1rem;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
.notification-time {
|
.notification-time {
|
||||||
margin: 1rem 1rem;
|
margin: 1rem 1rem;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ define([
|
|||||||
'/common/hyperscript.js',
|
'/common/hyperscript.js',
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
|
'/common/notifications.js',
|
||||||
|
|
||||||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
||||||
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||||
@ -21,7 +22,8 @@ define([
|
|||||||
SFCommon,
|
SFCommon,
|
||||||
h,
|
h,
|
||||||
Messages,
|
Messages,
|
||||||
UI
|
UI,
|
||||||
|
Notifications
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var APP = {};
|
var APP = {};
|
||||||
@ -44,7 +46,7 @@ define([
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
var notifsAllowedTypes = ["FRIEND_REQUEST", "FRIEND_REQUEST_ACCEPTED", "FRIEND_REQUEST_DECLINED", "SHARE_PAD", "REQUEST_PAD_ACCESS"];
|
var notifsAllowedTypes = Notifications.allowed;
|
||||||
|
|
||||||
var create = {};
|
var create = {};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user