mirror of
https://github.com/luxfi/pics.git
synced 2026-10-30 15:22:15 +00:00
28 lines
527 B
JavaScript
28 lines
527 B
JavaScript
'use strict';
|
|
|
|
module.exports = (req, res) => {
|
|
|
|
const { posts, __ } = res.locals;
|
|
|
|
const filteredposts = posts.filter(post => {
|
|
return (req.body.global_dismiss && post.globalreports.length > 0)
|
|
|| (req.body.dismiss && post.reports.length > 0);
|
|
});
|
|
|
|
if (filteredposts.length === 0) {
|
|
return {
|
|
message: __('No reports to dismiss'),
|
|
};
|
|
}
|
|
|
|
const ret = {
|
|
message: __('Dismissed reports'),
|
|
action: '$set',
|
|
query: {}
|
|
};
|
|
ret.query[`${req.body.global_dismiss ? 'global' : ''}reports`] = [];
|
|
|
|
return ret;
|
|
|
|
};
|