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