From 9082062e90b05bca4b328834c5b71cf22f58d252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 28 Oct 2020 16:05:40 -0400 Subject: [PATCH] fix: sort setting not using correct field name --- public/src/client/category.js | 2 +- public/src/client/topic.js | 2 +- public/src/modules/sort.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/src/client/category.js b/public/src/client/category.js index 5a9c27a338c6..bf6b5da4f72c 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -24,7 +24,7 @@ define('forum/category', [ topicList.init('category', loadTopicsAfter); - sort.handleSort('categoryTopicSort', 'setCategorySort', 'category/' + ajaxify.data.slug); + sort.handleSort('categoryTopicSort', 'category/' + ajaxify.data.slug); if (!config.usePagination) { navigator.init('[component="category/topic"]', ajaxify.data.topic_count, Category.toTop, Category.toBottom, Category.navigatorCallback); diff --git a/public/src/client/topic.js b/public/src/client/topic.js index df49490c64a1..b193b8cc9e89 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -49,7 +49,7 @@ define('forum/topic', [ threadTools.init(tid, $('.topic')); events.init(); - sort.handleSort('topicPostSort', 'setTopicSort', 'topic/' + ajaxify.data.slug); + sort.handleSort('topicPostSort', 'topic/' + ajaxify.data.slug); if (!config.usePagination) { infinitescroll.init($('[component="topic"]'), posts.loadMorePosts); diff --git a/public/src/modules/sort.js b/public/src/modules/sort.js index 9d718788442e..c4dda1e5e329 100644 --- a/public/src/modules/sort.js +++ b/public/src/modules/sort.js @@ -4,7 +4,7 @@ define('sort', ['components', 'api'], function (components, api) { var module = {}; - module.handleSort = function (field, key, gotoOnSave) { + module.handleSort = function (field, gotoOnSave) { var threadSort = components.get('thread/sort'); threadSort.find('i').removeClass('fa-check'); var currentSetting = threadSort.find('a[data-sort="' + config[field] + '"]'); @@ -20,7 +20,7 @@ define('sort', ['components', 'api'], function (components, api) { } var newSetting = $(this).attr('data-sort'); if (app.user.uid) { - api.put(`/users/${app.user.uid}/settings/${key}`, { + api.put(`/users/${app.user.uid}/settings/${field}`, { value: newSetting, }).then(() => { refresh(newSetting, utils.params());