mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: #8695, allow sort for guests
This commit is contained in:
@@ -13,15 +13,24 @@ define('sort', ['components'], function (components) {
|
||||
$('body')
|
||||
.off('click', '[component="thread/sort"] a')
|
||||
.on('click', '[component="thread/sort"] a', function () {
|
||||
var newSetting = $(this).attr('data-sort');
|
||||
socket.emit(method, newSetting, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
function refresh(newSetting, params) {
|
||||
config[field] = newSetting;
|
||||
var qs = decodeURIComponent($.param(utils.params()));
|
||||
var qs = decodeURIComponent($.param(params));
|
||||
ajaxify.go(gotoOnSave + (qs ? '?' + qs : ''));
|
||||
});
|
||||
}
|
||||
var newSetting = $(this).attr('data-sort');
|
||||
if (app.user.uid) {
|
||||
socket.emit(method, newSetting, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
refresh(newSetting, utils.params());
|
||||
});
|
||||
} else {
|
||||
var urlParams = utils.params();
|
||||
urlParams.sort = newSetting;
|
||||
refresh(newSetting, urlParams);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user