diff --git a/public/src/admin/manage/admins-mods.js b/public/src/admin/manage/admins-mods.js index f2b3cea6e6..bfeefd2ec3 100644 --- a/public/src/admin/manage/admins-mods.js +++ b/public/src/admin/manage/admins-mods.js @@ -54,7 +54,7 @@ define('admin/manage/admins-mods', ['translator', 'benchpress', 'autocomplete', $('.global-moderator-area').prepend(html); $('#no-global-mods-warning').addClass('hidden'); }); - }, err => app.alertError(err.status.message)); + }, 'default'); }); $('.global-moderator-area').on('click', '.remove-user-icon', function () { @@ -69,7 +69,7 @@ define('admin/manage/admins-mods', ['translator', 'benchpress', 'autocomplete', if (!$('.global-moderator-area').children().length) { $('#no-global-mods-warning').removeClass('hidden'); } - }, err => app.alertError(err.status.message)); + }, 'default'); } }); }); diff --git a/public/src/admin/manage/group.js b/public/src/admin/manage/group.js index 4cfef7eeaa..b161732b21 100644 --- a/public/src/admin/manage/group.js +++ b/public/src/admin/manage/group.js @@ -139,7 +139,7 @@ define('admin/manage/group', [ } api.del('/groups/' + ajaxify.data.group.slug + '/membership/' + uid, undefined, () => { userRow.slideUp().remove(); - }, err => app.alertError(err.status.message)); + }, 'default'); }); break; default: diff --git a/public/src/admin/manage/users.js b/public/src/admin/manage/users.js index 858ffdadab..2f04c0f2bd 100644 --- a/public/src/admin/manage/users.js +++ b/public/src/admin/manage/users.js @@ -98,7 +98,7 @@ define('admin/manage/users', ['translator', 'benchpress', 'autocomplete', 'api'] app.parseAndTranslate('admin/partials/manage_user_groups', { users: [{ groups: [ui.item.group] }] }, function (html) { $('[data-uid=' + uid + '] .group-area').append(html.find('.group-area').html()); }); - }, err => app.alertError(err.status.message)); + }, 'default'); }); }); modal.on('click', '.group-area a', function () { @@ -110,7 +110,7 @@ define('admin/manage/users', ['translator', 'benchpress', 'autocomplete', 'api'] var uid = $(this).parents('[data-uid]').attr('data-uid'); api.del('/groups/' + utils.slugify(groupName) + '/membership/' + uid, undefined, () => { groupCard.remove(); - }, err => app.alertError(err.status.message)); + }, 'default'); return false; }); }); diff --git a/public/src/client/account/edit.js b/public/src/client/account/edit.js index ac3ab10b1a..7c5e0cb95c 100644 --- a/public/src/client/account/edit.js +++ b/public/src/client/account/edit.js @@ -55,7 +55,7 @@ define('forum/account/edit', [ } updateHeader(res.picture); - }, err => app.alertError(err.status.message)); + }, 'default'); return false; } diff --git a/public/src/client/account/edit/email.js b/public/src/client/account/edit/email.js index 7a1959dd6e..c5f685e1a1 100644 --- a/public/src/client/account/edit/email.js +++ b/public/src/client/account/edit/email.js @@ -29,7 +29,7 @@ define('forum/account/edit/email', ['forum/account/header', 'api'], function (he api.put('/users/' + userData.uid, userData, (res) => { btn.removeClass('disabled').find('i').addClass('hide'); ajaxify.go('user/' + res.userslug + '/edit'); - }, err => app.alertError(err.status.message)); + }, 'default'); return false; }); diff --git a/public/src/client/account/edit/password.js b/public/src/client/account/edit/password.js index 30ccd8985c..fbf465b755 100644 --- a/public/src/client/account/edit/password.js +++ b/public/src/client/account/edit/password.js @@ -75,7 +75,7 @@ define('forum/account/edit/password', ['forum/account/header', 'translator', 'zx } else { ajaxify.go('user/' + ajaxify.data.userslug + '/edit'); } - }, err => app.alertError(err.status.message)).always(() => { + }, 'default').always(() => { btn.removeClass('disabled').find('i').addClass('hide'); currentPassword.val(''); password.val(''); diff --git a/public/src/client/account/edit/username.js b/public/src/client/account/edit/username.js index 5a79f22587..c6076ebc52 100644 --- a/public/src/client/account/edit/username.js +++ b/public/src/client/account/edit/username.js @@ -36,7 +36,7 @@ define('forum/account/edit/username', ['forum/account/header', 'api'], function } ajaxify.go('user/' + userslug + '/edit'); - }, err => app.alertError(err.status.message)); + }, 'default'); return false; }); diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js index 5185b580aa..2d350b329c 100644 --- a/public/src/client/account/header.js +++ b/public/src/client/account/header.js @@ -120,7 +120,7 @@ define('forum/account/header', [ components.get('account/follow').toggleClass('hide', type === 'follow'); components.get('account/unfollow').toggleClass('hide', type === 'unfollow'); app.alertSuccess('[[global:alert.' + type + ', ' + ajaxify.data.username + ']]'); - }, err => app.alertError(err.status.message)); + }, 'default'); return false; } @@ -158,7 +158,7 @@ define('forum/account/header', [ } ajaxify.refresh(); - }, err => app.alertError(err.status.message)); + }, 'default'); }, }, }, @@ -169,7 +169,7 @@ define('forum/account/header', [ function unbanAccount() { api.del('/users/' + ajaxify.data.theirid + '/ban', undefined, () => { ajaxify.refresh(); - }, err => app.alertError(err.status.message)); + }, 'default'); } function flagAccount() { diff --git a/public/src/client/groups/details.js b/public/src/client/groups/details.js index 03db28e96f..f56fda2b1d 100644 --- a/public/src/client/groups/details.js +++ b/public/src/client/groups/details.js @@ -106,11 +106,11 @@ define('forum/groups/details', [ break; case 'join': // intentional fall-throughs! - api.put('/groups/' + ajaxify.data.group.slug + '/membership/' + (uid || app.user.uid), undefined, () => ajaxify.refresh(), err => app.alertError(err.status.message)); + api.put('/groups/' + ajaxify.data.group.slug + '/membership/' + (uid || app.user.uid), undefined, () => ajaxify.refresh(), 'default'); break; case 'leave': - api.del('/groups/' + ajaxify.data.group.slug + '/membership/' + (uid || app.user.uid), undefined, () => ajaxify.refresh(), err => app.alertError(err.status.message)); + api.del('/groups/' + ajaxify.data.group.slug + '/membership/' + (uid || app.user.uid), undefined, () => ajaxify.refresh(), 'default'); break; case 'accept': // intentional fall-throughs! diff --git a/public/src/client/groups/list.js b/public/src/client/groups/list.js index 7b897bc3c2..ae4b79a72d 100644 --- a/public/src/client/groups/list.js +++ b/public/src/client/groups/list.js @@ -14,7 +14,7 @@ define('forum/groups/list', ['forum/infinitescroll', 'benchpress', 'api'], funct name: name, }, (res) => { ajaxify.go('groups/' + res.slug); - }, err => app.alertError(err.status.message)); + }, 'default'); } }); }); diff --git a/public/src/client/groups/memberlist.js b/public/src/client/groups/memberlist.js index e0a3db3dd8..6206a4c335 100644 --- a/public/src/client/groups/memberlist.js +++ b/public/src/client/groups/memberlist.js @@ -88,7 +88,7 @@ define('forum/groups/memberlist', ['api'], function (api) { $.when(requests) .done(done) - .fail(err => app.alertError(err.status.message)); + .fail('default'); } } diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index f59871ecfa..66fe870cbf 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -338,7 +338,7 @@ define('forum/topic/postTools', [ function bookmarkPost(button, pid) { var method = button.attr('data-bookmarked') === 'false' ? 'put' : 'del'; - api[method](`/posts/${pid}/bookmark`, undefined, undefined, err => app.alertError(err.status.message)); + api[method](`/posts/${pid}/bookmark`, undefined, undefined, 'default'); return false; } @@ -385,7 +385,7 @@ define('forum/topic/postTools', [ const route = action === 'purge' ? '' : '/state'; const method = action === 'restore' ? 'put' : 'del'; - api[method](`/posts/${pid}${route}`, undefined, undefined, err => app.alertError(err.status.message)); + api[method](`/posts/${pid}${route}`, undefined, undefined, 'default'); }); }); } diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.js index 4e86cf1763..b405a8bcee 100644 --- a/public/src/client/topic/threadTools.js +++ b/public/src/client/topic/threadTools.js @@ -183,7 +183,7 @@ define('forum/topic/threadTools', [ const method = command === 'restore' ? 'put' : 'del'; const suffix = command !== 'purge' ? '/state' : ''; - api[method](`/topics/${tid}${suffix}`, undefined, undefined, err => app.alertError(err.status.message)); + api[method](`/topics/${tid}${suffix}`, undefined, undefined, 'default'); }); }); } diff --git a/public/src/modules/api.js b/public/src/modules/api.js index 01f859230e..374c36b95c 100644 --- a/public/src/modules/api.js +++ b/public/src/modules/api.js @@ -2,7 +2,7 @@ define('api', () => { const api = {}; - const baseUrl = config.relative_path + '/api/v1'; + const baseUrl = config.relative_path + '/api/v3'; function call(options, onSuccess, onError) { $.ajax(options) @@ -12,7 +12,9 @@ define('api', () => { } }) .fail((ev) => { - if (onError) { + if (onError === 'default') { + app.alertError(ev.responseJSON.status.message); + } else if (onError) { onError(ev.responseJSON); } }); diff --git a/src/routes/write/index.js b/src/routes/write/index.js index 00be701dd1..c5dfead241 100644 --- a/src/routes/write/index.js +++ b/src/routes/write/index.js @@ -8,7 +8,7 @@ const Write = module.exports; Write.reload = (params) => { const router = params.router; - router.use('/api/v1', function (req, res, next) { + router.use('/api/v3', function (req, res, next) { // if (req.protocol !== 'https') { // res.set('Upgrade', 'TLS/1.0, HTTP/1.1'); // return helpers.formatApiResponse(426, res); @@ -20,20 +20,20 @@ Write.reload = (params) => { next(); }); - router.use('/api/v1/users', require('./users')()); - router.use('/api/v1/groups', require('./groups')()); - router.use('/api/v1/categories', require('./categories')()); - router.use('/api/v1/topics', require('./topics')()); - router.use('/api/v1/posts', require('./posts')()); - // router.use('/api/v1/util', require('./util')()); + router.use('/api/v3/users', require('./users')()); + router.use('/api/v3/groups', require('./groups')()); + router.use('/api/v3/categories', require('./categories')()); + router.use('/api/v3/topics', require('./topics')()); + router.use('/api/v3/posts', require('./posts')()); + // router.use('/api/v3/util', require('./util')()); - router.get('/api/v1/ping', function (req, res) { + router.get('/api/v3/ping', function (req, res) { helpers.formatApiResponse(200, res, { pong: true, }); }); - router.post('/api/v1/ping', middleware.authenticate, function (req, res) { + router.post('/api/v3/ping', middleware.authenticate, function (req, res) { helpers.formatApiResponse(200, res, { uid: req.user.uid, }); diff --git a/src/socket.io/admin/categories.js b/src/socket.io/admin/categories.js index e73d4d14ae..b12882c849 100644 --- a/src/socket.io/admin/categories.js +++ b/src/socket.io/admin/categories.js @@ -13,7 +13,7 @@ const sockets = require('..'); const Categories = module.exports; Categories.create = async function (socket, data) { - sockets.warnDeprecated(socket, 'POST /api/v1/categories'); + sockets.warnDeprecated(socket, 'POST /api/v3/categories'); if (!data) { throw new Error('[[error:invalid-data]]'); @@ -40,7 +40,7 @@ Categories.getNames = async function () { }; Categories.purge = async function (socket, cid) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/categories/:cid'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/categories/:cid'); const name = await categories.getCategoryField(cid, 'name'); await categories.purge(cid, socket.uid); @@ -54,7 +54,7 @@ Categories.purge = async function (socket, cid) { }; Categories.update = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/categories/:cid'); + sockets.warnDeprecated(socket, 'PUT /api/v3/categories/:cid'); if (!data) { throw new Error('[[error:invalid-data]]'); diff --git a/src/socket.io/admin/groups.js b/src/socket.io/admin/groups.js index dc875ccfe8..b5d9b788bf 100644 --- a/src/socket.io/admin/groups.js +++ b/src/socket.io/admin/groups.js @@ -6,7 +6,7 @@ const sockets = require('..'); const Groups = module.exports; Groups.create = async function (socket, data) { - sockets.warnDeprecated(socket, 'POST /api/v1/groups'); + sockets.warnDeprecated(socket, 'POST /api/v3/groups'); if (!data) { throw new Error('[[error:invalid-data]]'); @@ -24,7 +24,7 @@ Groups.create = async function (socket, data) { }; Groups.join = async (socket, data) => { - sockets.warnDeprecated(socket, 'PUT /api/v1/groups/:slug/membership/:uid'); + sockets.warnDeprecated(socket, 'PUT /api/v3/groups/:slug/membership/:uid'); if (!data) { throw new Error('[[error:invalid-data]]'); @@ -39,7 +39,7 @@ Groups.join = async (socket, data) => { }; Groups.leave = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/groups/:slug/membership/:uid'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/groups/:slug/membership/:uid'); if (!data) { throw new Error('[[error:invalid-data]]'); diff --git a/src/socket.io/admin/user.js b/src/socket.io/admin/user.js index bc18d26c43..990869bb7e 100644 --- a/src/socket.io/admin/user.js +++ b/src/socket.io/admin/user.js @@ -58,7 +58,7 @@ User.removeAdmins = async function (socket, uids) { }; User.createUser = async function (socket, userData) { - sockets.warnDeprecated(socket, 'POST /api/v1/users'); + sockets.warnDeprecated(socket, 'POST /api/v3/users'); if (!userData) { throw new Error('[[error:invalid-data]]'); @@ -139,7 +139,7 @@ User.deleteUsersContent = async function (socket, uids) { }; User.deleteUsersAndContent = async function (socket, uids) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/users or DELETE /api/v1/users/:uid'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/users or DELETE /api/v3/users/:uid'); await canDeleteUids(uids); deleteUsers(socket, uids, async function (uid) { diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js index 706b2b6b7f..ab1ad80ca1 100644 --- a/src/socket.io/groups.js +++ b/src/socket.io/groups.js @@ -19,7 +19,7 @@ SocketGroups.before = async (socket, method, data) => { }; SocketGroups.join = async (socket, data) => { - sockets.warnDeprecated(socket, 'PUT /api/v1/groups/:slug/membership/:uid'); + sockets.warnDeprecated(socket, 'PUT /api/v3/groups/:slug/membership/:uid'); if (socket.uid <= 0) { throw new Error('[[error:invalid-uid]]'); @@ -69,7 +69,7 @@ SocketGroups.join = async (socket, data) => { }; SocketGroups.leave = async (socket, data) => { - sockets.warnDeprecated(socket, 'DELETE /api/v1/groups/:slug/membership/:uid'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/groups/:slug/membership/:uid'); if (socket.uid <= 0) { throw new Error('[[error:invalid-uid]]'); @@ -282,7 +282,7 @@ SocketGroups.kick = async (socket, data) => { }; SocketGroups.create = async (socket, data) => { - sockets.warnDeprecated(socket, 'POST /api/v1/groups'); + sockets.warnDeprecated(socket, 'POST /api/v3/groups'); if (!socket.uid) { throw new Error('[[error:no-privileges]]'); diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 1096f59239..0bdc4fc82f 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -24,7 +24,7 @@ require('./posts/tools')(SocketPosts); require('./posts/diffs')(SocketPosts); SocketPosts.reply = async function (socket, data) { - sockets.warnDeprecated(socket, 'POST /api/v1/topics/:tid'); + sockets.warnDeprecated(socket, 'POST /api/v3/topics/:tid'); if (!data || !data.tid || (meta.config.minimumPostLength !== 0 && !data.content)) { throw new Error('[[error:invalid-data]]'); diff --git a/src/socket.io/posts/bookmarks.js b/src/socket.io/posts/bookmarks.js index ca049f165a..4330286b5a 100644 --- a/src/socket.io/posts/bookmarks.js +++ b/src/socket.io/posts/bookmarks.js @@ -6,12 +6,12 @@ const sockets = require('..'); module.exports = function (SocketPosts) { SocketPosts.bookmark = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/posts/:pid/bookmark'); + sockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid/bookmark'); return await helpers.postCommand(socket, 'bookmark', 'bookmarked', '', data); }; SocketPosts.unbookmark = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/posts/:pid/bookmark'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid/bookmark'); return await helpers.postCommand(socket, 'unbookmark', 'bookmarked', '', data); }; }; diff --git a/src/socket.io/posts/edit.js b/src/socket.io/posts/edit.js index 1e71aaff35..87c48b021c 100644 --- a/src/socket.io/posts/edit.js +++ b/src/socket.io/posts/edit.js @@ -12,7 +12,7 @@ const websockets = require('../index'); module.exports = function (SocketPosts) { SocketPosts.edit = async function (socket, data) { - websockets.warnDeprecated(socket, 'PUT /api/v1/posts/:pid'); + websockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid'); if (!socket.uid) { throw new Error('[[error:not-logged-in]]'); diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js index 9d4f6442e9..492385481c 100644 --- a/src/socket.io/posts/tools.js +++ b/src/socket.io/posts/tools.js @@ -64,7 +64,7 @@ module.exports = function (SocketPosts) { }; SocketPosts.delete = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/posts/:pid/state'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid/state'); await deleteOrRestore(socket, data, { command: 'delete', @@ -74,7 +74,7 @@ module.exports = function (SocketPosts) { }; SocketPosts.restore = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/posts/:pid/state'); + sockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid/state'); await deleteOrRestore(socket, data, { command: 'restore', @@ -123,7 +123,7 @@ module.exports = function (SocketPosts) { } SocketPosts.purge = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/posts/:pid'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid'); if (!data || !parseInt(data.pid, 10)) { throw new Error('[[error:invalid-data]]'); diff --git a/src/socket.io/posts/votes.js b/src/socket.io/posts/votes.js index 94c911aec0..23b0467c5f 100644 --- a/src/socket.io/posts/votes.js +++ b/src/socket.io/posts/votes.js @@ -63,17 +63,17 @@ module.exports = function (SocketPosts) { }; SocketPosts.upvote = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/posts/:pid/vote'); + sockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid/vote'); return await helpers.postCommand(socket, 'upvote', 'voted', 'notifications:upvoted_your_post_in', data); }; SocketPosts.downvote = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/posts/:pid/vote'); + sockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid/vote'); return await helpers.postCommand(socket, 'downvote', 'voted', '', data); }; SocketPosts.unvote = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/posts/:pid/vote'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid/vote'); return await helpers.postCommand(socket, 'unvote', 'voted', '', data); }; }; diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index c0dcd81a97..8bee5f1562 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -19,7 +19,7 @@ require('./topics/tags')(SocketTopics); require('./topics/merge')(SocketTopics); SocketTopics.post = async function (socket, data) { - sockets.warnDeprecated(socket, 'POST /api/v1/topics'); + sockets.warnDeprecated(socket, 'POST /api/v3/topics'); if (!data) { throw new Error('[[error:invalid-data]]'); @@ -83,12 +83,12 @@ SocketTopics.changeWatching = async function (socket, data) { throw new Error('[[error:invalid-command]]'); } - sockets.warnDeprecated(socket, 'PUT/DELETE /api/v1/topics/:tid/(follow|ignore)'); + sockets.warnDeprecated(socket, 'PUT/DELETE /api/v3/topics/:tid/(follow|ignore)'); await followCommand(topics[data.type], socket, data.tid); }; SocketTopics.follow = async function (socket, tid) { - sockets.warnDeprecated(socket, 'PUT /api/v1/topics/:tid/follow'); + sockets.warnDeprecated(socket, 'PUT /api/v3/topics/:tid/follow'); await followCommand(topics.follow, socket, tid); }; diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.js index e04ffd94b2..cd364ea9c8 100644 --- a/src/socket.io/topics/tools.js +++ b/src/socket.io/topics/tools.js @@ -35,37 +35,37 @@ module.exports = function (SocketTopics) { }; SocketTopics.delete = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/topics/state'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/topics/state'); await SocketTopics.doTopicAction('delete', 'event:topic_deleted', socket, data); }; SocketTopics.restore = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/topics/state'); + sockets.warnDeprecated(socket, 'PUT /api/v3/topics/state'); await SocketTopics.doTopicAction('restore', 'event:topic_restored', socket, data); }; SocketTopics.purge = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/topics'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/topics'); await SocketTopics.doTopicAction('purge', 'event:topic_purged', socket, data); }; SocketTopics.lock = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/topics/lock'); + sockets.warnDeprecated(socket, 'PUT /api/v3/topics/lock'); await SocketTopics.doTopicAction('lock', 'event:topic_locked', socket, data); }; SocketTopics.unlock = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/topics/lock'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/topics/lock'); await SocketTopics.doTopicAction('unlock', 'event:topic_unlocked', socket, data); }; SocketTopics.pin = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/topics/pin'); + sockets.warnDeprecated(socket, 'PUT /api/v3/topics/pin'); await SocketTopics.doTopicAction('pin', 'event:topic_pinned', socket, data); }; SocketTopics.unpin = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/topics/pin'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/topics/pin'); await SocketTopics.doTopicAction('unpin', 'event:topic_unpinned', socket, data); }; diff --git a/src/socket.io/user.js b/src/socket.io/user.js index b92baad6d0..721d869467 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -158,7 +158,7 @@ SocketUser.isFollowing = async function (socket, data) { }; SocketUser.follow = async function (socket, data) { - sockets.warnDeprecated(socket, 'POST /api/v1/users/follow'); + sockets.warnDeprecated(socket, 'POST /api/v3/users/follow'); if (!socket.uid || !data) { throw new Error('[[error:invalid-data]]'); @@ -182,7 +182,7 @@ SocketUser.follow = async function (socket, data) { }; SocketUser.unfollow = async function (socket, data) { - sockets.warnDeprecated(socket, 'DELETE /api/v1/users/unfollow'); + sockets.warnDeprecated(socket, 'DELETE /api/v3/users/unfollow'); if (!socket.uid || !data) { throw new Error('[[error:invalid-data]]'); diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js index 10f76eca5f..8f021cb258 100644 --- a/src/socket.io/user/ban.js +++ b/src/socket.io/user/ban.js @@ -11,7 +11,7 @@ const flags = require('../../flags'); module.exports = function (SocketUser) { SocketUser.banUsers = async function (socket, data) { - websockets.warnDeprecated(socket, 'PUT /api/v1/users/:uid/ban'); + websockets.warnDeprecated(socket, 'PUT /api/v3/users/:uid/ban'); if (!data || !Array.isArray(data.uids)) { throw new Error('[[error:invalid-data]]'); @@ -40,7 +40,7 @@ module.exports = function (SocketUser) { }; SocketUser.unbanUsers = async function (socket, uids) { - websockets.warnDeprecated(socket, 'DELETE /api/v1/users/:uid/ban'); + websockets.warnDeprecated(socket, 'DELETE /api/v3/users/:uid/ban'); await toggleBan(socket.uid, uids, async function (uid) { await user.bans.unban(uid); diff --git a/src/socket.io/user/profile.js b/src/socket.io/user/profile.js index 4e575ade02..18f079e133 100644 --- a/src/socket.io/user/profile.js +++ b/src/socket.io/user/profile.js @@ -13,7 +13,7 @@ const sockets = require('..'); module.exports = function (SocketUser) { SocketUser.changeUsernameEmail = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/users/:uid'); + sockets.warnDeprecated(socket, 'PUT /api/v3/users/:uid'); if (!data || !data.uid || !socket.uid) { throw new Error('[[error:invalid-data]]'); @@ -78,7 +78,7 @@ module.exports = function (SocketUser) { } SocketUser.changePassword = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/users/:uid/password'); + sockets.warnDeprecated(socket, 'PUT /api/v3/users/:uid/password'); if (!socket.uid) { throw new Error('[[error:invalid-uid]]'); @@ -97,7 +97,7 @@ module.exports = function (SocketUser) { }; SocketUser.updateProfile = async function (socket, data) { - sockets.warnDeprecated(socket, 'PUT /api/v1/users/:uid'); + sockets.warnDeprecated(socket, 'PUT /api/v3/users/:uid'); if (!socket.uid) { throw new Error('[[error:invalid-uid]]');