From 4396fda0ff9e892c9efdd791e1634e5439c514e4 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 18 Jul 2019 16:58:57 +0200 Subject: [PATCH] Remember share settings when sharing a pad with a friend --- www/common/common-ui-elements.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index d23e25765..273a3d06d 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -342,7 +342,7 @@ define([ }); }; - var getFriendsList = function (config) { + var getFriendsList = function (config, onShare) { var common = config.common; var title = config.title; var friends = config.friends; @@ -453,6 +453,9 @@ define([ return smallCurves.indexOf(curve) !== -1; }); common.setAttribute(['general', 'share-friends'], order); + if (onShare) { + onShare.fire(); + } }); $nav.append(button); } @@ -529,8 +532,10 @@ define([ // Share link tab var hasFriends = Object.keys(config.friends || {}).length !== 0; - var friendsList = hasFriends ? getFriendsList(config) : undefined; + var onFriendShare = Util.mkEvent(); + var friendsList = hasFriends ? getFriendsList(config, onFriendShare) : undefined; var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; + var link = h('div.cp-share-modal' + friendsUIClass, [ h('div.cp-share-column', [ hasFriends ? h('p', Messages.share_description) : undefined, @@ -564,6 +569,7 @@ define([ present: present }); }; + onFriendShare.reg(saveValue); var getLinkValue = function (initValue) { var val = initValue || {}; var edit = initValue ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true'));