mirror of https://github.com/xwiki-labs/cryptpad
Fix 'delete all' button in forms owned by a team
This commit is contained in:
parent
f01e21eac7
commit
d5fefb5946
|
@ -571,8 +571,8 @@ define([
|
|||
}, todo);
|
||||
};
|
||||
|
||||
common.clearOwnedChannel = function (channel, cb) {
|
||||
postMessage("CLEAR_OWNED_CHANNEL", channel, cb);
|
||||
common.clearOwnedChannel = function (data, cb) {
|
||||
postMessage("CLEAR_OWNED_CHANNEL", data, cb);
|
||||
};
|
||||
// "force" allows you to delete your drive ID
|
||||
common.removeOwnedChannel = function (data, cb) {
|
||||
|
|
|
@ -342,10 +342,11 @@ define([
|
|||
cb(account);
|
||||
};
|
||||
|
||||
// clearOwnedChannel is only used for private chat at the moment
|
||||
// clearOwnedChannel is only used for private chat and forms
|
||||
Store.clearOwnedChannel = function (clientId, data, cb) {
|
||||
if (!store.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
|
||||
store.rpc.clearOwnedChannel(data, function (err) {
|
||||
var s = getStore(data && data.teamId);
|
||||
if (!s.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
|
||||
s.rpc.clearOwnedChannel(data.channel, function (err) {
|
||||
cb({error:err});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -2752,7 +2752,8 @@ define([
|
|||
UI.confirmButton(button, {classes:'danger'}, function () {
|
||||
var sframeChan = framework._.sfCommon.getSframeChannel();
|
||||
sframeChan.query('Q_FORM_DELETE_ALL_ANSWERS', {
|
||||
channel: content.answers.channel
|
||||
channel: content.answers.channel,
|
||||
teamId: typeof(owned) === "number" ? owned : undefined
|
||||
}, function (err, obj) {
|
||||
if (err || (obj && obj.error)) { return void UI.warn(Messages.error); }
|
||||
APP.getResults();
|
||||
|
|
|
@ -147,7 +147,7 @@ define([
|
|||
accessKeys = _keys;
|
||||
|
||||
_keys.some(function (_k) {
|
||||
if ((personalDrive && !_k.id) || Cryptpad.initialTeam === _k.id) {
|
||||
if ((personalDrive && !_k.id) || Cryptpad.initialTeam === Number(_k.id)) {
|
||||
myKeys = _k;
|
||||
return true;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ define([
|
|||
});
|
||||
sframeChan.on("Q_FORM_DELETE_ALL_ANSWERS", function (data, cb) {
|
||||
if (!data || !data.channel) { return void cb({error: 'EINVAL'}); }
|
||||
Cryptpad.clearOwnedChannel(data.channel, cb);
|
||||
Cryptpad.clearOwnedChannel(data, cb);
|
||||
});
|
||||
sframeChan.on("Q_FORM_DELETE_ANSWER", function (data, cb) {
|
||||
if (!deleteLines) {
|
||||
|
|
Loading…
Reference in New Issue