Add edPublic to user profiles
This commit is contained in:
parent
a4d1b47a4c
commit
9aaddea148
@ -54,6 +54,9 @@ define([
|
|||||||
if (!lm.proxy.notifications) {
|
if (!lm.proxy.notifications) {
|
||||||
lm.proxy.notifications = Util.find(ctx.store.proxy, ['mailboxes', 'notifications', 'channel']);
|
lm.proxy.notifications = Util.find(ctx.store.proxy, ['mailboxes', 'notifications', 'channel']);
|
||||||
}
|
}
|
||||||
|
if (!lm.proxy.edPublic) {
|
||||||
|
lm.proxy.edPublic = ctx.store.proxy.edPublic;
|
||||||
|
}
|
||||||
if (ctx.onReadyHandlers.length) {
|
if (ctx.onReadyHandlers.length) {
|
||||||
ctx.onReadyHandlers.forEach(function (f) {
|
ctx.onReadyHandlers.forEach(function (f) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -457,6 +457,34 @@ define([
|
|||||||
APP.editor.save();
|
APP.editor.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Messages.profile_copyKey = "Copy edPublic key"; // XXX
|
||||||
|
var addPublicKey = function ($container) {
|
||||||
|
if (!APP.readOnly) { return; }
|
||||||
|
|
||||||
|
var $div = $(h('div.cp-sidebarlayout-element')).appendTo($container);
|
||||||
|
APP.$edPublic = $('<button>', {
|
||||||
|
'class': 'btn btn-success',
|
||||||
|
}).append(h('i.fa.fa-key'))
|
||||||
|
.append(h('span', Messages.profile_copyKey))
|
||||||
|
.click(function () {
|
||||||
|
if (!APP.getEdPublic) { return; }
|
||||||
|
APP.getEdPublic();
|
||||||
|
}).appendTo($div).hide();
|
||||||
|
};
|
||||||
|
var setPublicKeyButton = function (data) {
|
||||||
|
if (!data.edPublic || APP.getEdPublic || !APP.readOnly) { return; }
|
||||||
|
APP.$edPublic.show();
|
||||||
|
APP.getEdPublic = function () {
|
||||||
|
var metadataMgr = APP.common.getMetadataMgr();
|
||||||
|
var privateData = metadataMgr.getPrivateData();
|
||||||
|
var name = data.name.toLowerCase().replace(/[^a-zA-Z0-9]+/g, "-");
|
||||||
|
var ed = data.edPublic.replace(/\//g, '-');
|
||||||
|
var url = privateData.origin + '/user/#/1/' + name + '/' + ed;
|
||||||
|
var success = Clipboard.copy(url);
|
||||||
|
if (success) { UI.log(Messages.shareSuccess); }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
var createLeftside = function () {
|
var createLeftside = function () {
|
||||||
var $categories = $('<div>', {'class': 'cp-sidebarlayout-categories'}).appendTo(APP.$leftside);
|
var $categories = $('<div>', {'class': 'cp-sidebarlayout-categories'}).appendTo(APP.$leftside);
|
||||||
var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories);
|
var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories);
|
||||||
@ -477,6 +505,7 @@ define([
|
|||||||
addFriendRequest($rightside);
|
addFriendRequest($rightside);
|
||||||
addMuteButton($rightside);
|
addMuteButton($rightside);
|
||||||
addDescription(APP.$rightside);
|
addDescription(APP.$rightside);
|
||||||
|
addPublicKey(APP.$rightside);
|
||||||
addViewButton($rightside);
|
addViewButton($rightside);
|
||||||
APP.initialized = true;
|
APP.initialized = true;
|
||||||
createLeftside();
|
createLeftside();
|
||||||
@ -490,6 +519,7 @@ define([
|
|||||||
refreshDescription(data);
|
refreshDescription(data);
|
||||||
refreshFriendRequest(data);
|
refreshFriendRequest(data);
|
||||||
refreshMute(data);
|
refreshMute(data);
|
||||||
|
setPublicKeyButton(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
var createToolbar = function () {
|
var createToolbar = function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user