Disable 'forget' button for pads in read-only teams

pull/1/head
yflory 5 years ago
parent 57a402da72
commit 96968f2076

@ -1528,8 +1528,12 @@ define([
}
UI.confirm(msg, function (yes) {
if (!yes) { return; }
sframeChan.query('Q_MOVE_TO_TRASH', null, function (err) {
if (err) { return void callback(err); }
sframeChan.query('Q_MOVE_TO_TRASH', null, function (err, obj) {
err = err || (obj && obj.error);
if (err) {
callback(err);
return void UI.warn(Messages.fm_forbidden);
}
var cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted;
var msg = common.fixLinks($('<div>').html(cMsg));
UI.alert(msg);

@ -986,17 +986,23 @@ define([
};
Store.moveToTrash = function (clientId, data, cb) {
var href = Hash.getRelativeHref(data.href);
var allErrors = true;
nThen(function (waitFor) {
getAllStores().forEach(function (s) {
var deleted = s.userObject.forget(href);
if (!deleted) { return; }
allErrors = false;
var send = s.id ? s.sendEvent : sendDriveEvent;
send('DRIVE_CHANGE', {
path: ['drive', UserObject.FILES_DATA]
}, clientId);
onSync(s.id, waitFor());
});
}).nThen(cb);
}).nThen(function () {
cb({
error: allErrors ? 'FORBIDDEN' : undefined
});
});
};
Store.setPadTitle = function (clientId, data, cb) {
var title = data.title;

@ -124,7 +124,7 @@ define([
var data = Env.user.proxy[UserObject.SHARED_FOLDERS][id];
if (data && !editable) { data = JSON.parse(JSON.stringify(data)); }
// If it's not a shared folder, check the pads
if (!data) { Env.user.userObject.getFileData(id, editable); }
if (!data) { data = Env.user.userObject.getFileData(id, editable); }
ret.push({
data: data,
userObject: Env.user.userObject

Loading…
Cancel
Save