mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
Fix loading deleted users on actions fetch. Closes #62
This commit is contained in:
parent
6fc8ec8a2d
commit
cbadbeb239
2 changed files with 10 additions and 4 deletions
|
@ -42,7 +42,7 @@ module.exports = {
|
||||||
const actions = await sails.helpers.getActionsForCard(inputs.cardId, inputs.beforeId);
|
const actions = await sails.helpers.getActionsForCard(inputs.cardId, inputs.beforeId);
|
||||||
|
|
||||||
const userIds = sails.helpers.mapRecords(actions, 'userId', true);
|
const userIds = sails.helpers.mapRecords(actions, 'userId', true);
|
||||||
const users = await sails.helpers.getUsers(userIds);
|
const users = await sails.helpers.getUsers(userIds, true);
|
||||||
|
|
||||||
return exits.success({
|
return exits.success({
|
||||||
items: actions,
|
items: actions,
|
||||||
|
|
|
@ -4,12 +4,14 @@ module.exports = {
|
||||||
type: 'json',
|
type: 'json',
|
||||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||||
},
|
},
|
||||||
|
withDeleted: {
|
||||||
|
type: 'boolean',
|
||||||
|
defaultsTo: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs, exits) {
|
async fn(inputs, exits) {
|
||||||
const criteria = {
|
const criteria = {};
|
||||||
deletedAt: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_.isArray(inputs.criteria)) {
|
if (_.isArray(inputs.criteria)) {
|
||||||
criteria.id = inputs.criteria;
|
criteria.id = inputs.criteria;
|
||||||
|
@ -17,6 +19,10 @@ module.exports = {
|
||||||
Object.assign(criteria, inputs.criteria);
|
Object.assign(criteria, inputs.criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!inputs.withDeleted) {
|
||||||
|
criteria.deletedAt = null;
|
||||||
|
}
|
||||||
|
|
||||||
const users = await User.find(criteria).sort('id');
|
const users = await User.find(criteria).sort('id');
|
||||||
|
|
||||||
return exits.success(users);
|
return exits.success(users);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue