mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-11 17:11:33 +02:00
Merge branch 'master' of https://github.com/NodeBB/NodeBB
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
"initialPostDelay": 10,
|
||||
"newbiePostDelay": 120,
|
||||
"postEditDuration": 0,
|
||||
"newbiePostEditDuration": 3600000,
|
||||
"newbiePostEditDuration": 3600,
|
||||
"postDeleteDuration": 0,
|
||||
"enablePostHistory": 1,
|
||||
"postCacheSize": 10485760,
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
"eslint-plugin-import": "2.18.1",
|
||||
"grunt": "1.0.4",
|
||||
"grunt-contrib-watch": "1.1.0",
|
||||
"husky": "3.0.1",
|
||||
"husky": "3.0.2",
|
||||
"jsdom": "15.1.1",
|
||||
"lint-staged": "8.2.1",
|
||||
"mocha": "6.2.0",
|
||||
|
||||
@@ -45,6 +45,7 @@ exports.post = function (req, res) {
|
||||
req: req,
|
||||
timestamp: Date.now(),
|
||||
content: body.content,
|
||||
fromQueue: false,
|
||||
};
|
||||
req.body.noscript = 'true';
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ module.exports = function (Posts) {
|
||||
return null;
|
||||
}
|
||||
data.data = JSON.parse(data.data);
|
||||
data.data.fromQueue = true;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@ var batch = require('../batch');
|
||||
|
||||
var SocketHelpers = module.exports;
|
||||
|
||||
SocketHelpers.setDefaultPostData = function (data, socket) {
|
||||
data.uid = socket.uid;
|
||||
data.req = websockets.reqFromSocket(socket);
|
||||
data.timestamp = Date.now();
|
||||
data.fromQueue = false;
|
||||
};
|
||||
|
||||
SocketHelpers.notifyNew = function (uid, type, result) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
|
||||
@@ -9,7 +9,6 @@ var meta = require('../meta');
|
||||
var topics = require('../topics');
|
||||
const categories = require('../categories');
|
||||
var user = require('../user');
|
||||
var websockets = require('./index');
|
||||
var socketHelpers = require('./helpers');
|
||||
var utils = require('../utils');
|
||||
|
||||
@@ -29,9 +28,7 @@ SocketPosts.reply = function (socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
data.uid = socket.uid;
|
||||
data.req = websockets.reqFromSocket(socket);
|
||||
data.timestamp = Date.now();
|
||||
socketHelpers.setDefaultPostData(data, socket);
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
|
||||
@@ -4,7 +4,6 @@ var async = require('async');
|
||||
|
||||
var topics = require('../topics');
|
||||
var posts = require('../posts');
|
||||
var websockets = require('./index');
|
||||
var user = require('../user');
|
||||
var meta = require('../meta');
|
||||
var apiController = require('../controllers/api');
|
||||
@@ -25,9 +24,7 @@ SocketTopics.post = function (socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
data.uid = socket.uid;
|
||||
data.req = websockets.reqFromSocket(socket);
|
||||
data.timestamp = Date.now();
|
||||
socketHelpers.setDefaultPostData(data, socket);
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
|
||||
@@ -88,7 +88,9 @@ module.exports = function (Topics) {
|
||||
}
|
||||
|
||||
await guestHandleValid(data);
|
||||
await user.isReadyToPost(data.uid, data.cid);
|
||||
if (!data.fromQueue) {
|
||||
await user.isReadyToPost(data.uid, data.cid);
|
||||
}
|
||||
const filteredData = await plugins.fireHook('filter:topic.post', data);
|
||||
data = filteredData;
|
||||
const tid = await Topics.create(data);
|
||||
@@ -159,7 +161,9 @@ module.exports = function (Topics) {
|
||||
}
|
||||
|
||||
await guestHandleValid(data);
|
||||
await user.isReadyToPost(uid, data.cid);
|
||||
if (!data.fromQueue) {
|
||||
await user.isReadyToPost(uid, data.cid);
|
||||
}
|
||||
await plugins.fireHook('filter:topic.reply', data);
|
||||
if (data.content) {
|
||||
data.content = utils.rtrim(data.content);
|
||||
|
||||
@@ -518,7 +518,7 @@ describe('Post\'s', function () {
|
||||
setTimeout(function () {
|
||||
socketPosts.edit({ uid: voterUid }, { pid: pid, content: 'edited post content again', title: 'edited title again', tags: ['edited-twice'] }, function (err, data) {
|
||||
assert.equal(err.message, '[[error:post-edit-duration-expired, 1]]');
|
||||
meta.config.newbiePostEditDuration = 3600000;
|
||||
meta.config.newbiePostEditDuration = 3600;
|
||||
done();
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
Reference in New Issue
Block a user