* 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

@@ -1,7 +1,7 @@
'use strict';
define('flags', ['hooks', 'components'], function (hooks, components) {
define('flags', ['hooks', 'components', 'api'], function (hooks, components, api) {
var Flag = {};
var flagModal;
var flagCommit;
@@ -59,18 +59,12 @@ define('flags', ['hooks', 'components'], function (hooks, components) {
};
Flag.resolve = function (flagId) {
socket.emit('flags.update', {
flagId: flagId,
data: [
{ name: 'state', value: 'resolved' },
],
}, function (err) {
if (err) {
return app.alertError(err.message);
}
api.put(`/flags/${flagId}`, {
state: 'resolved',
}).then(() => {
app.alertSuccess('[[flags:resolved]]');
hooks.fire('action:flag.resolved', { flagId: flagId });
});
}).catch(app.alertError);
};
function createFlag(type, id, reason) {
@@ -78,7 +72,7 @@ define('flags', ['hooks', 'components'], function (hooks, components) {
return;
}
var data = { type: type, id: id, reason: reason };
socket.emit('flags.create', data, function (err, flagId) {
api.post('/flags', data, function (err, flagId) {
if (err) {
return app.alertError(err.message);
}