diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 5d65e92b6..f0def2f9c 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -996,8 +996,10 @@ define([ } })); if (!isSharedFolder) { - common.unpinPads([oldChannel], waitFor(), teamId); - common.pinPads([newSecret.channel], waitFor(), teamId); + postMessage("CHANGE_PAD_PASSWORD_PIN", { + oldChannel: oldChannel, + channel: newSecret.channel + }, waitFor()); } }).nThen(function () { cb({ diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index cf382caff..1e419548a 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1547,6 +1547,20 @@ define([ channel.sendMessage(msg, clientId, cb); }; + // Unpin and pin the new channel in all team when changing a pad password + Store.changePadPasswordPin = function (clientId, data, cb) { + var oldChannel = data.oldChannel; + var channel = data.channel; + nThen(function (waitFor) { + getAllStores().forEach(function (s) { + var allData = s.manager.findChannel(channel); + if (!allData.length) { return; } + s.rpc.unpin([oldChannel], waitFor()); + s.rpc.pin([channel], waitFor()); + }); + }).nThen(cb); + }; + // requestPadAccess is used to check if we have a way to contact the owner // of the pad AND to send the request if we want // data.send === false ==> check if we can contact them diff --git a/www/common/outer/store-rpc.js b/www/common/outer/store-rpc.js index 9accc5f29..2ef490876 100644 --- a/www/common/outer/store-rpc.js +++ b/www/common/outer/store-rpc.js @@ -79,6 +79,7 @@ define([ GIVE_PAD_ACCESS: Store.givePadAccess, GET_PAD_METADATA: Store.getPadMetadata, SET_PAD_METADATA: Store.setPadMetadata, + CHANGE_PAD_PASSWORD_PIN: Store.changePadPasswordPin, // Drive DRIVE_USEROBJECT: Store.userObjectCommand, // Settings,