FIX: Incorrect serializer for groups page.

This commit is contained in:
Guo Xiang Tan 2016-12-20 15:44:22 +08:00
parent 7c7c233c1c
commit 9db5d5b6a7
4 changed files with 16 additions and 5 deletions

View File

@ -13,10 +13,18 @@
disabled=updatingMembership}}
{{/if}}
{{else if canRequestMembership}}
{{d-button action="requestMembership"
class="group-index-request"
icon="envelope"
label="groups.request"}}
{{#if model.is_group_user}}
{{d-button
class="btn-primary"
icon="user"
label="groups.is_group_user"
disabled=model.is_group_user}}
{{else}}
{{d-button action="requestMembership"
class="group-index-request"
icon="envelope"
label="groups.request"}}
{{/if}}
{{else}}
{{yield}}
{{/if}}

View File

@ -24,7 +24,7 @@ class GroupsController < ApplicationController
groups = groups.offset(page * page_size).limit(page_size)
render json: {
groups: serialize_data(groups, BasicGroupSerializer),
groups: serialize_data(groups, GroupShowSerializer),
total_rows_groups: count,
load_more_groups: groups_path(page: page + 1)
}

View File

@ -417,6 +417,7 @@ en:
request: "Request to Join Group"
automatic_group: Automatic Group
closed_group: Closed Group
is_group_user: "You are a member of this group"
allow_membership_requests: "Allow users to send membership requests to group owners (Requires everyone to be able to mention the group)"
membership: "Membership"
name: "Name"

View File

@ -23,6 +23,7 @@ describe "Groups" do
group_ids = response_body["groups"].map { |g| g["id"] }
expect(response_body["groups"].map { |g| g['is_group_user'] }).to eq([nil])
expect(group_ids).to include(other_group.id)
expect(group_ids).to_not include(group.id)
expect(response_body["load_more_groups"]).to eq("/groups?page=1")
@ -41,6 +42,7 @@ describe "Groups" do
group_ids = response_body["groups"].map { |g| g["id"] }
expect(response_body["groups"].first['is_group_user']).to eq(false)
expect(group_ids).to include(group.id, other_group.id)
expect(response_body["load_more_groups"]).to eq("/groups?page=1")
expect(response_body["total_rows_groups"]).to eq(10)