Unpin old versions

pull/1/head
yflory 7 years ago
parent c4a3e98123
commit d12e5da1b7

@ -131,8 +131,6 @@ define([
noStore: true,
body: $('body'),
onUploaded: function (ev, data) {
console.log('uploaded');
console.log(data);
if (!data || !data.url) { return; }
common.getSframeChannel().query('Q_OO_SAVE', data, function (err) {
if (err) {

@ -42,6 +42,12 @@ define([
var addRpc = function (sframeChan, Cryptpad, Utils) {
sframeChan.on('Q_OO_SAVE', function (data, cb) {
var chanId = Utils.Hash.hrefToHexChannelId(data.url);
Cryptpad.getPadAttribute('lastVersion', function (err, data) {
if (data) {
var oldChanId = Utils.Hash.hrefToHexChannelId(data);
if (oldChanId !== chanId) { Cryptpad.unpinPads([oldChanId], function () {}); }
}
});
Cryptpad.pinPads([chanId], function (e) {
if (e) { return void cb(e); }
Cryptpad.setPadAttribute('lastVersion', data.url, cb);

@ -115,7 +115,9 @@ define([
window.open(origin + $link.attr('href'), '_blank');
});
var title = metadata.name;
UI.log(Messages._getKey('upload_success', [title]));
if (!config.noStore) {
UI.log(Messages._getKey('upload_success', [title]));
}
common.prepareFeedback('upload')();
if (config.onUploaded) {

Loading…
Cancel
Save