mirror of https://gitgud.io/fatchan/jschan.git
parent
13ed2b2b91
commit
2bf9e5dad9
5 changed files with 29 additions and 6 deletions
@ -0,0 +1,23 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
module.exports = (posts) => { |
||||||
|
|
||||||
|
const filteredposts = posts.filter(post => { |
||||||
|
return !post.thread && !post.cyclic |
||||||
|
}) |
||||||
|
|
||||||
|
if (filteredposts.length === 0) { |
||||||
|
return { |
||||||
|
message: 'No thread(s) to cycle', |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
message: `Cycled ${filteredposts.length} thread(s)`, |
||||||
|
action: '$set', |
||||||
|
query: { |
||||||
|
'cyclic': true, |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue