UX: Tweaks to group pages.

This commit is contained in:
Guo Xiang Tan
2018-03-29 14:57:10 +08:00
parent 27f06505b1
commit 52e75eaee9
29 changed files with 468 additions and 253 deletions

View File

@ -109,7 +109,18 @@ class GroupsController < ApplicationController
end
format.json do
render_serialized(group, GroupShowSerializer, root: 'basic_group')
groups = Group.visible_groups(current_user)
if !guardian.is_staff?
groups = groups.where(automatic: false)
end
render_json_dump(
group: serialize_data(group, GroupShowSerializer, root: nil),
extras: {
visible_group_names: groups.pluck(:name)
}
)
end
end
end
@ -436,7 +447,8 @@ class GroupsController < ApplicationController
def find_group(param_name)
name = params.require(param_name)
group = Group.find_by("lower(name) = ?", name.downcase)
group = Group
group = group.find_by("lower(name) = ?", name.downcase)
guardian.ensure_can_see!(group)
group
end