mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
breaking: remove socket.emit('posts.bookmark/unbookmark')
This commit is contained in:
@@ -20,7 +20,6 @@ const SocketPosts = module.exports;
|
|||||||
require('./posts/edit')(SocketPosts);
|
require('./posts/edit')(SocketPosts);
|
||||||
require('./posts/move')(SocketPosts);
|
require('./posts/move')(SocketPosts);
|
||||||
require('./posts/votes')(SocketPosts);
|
require('./posts/votes')(SocketPosts);
|
||||||
require('./posts/bookmarks')(SocketPosts);
|
|
||||||
require('./posts/tools')(SocketPosts);
|
require('./posts/tools')(SocketPosts);
|
||||||
|
|
||||||
SocketPosts.reply = async function (socket, data) {
|
SocketPosts.reply = async function (socket, data) {
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const sockets = require('..');
|
|
||||||
const api = require('../../api');
|
|
||||||
|
|
||||||
module.exports = function (SocketPosts) {
|
|
||||||
SocketPosts.bookmark = async function (socket, data) {
|
|
||||||
sockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid/bookmark');
|
|
||||||
return await api.posts.bookmark(socket, data);
|
|
||||||
};
|
|
||||||
|
|
||||||
SocketPosts.unbookmark = async function (socket, data) {
|
|
||||||
sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid/bookmark');
|
|
||||||
return await api.posts.unbookmark(socket, data);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -282,28 +282,18 @@ describe('Post\'s', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('bookmarking', () => {
|
describe('bookmarking', () => {
|
||||||
it('should bookmark a post', (done) => {
|
it('should bookmark a post', async () => {
|
||||||
socketPosts.bookmark({ uid: voterUid }, { pid: postData.pid, room_id: `topic_${postData.tid}` }, (err, data) => {
|
const data = await apiPosts.bookmark({ uid: voterUid }, { pid: postData.pid, room_id: `topic_${postData.tid}` });
|
||||||
assert.ifError(err);
|
assert.equal(data.isBookmarked, true);
|
||||||
assert.equal(data.isBookmarked, true);
|
const hasBookmarked = await posts.hasBookmarked(postData.pid, voterUid);
|
||||||
posts.hasBookmarked(postData.pid, voterUid, (err, hasBookmarked) => {
|
assert.equal(hasBookmarked, true);
|
||||||
assert.ifError(err);
|
|
||||||
assert.equal(hasBookmarked, true);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should unbookmark a post', (done) => {
|
it('should unbookmark a post', async () => {
|
||||||
socketPosts.unbookmark({ uid: voterUid }, { pid: postData.pid, room_id: `topic_${postData.tid}` }, (err, data) => {
|
const data = await apiPosts.unbookmark({ uid: voterUid }, { pid: postData.pid, room_id: `topic_${postData.tid}` });
|
||||||
assert.ifError(err);
|
assert.equal(data.isBookmarked, false);
|
||||||
assert.equal(data.isBookmarked, false);
|
const hasBookmarked = await posts.hasBookmarked([postData.pid], voterUid);
|
||||||
posts.hasBookmarked([postData.pid], voterUid, (err, hasBookmarked) => {
|
assert.equal(hasBookmarked[0], false);
|
||||||
assert.ifError(err);
|
|
||||||
assert.equal(hasBookmarked[0], false);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user