fix: dont return flag data to client

v1.18.x
Baris Usakli 5 years ago
parent 51236df4ed
commit 418c174d56

@ -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) {

Loading…
Cancel
Save