Skip to content

Commit

Permalink
Re-configured routing of endorse so that 'delete' request should be h…
Browse files Browse the repository at this point in the history
…andled correctly.
  • Loading branch information
顾越鹏 authored and 顾越鹏 committed Oct 9, 2024
1 parent 755fcdf commit 17c67f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Binary file modified dump.rdb
Binary file not shown.
3 changes: 2 additions & 1 deletion public/src/client/topic/threadTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define('forum/topic/threadTools', [
});

topicContainer.on('click', '[component="topic/unendorse"]', function () {
topicCommand('del', '/unendorse', 'unendorse');
topicCommand('del', '/endorse', 'unendorse');
return false;
});

Expand Down Expand Up @@ -347,6 +347,7 @@ define('forum/topic/threadTools', [
components.get('topic/endorse').toggleClass('hidden', data.isEndorsed).parent().attr('hidden', data.isEndorsed ? '' : null);
components.get('topic/unendorse').toggleClass('hidden', !data.isEndorsed).parent().attr('hidden', !data.isEndorsed ? '' : null);

$('[component="topic/labels"] [component="topic/locked"]').toggleClass('hidden', !data.isLocked);
$('[component="topic/endorsed"]').toggleClass('hidden', !data.isEndorsed);

ajaxify.data.endorsed = data.isEndorsed;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/write/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = function () {
// Comment @YG
// Configured routes for 'endorse' button on the topic drop-down menu.
setupApiRoute(router, 'put', '/:tid/endorse', [...middlewares], controllers.write.topics.endorse);
setupApiRoute(router, 'delete', '/:tid/unendorse', [...middlewares], controllers.write.topics.unendorse);
setupApiRoute(router, 'delete', '/:tid/endorse', [...middlewares], controllers.write.topics.unendorse);

setupApiRoute(router, 'put', '/:tid/follow', [...middlewares, middleware.assert.topic], controllers.write.topics.follow);
setupApiRoute(router, 'delete', '/:tid/follow', [...middlewares, middleware.assert.topic], controllers.write.topics.unfollow);
Expand Down

0 comments on commit 17c67f9

Please sign in to comment.