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