FIX: Infinite loading broken on group members list (#23214)

This regressed in 5a9924362906040e5511a72e66bf946c2554080e where
the condition to load more members into the list on the client side was
inverted.
This commit is contained in:
Alan Guo Xiang Tan
2023-08-24 08:50:20 +08:00
committed by GitHub
parent 7c12f7d50a
commit 8d72a51ae1
3 changed files with 20 additions and 3 deletions

View File

@ -230,14 +230,15 @@ class GroupsController < ApplicationController
render "posts/latest", formats: [:rss]
end
MEMBERS_LIMIT = 1_000
MEMBERS_MAX_PAGE_SIZE = 1_000
MEMBERS_DEFAULT_PAGE_SIZE = 50
def members
group = find_group(:group_id)
guardian.ensure_can_see_group_members!(group)
limit = fetch_limit_from_params(default: 50, max: MEMBERS_LIMIT)
limit = fetch_limit_from_params(default: MEMBERS_DEFAULT_PAGE_SIZE, max: MEMBERS_MAX_PAGE_SIZE)
offset = params[:offset].to_i
raise Discourse::InvalidParameters.new(:offset) if offset < 0