그룹 멤버를 내림차순으로 표시하는 직접 링크가 작동하지 않음

  • For listing members in a group, the backend code accepts order and asc parameters to order by a specific field in ascending/descending order. When the asc parameter is present and non-blank, it is the ascending order, otherwise descending.
  • The frontend code of the group members page also seems to be able to parse query parameters and pass to the backend. asc is true by default on the frontend.

When I navigate to this link: https://try.discourse.org/g/trust_level_2?order=added_at&asc=, I expect this to be a direct link to show me TL2 members ordered by Added time in descending order, without having to manually click on the table header to toggle ordering.

However the actual behavior is that: it shows TL2 members ordered by Added time in ascending order, yet with a “chevron-down” icon (suggesting that it should have shown in descending order instead):

Looking at the Network tab in DevTools, the page issued a request of https://try.discourse.org/groups/trust_level_2/members.json?offset=0&order=added_at&asc=false&filter=, instead of https://try.discourse.org/groups/trust_level_2/members.json?offset=0&order=added_at&asc=&filter=.

As all URL parameters are strings, asc=false will be considered as non-blank by the params[:asc] && params[:asc].present? logic, thus returning ascending result. Perhaps the frontend code should convert the Boolean false value of asc to an empty string in the URL parameter?

2개의 좋아요

확인해 주셔서 감사합니다. 여기서 변경된 사항으로 인해 이제 asc=false가 작동합니다.

2개의 좋아요

와, 정말 멋지네요… 최고예요! 감사합니다!

2개의 좋아요