From 6c94605b9b8abbe6ab09b9650a6fdbcad2e9453d Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 28 Jun 2017 10:59:29 +0200 Subject: [PATCH] File upload in the profile --- www/common/common-file.js | 14 ++++++++------ www/common/cryptpad-common.js | 9 +++++++++ www/common/fsStore.js | 4 ++++ www/profile/main.js | 18 ++++++++++++++++-- www/profile/main.less | 2 +- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/www/common/common-file.js b/www/common/common-file.js index ad56bae49..92456a4a1 100644 --- a/www/common/common-file.js +++ b/www/common/common-file.js @@ -114,14 +114,9 @@ define([ window.open($link.attr('href'), '_blank'); }); - // TODO add button to table which copies link to clipboard? - //APP.toolbar.addElement(['fileshare'], {}); - var title = metadata.name; - common.renamePad(title || "", href, function (err) { - if (err) { return void console.error(err); } // TODO - console.log(title); + var onComplete = function () { common.log(Messages._getKey('upload_success', [title])); common.prepareFeedback('upload')(); @@ -132,6 +127,13 @@ define([ queue.inProgress = false; queue.next(); + }; + + if (config.noStore) { return void onComplete(); } + + common.renamePad(title || "", href, function (err) { + if (err) { return void console.error(err); } // TODO + onComplete(); }); //Title.updateTitle(title || "", href); //APP.toolbar.title.show(); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index e04a47916..d1c830d3d 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -689,6 +689,15 @@ define([ }) .filter(function (x) { return x; }); + // Get the avatar + var profile = store.getProfile(); + if (profile) { + var profileChan = profile.edit ? hrefToHexChannelId('/profile/#' + profile.edit) : null; + if (profileChan) { list.push(profileChan); } + var avatarChan = profile.avatar ? hrefToHexChannelId(profile.avatar) : null; + if (avatarChan) { list.push(avatarChan); } + } + list.push(common.base64ToHex(userChannel)); list.sort(); diff --git a/www/common/fsStore.js b/www/common/fsStore.js index 855d8b4f5..05503beb8 100644 --- a/www/common/fsStore.js +++ b/www/common/fsStore.js @@ -128,6 +128,10 @@ define([ ret.change = function () {}; + ret.getProfile = function () { + return storeObj.profile; + }; + return ret; }; diff --git a/www/profile/main.js b/www/profile/main.js index c1ce4c6f5..f170d1bc2 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -204,6 +204,7 @@ define([ var $block = $('
', {id: AVATAR_ID}).appendTo($container); var $span = $('').appendTo($block); if (APP.lm.proxy.avatar) { + //var file = APP.lm.proxy.avatar; var $img = $('').appendTo($span); $img.attr('src', '/blob/45/45170bcd64aae1726b0b0e06c4360181a08bad9596640863'); $img.attr('data-crypto-key', 'cryptpad:5vs/ciPzSAyHeP6XRwxpFZt/cjkRC+EE2CRw+/xfcVI='); @@ -219,8 +220,21 @@ define([ }); } if (APP.readOnly) { return; } - var $button = $('