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.
24 lines
396 B
24 lines
396 B
'use strict';
|
|
|
|
module.exports = (posts) => {
|
|
|
|
// filter to ones not spoilered
|
|
const filteredPosts = posts.filter(post => {
|
|
return !post.spoiler && post.files.length > 0;
|
|
});
|
|
|
|
if (filteredPosts.length === 0) {
|
|
return {
|
|
message:'No post(s) to spoiler'
|
|
};
|
|
}
|
|
|
|
return {
|
|
message: `Spoilered ${filteredPosts.length} post(s)`,
|
|
action: '$set',
|
|
query: {
|
|
'spoiler': true
|
|
}
|
|
};
|
|
|
|
};
|
|
|