diff --git a/assets/js/aap/aap.js b/assets/js/aap/aap.js index a312386f92bcafde3f109f8adf6213e0d5e929a8..d76c4e10ae8bf7cb37f8dc1fa02b837db1de08d1 100755 --- a/assets/js/aap/aap.js +++ b/assets/js/aap/aap.js @@ -6217,6 +6217,12 @@ var aapObj = { ajaxPost(null, url, post, function (html) { $('#action-modal-preview').empty().html(html); }, null, 'text'); + }, + onContributorRemove: arg => { + coInterface.actions.request_participation({ + action: arg.cardData.id, + contributors: arg.list.map(c => c.id), + }).then(r => toastr.success(JSON.stringify(r))); } }); $(document.body).off('action.set-contributor').on('action.set-contributor', function (event, data) { diff --git a/assets/js/co.js b/assets/js/co.js index 4d1c74d516fc527bb0dd45ed4b68310d090ec6de..89af83918895c79345ff42bbb3be358c9bde3dd3 100755 --- a/assets/js/co.js +++ b/assets/js/co.js @@ -1948,10 +1948,26 @@ var coInterface = { }, request_participation: function (args) { return new Promise(function (resolve, reject) { + const fn = "request_participation"; + if (typeof args !== 'object' || !args) - reject('Undefined argument'); - else if (typeof args.action === 'undefined' || typeof args.contributor === 'undefined') - reject('Argument error'); + reject({ + side: "client", + msg: "Argument format error", + fn, + }); + else if (typeof args.action === 'undefined') + reject({ + side: "client", + msg: "Undefined action id", + fn, + }); + else if (typeof args.contributor === "undefined" && typeof args.contributors === "undefined") + reject({ + side: "client", + msg: "Should provide contributor id(s)", + fn, + }); else { var url = baseUrl; if (typeof args.server_url === 'string') @@ -1959,13 +1975,17 @@ var coInterface = { url += '/costum/project/action/request/set_contributors'; var post = { action: args.action, - contributor: args.contributor, emiter: wsCO && wsCO.id ? wsCO.id : '' }; - if (typeof args.participate === 'number') - post.participate = args.participate; - else - post.participate = 0; + if (typeof args.contributors === "object") + post.contributors = args.contributors; + else if (typeof args.contributor === "string") { + post.contributor = args.contributor; + if (typeof args.participate === 'number') + post.participate = args.participate; + else + post.participate = 0; + } ajaxPost(null, url, post, resolve, reject); } });