Disable 'forget' button for pads in read-only teams
This commit is contained in:
@@ -1528,8 +1528,12 @@ define([
|
|||||||
}
|
}
|
||||||
UI.confirm(msg, function (yes) {
|
UI.confirm(msg, function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
sframeChan.query('Q_MOVE_TO_TRASH', null, function (err) {
|
sframeChan.query('Q_MOVE_TO_TRASH', null, function (err, obj) {
|
||||||
if (err) { return void callback(err); }
|
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 cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted;
|
||||||
var msg = common.fixLinks($('<div>').html(cMsg));
|
var msg = common.fixLinks($('<div>').html(cMsg));
|
||||||
UI.alert(msg);
|
UI.alert(msg);
|
||||||
|
|||||||
@@ -986,17 +986,23 @@ define([
|
|||||||
};
|
};
|
||||||
Store.moveToTrash = function (clientId, data, cb) {
|
Store.moveToTrash = function (clientId, data, cb) {
|
||||||
var href = Hash.getRelativeHref(data.href);
|
var href = Hash.getRelativeHref(data.href);
|
||||||
|
var allErrors = true;
|
||||||
nThen(function (waitFor) {
|
nThen(function (waitFor) {
|
||||||
getAllStores().forEach(function (s) {
|
getAllStores().forEach(function (s) {
|
||||||
var deleted = s.userObject.forget(href);
|
var deleted = s.userObject.forget(href);
|
||||||
if (!deleted) { return; }
|
if (!deleted) { return; }
|
||||||
|
allErrors = false;
|
||||||
var send = s.id ? s.sendEvent : sendDriveEvent;
|
var send = s.id ? s.sendEvent : sendDriveEvent;
|
||||||
send('DRIVE_CHANGE', {
|
send('DRIVE_CHANGE', {
|
||||||
path: ['drive', UserObject.FILES_DATA]
|
path: ['drive', UserObject.FILES_DATA]
|
||||||
}, clientId);
|
}, clientId);
|
||||||
onSync(s.id, waitFor());
|
onSync(s.id, waitFor());
|
||||||
});
|
});
|
||||||
}).nThen(cb);
|
}).nThen(function () {
|
||||||
|
cb({
|
||||||
|
error: allErrors ? 'FORBIDDEN' : undefined
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
Store.setPadTitle = function (clientId, data, cb) {
|
Store.setPadTitle = function (clientId, data, cb) {
|
||||||
var title = data.title;
|
var title = data.title;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ define([
|
|||||||
var data = Env.user.proxy[UserObject.SHARED_FOLDERS][id];
|
var data = Env.user.proxy[UserObject.SHARED_FOLDERS][id];
|
||||||
if (data && !editable) { data = JSON.parse(JSON.stringify(data)); }
|
if (data && !editable) { data = JSON.parse(JSON.stringify(data)); }
|
||||||
// If it's not a shared folder, check the pads
|
// 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({
|
ret.push({
|
||||||
data: data,
|
data: data,
|
||||||
userObject: Env.user.userObject
|
userObject: Env.user.userObject
|
||||||
|
|||||||
Reference in New Issue
Block a user