|
|
|
@ -1147,13 +1147,31 @@ describe('Post\'s', () => {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should bypass post queue if user is in exempt group', (done) => {
|
|
|
|
|
it('should bypass post queue if user is in exempt group', async () => {
|
|
|
|
|
const oldValue = meta.config.groupsExemptFromPostQueue;
|
|
|
|
|
meta.config.groupsExemptFromPostQueue = ['registered-users'];
|
|
|
|
|
socketTopics.post({ uid: uid, emit: () => {} }, { title: 'should not be queued', content: 'topic content', cid: cid }, (err, result) => {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
assert.strictEqual(result.title, 'should not be queued');
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
const uid = await user.create({ username: 'mergeexemptuser' });
|
|
|
|
|
const result = await socketTopics.post({ uid: uid, emit: () => {} }, { title: 'should not be queued', content: 'topic content', cid: cid });
|
|
|
|
|
assert.strictEqual(result.title, 'should not be queued');
|
|
|
|
|
meta.config.groupsExemptFromPostQueue = oldValue;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should update queued post\'s topic if target topic is merged', async () => {
|
|
|
|
|
const uid = await user.create({ username: 'mergetestsuser' });
|
|
|
|
|
const result1 = await socketTopics.post({ uid: globalModUid }, { title: 'topic A', content: 'topic A content', cid: cid });
|
|
|
|
|
const result2 = await socketTopics.post({ uid: globalModUid }, { title: 'topic B', content: 'topic B content', cid: cid });
|
|
|
|
|
|
|
|
|
|
const result = await socketPosts.reply({ uid: uid }, { content: 'the moved queued post', tid: result1.tid });
|
|
|
|
|
|
|
|
|
|
await topics.merge([
|
|
|
|
|
result1.tid, result2.tid,
|
|
|
|
|
], globalModUid, { mainTid: result2.tid });
|
|
|
|
|
|
|
|
|
|
let postData = await posts.getQueuedPosts();
|
|
|
|
|
postData = postData.filter(p => p.data.tid === result2.tid);
|
|
|
|
|
assert.strictEqual(postData.length, 1);
|
|
|
|
|
assert.strictEqual(postData[0].data.content, 'the moved queued post');
|
|
|
|
|
assert.strictEqual(postData[0].data.tid, result2.tid);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|