Fix pinning issue causing unnecessary reset

This commit is contained in:
yflory 2019-10-22 11:21:41 +02:00
parent efded1063f
commit c894351a30
3 changed files with 19 additions and 2 deletions

View File

@ -996,8 +996,10 @@ define([
} }
})); }));
if (!isSharedFolder) { if (!isSharedFolder) {
common.unpinPads([oldChannel], waitFor(), teamId); postMessage("CHANGE_PAD_PASSWORD_PIN", {
common.pinPads([newSecret.channel], waitFor(), teamId); oldChannel: oldChannel,
channel: newSecret.channel
}, waitFor());
} }
}).nThen(function () { }).nThen(function () {
cb({ cb({

View File

@ -1547,6 +1547,20 @@ define([
channel.sendMessage(msg, clientId, cb); 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 // 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 // of the pad AND to send the request if we want
// data.send === false ==> check if we can contact them // data.send === false ==> check if we can contact them

View File

@ -79,6 +79,7 @@ define([
GIVE_PAD_ACCESS: Store.givePadAccess, GIVE_PAD_ACCESS: Store.givePadAccess,
GET_PAD_METADATA: Store.getPadMetadata, GET_PAD_METADATA: Store.getPadMetadata,
SET_PAD_METADATA: Store.setPadMetadata, SET_PAD_METADATA: Store.setPadMetadata,
CHANGE_PAD_PASSWORD_PIN: Store.changePadPasswordPin,
// Drive // Drive
DRIVE_USEROBJECT: Store.userObjectCommand, DRIVE_USEROBJECT: Store.userObjectCommand,
// Settings, // Settings,