Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
fa4b625f0d
7
rpc.js
7
rpc.js
@ -992,6 +992,9 @@ var owned_upload_complete = function (Env, safeKey, cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var oldPath = makeFilePath(Env.paths.staging, safeKey);
|
var oldPath = makeFilePath(Env.paths.staging, safeKey);
|
||||||
|
if (typeof(oldPath) !== 'string') {
|
||||||
|
return void cb('EINVAL_CONFIG');
|
||||||
|
}
|
||||||
|
|
||||||
// construct relevant paths
|
// construct relevant paths
|
||||||
var root = Env.paths.staging;
|
var root = Env.paths.staging;
|
||||||
@ -1054,6 +1057,9 @@ var owned_upload_complete = function (Env, safeKey, cb) {
|
|||||||
}));
|
}));
|
||||||
}).nThen(function (w) {
|
}).nThen(function (w) {
|
||||||
// move the existing file to its new path
|
// move the existing file to its new path
|
||||||
|
|
||||||
|
// flow is dumb and I need to guard against this which will never happen
|
||||||
|
/*:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } */
|
||||||
Fs.rename(oldPath /* XXX */, finalPath, w(function (e) {
|
Fs.rename(oldPath /* XXX */, finalPath, w(function (e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
w.abort();
|
w.abort();
|
||||||
@ -1217,7 +1223,6 @@ RPC.create = function (
|
|||||||
var pinPath = paths.pin = keyOrDefaultString('pinPath', './pins');
|
var pinPath = paths.pin = keyOrDefaultString('pinPath', './pins');
|
||||||
var blobPath = paths.blob = keyOrDefaultString('blobPath', './blob');
|
var blobPath = paths.blob = keyOrDefaultString('blobPath', './blob');
|
||||||
var blobStagingPath = paths.staging = keyOrDefaultString('blobStagingPath', './blobstage');
|
var blobStagingPath = paths.staging = keyOrDefaultString('blobStagingPath', './blobstage');
|
||||||
console.log(blobStagingPath);
|
|
||||||
|
|
||||||
var isUnauthenticateMessage = function (msg) {
|
var isUnauthenticateMessage = function (msg) {
|
||||||
return msg && msg.length === 2 && isUnauthenticatedCall(msg[0]);
|
return msg && msg.length === 2 && isUnauthenticatedCall(msg[0]);
|
||||||
|
|||||||
@ -241,7 +241,6 @@ define([
|
|||||||
type: 'radio',
|
type: 'radio',
|
||||||
name: 'cp-share-editable',
|
name: 'cp-share-editable',
|
||||||
value: 1,
|
value: 1,
|
||||||
checked: 'checked'
|
|
||||||
}),
|
}),
|
||||||
h('label', { 'for': 'cp-share-editable-true' }, Messages.share_linkEdit),
|
h('label', { 'for': 'cp-share-editable-true' }, Messages.share_linkEdit),
|
||||||
h('input#cp-share-editable-false.cp-share-editable-value', {
|
h('input#cp-share-editable-false.cp-share-editable-value', {
|
||||||
@ -271,12 +270,12 @@ define([
|
|||||||
]);
|
]);
|
||||||
if (!hashes.editHash) {
|
if (!hashes.editHash) {
|
||||||
$(link).find('#cp-share-editable-false').attr('checked', true);
|
$(link).find('#cp-share-editable-false').attr('checked', true);
|
||||||
$(link).find('#cp-share-editable-true').attr('disabled', true);
|
$(link).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true);
|
||||||
}
|
}
|
||||||
var saveValue = function () {
|
var saveValue = function () {
|
||||||
var edit = $(link).find('#cp-share-editable-true').is(':checked');
|
var edit = Util.isChecked($(link).find('#cp-share-editable-true'));
|
||||||
var embed = $(link).find('#cp-share-embed').is(':checked');
|
var embed = Util.isChecked($(link).find('#cp-share-embed'));
|
||||||
var present = $(link).find('#cp-share-present').is(':checked');
|
var present = Util.isChecked($(link).find('#cp-share-present'));
|
||||||
common.setAttribute(['general', 'share'], {
|
common.setAttribute(['general', 'share'], {
|
||||||
edit: edit,
|
edit: edit,
|
||||||
embed: embed,
|
embed: embed,
|
||||||
@ -285,9 +284,9 @@ define([
|
|||||||
};
|
};
|
||||||
var getLinkValue = function (initValue) {
|
var getLinkValue = function (initValue) {
|
||||||
var val = initValue || {};
|
var val = initValue || {};
|
||||||
var edit = initValue ? val.edit : $(link).find('#cp-share-editable-true').is(':checked');
|
var edit = initValue ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true'));
|
||||||
var embed = initValue ? val.embed : $(link).find('#cp-share-embed').is(':checked');
|
var embed = initValue ? val.embed : Util.isChecked($(link).find('#cp-share-embed'));
|
||||||
var present = initValue ? val.present : $(link).find('#cp-share-present').is(':checked');
|
var present = initValue ? val.present : Util.isChecked($(link).find('#cp-share-present'));
|
||||||
|
|
||||||
var hash = (edit && hashes.editHash) ? hashes.editHash : hashes.viewHash;
|
var hash = (edit && hashes.editHash) ? hashes.editHash : hashes.viewHash;
|
||||||
var href = origin + pathname + '#' + hash;
|
var href = origin + pathname + '#' + hash;
|
||||||
@ -372,10 +371,11 @@ define([
|
|||||||
common.getAttribute(['general', 'share'], function (err, val) {
|
common.getAttribute(['general', 'share'], function (err, val) {
|
||||||
val = val || {};
|
val = val || {};
|
||||||
if (val.edit === false) {
|
if (val.edit === false) {
|
||||||
$(link).find('#cp-share-editable-false').attr('checked', true);
|
$(link).find('#cp-share-editable-false').prop('checked', true);
|
||||||
}
|
}
|
||||||
if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); }
|
else { $(link).find('#cp-share-editable-true').prop('checked', true); }
|
||||||
if (val.present) { $(link).find('#cp-share-present').attr('checked', true); }
|
if (val.embed) { $(link).find('#cp-share-embed').prop('checked', true); }
|
||||||
|
if (val.present) { $(link).find('#cp-share-present').prop('checked', true); }
|
||||||
$(link).find('#cp-share-link-preview').val(getLinkValue(val));
|
$(link).find('#cp-share-link-preview').val(getLinkValue(val));
|
||||||
});
|
});
|
||||||
common.getMetadataMgr().onChange(function () {
|
common.getMetadataMgr().onChange(function () {
|
||||||
@ -1681,7 +1681,7 @@ define([
|
|||||||
$element.attr('data-type', p);
|
$element.attr('data-type', p);
|
||||||
$element.click(function () {
|
$element.click(function () {
|
||||||
$modal.hide();
|
$modal.hide();
|
||||||
if ($advanced && $advanced.is(':checked')) {
|
if ($advanced && Util.isChecked($advanced)) {
|
||||||
common.sessionStorage.put(Constants.displayPadCreationScreen, true, function (){
|
common.sessionStorage.put(Constants.displayPadCreationScreen, true, function (){
|
||||||
common.openURL('/' + p + '/');
|
common.openURL('/' + p + '/');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -246,6 +246,21 @@ define([], function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Util.isChecked = function (el) {
|
||||||
|
// could be nothing...
|
||||||
|
if (!el) { return false; }
|
||||||
|
// check if it's a dom element
|
||||||
|
if (typeof(el.tagName) !== 'undefined') {
|
||||||
|
return Boolean(el.checked);
|
||||||
|
}
|
||||||
|
// sketchy test to see if it's jquery
|
||||||
|
if (typeof(el.prop) === 'function') {
|
||||||
|
return Boolean(el.prop('checked'));
|
||||||
|
}
|
||||||
|
// else just say it's not checked
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
return Util;
|
return Util;
|
||||||
});
|
});
|
||||||
}(self));
|
}(self));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user