mirror of
https://github.com/luxfi/pics.git
synced 2026-10-30 15:22:15 +00:00
Update a bunch of middleware, pages and libs to destructure i18n funcs if used more than once to not repeat res.locals ref #396 (going to try and remember this from now on)
30 lines
499 B
JavaScript
30 lines
499 B
JavaScript
'use strict';
|
|
|
|
const { NumberInt } = require(__dirname+'/../../db/db.js');
|
|
|
|
module.exports = (locals) => {
|
|
|
|
const { posts, __, __n } = locals;
|
|
|
|
const filteredposts = posts.filter(post => {
|
|
return !post.thread;
|
|
});
|
|
|
|
if (filteredposts.length === 0) {
|
|
return {
|
|
message: __('No threads selected to Bumplock'),
|
|
};
|
|
}
|
|
|
|
return {
|
|
message: __n('Toggled Bumplock for %s threads', filteredposts.length),
|
|
action: '$bit',
|
|
query: {
|
|
'bumplocked': {
|
|
'xor': NumberInt(1)
|
|
},
|
|
}
|
|
};
|
|
|
|
};
|