Node.js based forum software built for the modern web
refactor: remove unnecessary flag routes added in 9ab1a2d
Opliko53b352d0d8af
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.jsindex 2c49b5d948..b47ac8b76c 100644--- a/public/src/client/topic/postTools.js+++ b/public/src/client/topic/postTools.js@@ -148,13 +148,13 @@ define('forum/topic/postTools', [});postContainer.on('click', '[component="post/already-flagged"]', function () {- const pid = getData($(this), 'data-pid');+ const flagId = $(this).data('flag-id');require(['flags'], function (flags) {bootbox.confirm('[[flags:modal-confirm-rescind]]', function (confirm) {if (!confirm) {return;}- flags.rescindByType('post', pid);+ flags.rescind(flagId);});});});diff --git a/public/src/modules/flags.js b/public/src/modules/flags.jsindex a105e22181..83684ace51 100644--- a/public/src/modules/flags.js+++ b/public/src/modules/flags.js@@ -67,17 +67,6 @@ define('flags', ['hooks', 'components', 'api', 'alerts'], function (hooks, compo}).catch(alerts.error);};- Flag.rescindByType = function (type, id) {- api.del(`/flags/${type}/${encodeURIComponent(id)}/report`).then(() => {- alerts.success('[[flags:rescinded]]');- hooks.fire('action:flag.rescinded', { type: type, id: id });- if (type === 'post') {- const postEl = components.get('post', 'pid', id);- postEl.find('[component="post/flag"]').removeClass('hidden').parent().attr('hidden', null);- postEl.find('[component="post/already-flagged"]').addClass('hidden').parent().attr('hidden', '');- }- }).catch(alerts.error);- };Flag.rescind = function (flagId) {api.del(`/flags/${flagId}/report`).then(() => {diff --git a/src/controllers/write/flags.js b/src/controllers/write/flags.jsindex 2af5d7e9b4..786159ea62 100644--- a/src/controllers/write/flags.js+++ b/src/controllers/write/flags.js@@ -36,14 +36,6 @@ Flags.rescind = async (req, res) => {await api.flags.rescind(req, { flagId: req.params.flagId });helpers.formatApiResponse(200, res);};-Flags.rescindPost = async (req, res) => {- await api.flags.rescindPost(req, { pid: req.params.pid });- helpers.formatApiResponse(200, res);-};-Flags.rescindUser = async (req, res) => {- await api.flags.rescindUser(req, { uid: req.params.uid });- helpers.formatApiResponse(200, res);-};Flags.appendNote = async (req, res) => {const { note, datetime } = req.body;diff --git a/src/routes/write/flags.js b/src/routes/write/flags.jsindex da0b7abe6c..f30232c5b6 100644--- a/src/routes/write/flags.js+++ b/src/routes/write/flags.js@@ -19,9 +19,6 @@ module.exports = function () {setupApiRoute(router, 'delete', '/:flagId/report', middlewares, controllers.write.flags.rescind);- setupApiRoute(router, 'delete', '/post/:pid/report', middlewares, controllers.write.flags.rescindPost);- setupApiRoute(router, 'delete', '/user/:uid/report', middlewares, controllers.write.flags.rescindUser);-setupApiRoute(router, 'post', '/:flagId/notes', [...middlewares, middleware.assert.flag], controllers.write.flags.appendNote);setupApiRoute(router, 'delete', '/:flagId/notes/:datetime', [...middlewares, middleware.assert.flag], controllers.write.flags.deleteNote);