mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
Merge branch 'master' of https://github.com/NodeBB/NodeBB
This commit is contained in:
@@ -21,7 +21,7 @@ SocketFlags.create = async function (socket, data) {
|
||||
|
||||
const flagObj = await flags.create(data.type, data.id, socket.uid, data.reason);
|
||||
await flags.notify(flagObj, socket.uid);
|
||||
return flagObj;
|
||||
return flagObj.flagId;
|
||||
};
|
||||
|
||||
SocketFlags.update = async function (socket, data) {
|
||||
|
||||
@@ -684,10 +684,10 @@ describe('Admin Controllers', function () {
|
||||
var socketFlags = require('../src/socket.io/flags');
|
||||
var oldValue = meta.config['min:rep:flag'];
|
||||
meta.config['min:rep:flag'] = 0;
|
||||
socketFlags.create({ uid: regularUid }, { id: pid, type: 'post', reason: 'spam' }, function (err, data) {
|
||||
socketFlags.create({ uid: regularUid }, { id: pid, type: 'post', reason: 'spam' }, function (err, flagId) {
|
||||
meta.config['min:rep:flag'] = oldValue;
|
||||
assert.ifError(err);
|
||||
request(nconf.get('url') + '/api/flags/' + data.flagId, { jar: moderatorJar, json: true }, function (err, res, body) {
|
||||
request(nconf.get('url') + '/api/flags/' + flagId, { jar: moderatorJar, json: true }, function (err, res, body) {
|
||||
assert.ifError(err);
|
||||
assert(body);
|
||||
assert.equal(body.reporter.username, 'regular');
|
||||
|
||||
@@ -596,9 +596,7 @@ describe('Flags', function () {
|
||||
|
||||
describe('(websockets)', function () {
|
||||
var SocketFlags = require('../src/socket.io/flags.js');
|
||||
var tid;
|
||||
var pid;
|
||||
var flag;
|
||||
|
||||
before(function (done) {
|
||||
Topics.post({
|
||||
@@ -607,7 +605,6 @@ describe('Flags', function () {
|
||||
title: 'Another topic',
|
||||
content: 'This is flaggable content',
|
||||
}, function (err, topic) {
|
||||
tid = topic.postData.tid;
|
||||
pid = topic.postData.pid;
|
||||
|
||||
done(err);
|
||||
@@ -620,8 +617,7 @@ describe('Flags', function () {
|
||||
type: 'post',
|
||||
id: pid,
|
||||
reason: 'foobar',
|
||||
}, function (err, flagObj) {
|
||||
flag = flagObj;
|
||||
}, function (err) {
|
||||
assert.ifError(err);
|
||||
|
||||
Flags.exists('post', pid, 1, function (err, exists) {
|
||||
|
||||
Reference in New Issue
Block a user