Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
ansuz
2017-04-27 12:47:27 +02:00
4 changed files with 62 additions and 59 deletions

View File

@@ -496,6 +496,18 @@ define([
}
};
var updateFileName = function (href, oldName, newName) {
var fo = getStore().getProxy().fo;
var paths = fo.findFileInRoot(href);
paths.forEach(function (path) {
if (path.length !== 2) { return; }
var name = path[1].split('_')[0];
var parsed = parsePadUrl(href);
if (path.length === 2 && name === oldName && isDefaultName(parsed, name)) {
fo.rename(path, newName);
}
});
};
var setPadTitle = common.setPadTitle = function (name, cb) {
var href = window.location.href;
var parsed = parsePadUrl(href);
@@ -541,6 +553,7 @@ define([
pad.atime = +new Date();
// set the name
var old = pad.title;
pad.title = name;
// If we now have a stronger version of a stored href, replace the weaker one by the strong one
@@ -551,6 +564,7 @@ define([
});
}
pad.href = href;
updateFileName(href, old, name);
}
return pad;
});
@@ -558,7 +572,7 @@ define([
if (!contains) {
var data = makePad(href, name);
getStore().pushData(data);
getStore().addPad(href, common.initialPath, common.initialName || name);
getStore().addPad(data, common.initialPath);
}
if (updateWeaker.length > 0) {
updateWeaker.forEach(function (obj) {