mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
FIX: Handle empty directory columns in /u route (#22747)
The `/u` route was broken when there were no directory columns because its order parameter relied on the first column's name. This commit adds a `likes_received` as the default order when there are no columns, which results in a list of users being output without any additional columns. For this very edge case, that's better than a JS error.
This commit is contained in:
parent
00903f6b11
commit
4e5756e3ae
@ -42,7 +42,10 @@ export default DiscourseRoute.extend({
|
||||
model(params) {
|
||||
return ajax("/directory-columns.json")
|
||||
.then((response) => {
|
||||
params.order = params.order || response.directory_columns[0].name;
|
||||
params.order =
|
||||
params.order ||
|
||||
response.directory_columns[0]?.name ||
|
||||
"likes_received";
|
||||
return { params, columns: response.directory_columns };
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
|
Loading…
Reference in New Issue
Block a user