A platform for community discussion. Free, open, simple.
FIX: Infinite loading more on groups page.
Guo Xiang Tan9f216ac182d6
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex ae8cb37030d..bf1d0daf760 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -59,9 +59,6 @@ class GroupsController < ApplicationControllertype_filters.delete(:automatic)end- count = groups.count- groups = groups.offset(page * page_size).limit(page_size)-if Group.preloaded_custom_field_names.present?Group.preload_custom_fields(groups, Group.preloaded_custom_field_names)end@@ -76,6 +73,9 @@ class GroupsController < ApplicationControllerowner_group_ids = group_users.where(owner: true).pluck(:group_id)end+ count = groups.count+ groups = groups.offset(page * page_size).limit(page_size)+render_json_dump(groups: serialize_data(groups,BasicGroupSerializer,diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex 30246d76d3e..aa88e21d737 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -128,6 +128,7 @@ describe GroupsController doresponse_body = JSON.parse(response.body)group_ids = response_body["groups"].map { |g| g["id"] }+ expect(response_body["total_rows_groups"]).to eq(expected_group_ids.count)expect(group_ids).to contain_exactly(*expected_group_ids)end