mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
527 B
27 lines
527 B
'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;
|
|
|
|
};
|
|
|