* 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:
Julian Lam
2021-07-16 13:44:42 -04:00
committed by GitHub
parent 71bc258731
commit cc6cbfcdc4
23 changed files with 752 additions and 331 deletions

View File

@@ -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:///')) {