Skip to content

Commit

Permalink
fix(api-filters): Return valid action.mailbox value for a filter object
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 16, 2023
1 parent 292bbc2 commit c00cc02
Show file tree
Hide file tree
Showing 4 changed files with 330 additions and 291 deletions.
13 changes: 10 additions & 3 deletions lib/api/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ module.exports = (db, server, userHandler, settingsHandler) => {
query: {},
action: {},
disabled: !!filterData.disabled,
created: filterData.created,
_filterData: filterData
created: filterData.created
};

Object.keys((filterData.query && filterData.query.headers) || {}).forEach(key => {
Expand All @@ -424,7 +423,15 @@ module.exports = (db, server, userHandler, settingsHandler) => {
response.action.targets = filterData.action.targets.map(target => target.value);
return;
}
response.action[key] = filterData.action[key];

switch (key) {
case 'mailbox':
// cast ObjectId value to a string, otherwise `permission.filter` will mess up the value
response.action[key] = filterData.action[key].toString();
break;
default:
response.action[key] = filterData.action[key];
}
});

if (filterData.metaData) {
Expand Down
Loading

0 comments on commit c00cc02

Please sign in to comment.