feat: #7964, change all categories at once

allow passing cids to setCategoryWatchState and category.exists
This commit is contained in:
Baris Usakli
2019-10-11 15:25:41 -04:00
parent 0da4f7ee8d
commit 485fbd2f14
5 changed files with 43 additions and 20 deletions

View File

@@ -23,6 +23,9 @@ require('./update')(Categories);
require('./watch')(Categories);
Categories.exists = async function (cid) {
if (Array.isArray(cid)) {
return await db.exists(cid.map(cid => 'category:' + cid));
}
return await db.exists('category:' + cid);
};