mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-07 08:02:50 +01:00
Flags API (#9666)
* feat: new routes for flags API + flag get + flag creation, migration from socket method + flag update, migration from socket method * fixed bug where you could not unassign someone from a flag * feat: tests for new flags API added missing files for schema update * fix: flag tests to use Write API instead of sockets * feat: flag notes API + tests * chore: remove debug line * test: fix breaking test on mongo
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
const path = require('path');
|
||||
const nconf = require('nconf');
|
||||
|
||||
const db = require('../database');
|
||||
const file = require('../file');
|
||||
const user = require('../user');
|
||||
const groups = require('../groups');
|
||||
@@ -52,6 +53,14 @@ Assert.post = helpers.try(async (req, res, next) => {
|
||||
next();
|
||||
});
|
||||
|
||||
Assert.flag = helpers.try(async (req, res, next) => {
|
||||
if (!await db.isSortedSetMember('flags:datetime', req.params.flagId)) {
|
||||
return controllerHelpers.formatApiResponse(404, res, new Error('[[error:no-flag]]'));
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
Assert.path = helpers.try(async (req, res, next) => {
|
||||
// file: URL support
|
||||
if (req.body.path.startsWith('file:///')) {
|
||||
|
||||
Reference in New Issue
Block a user