FIX: Only send membership request to the last 5 active group owners.

This commit is contained in:
Guo Xiang Tan
2017-01-03 15:33:57 +08:00
parent 7ce4bc2e90
commit ad4a96d387
6 changed files with 46 additions and 3 deletions

View File

@ -141,6 +141,16 @@ class GroupsController < ApplicationController
}
end
def owners
group = find_group(:group_id)
owners = group.users.where('group_users.owner')
.order("users.last_seen_at DESC")
.limit(5)
render_serialized(owners, GroupUserSerializer)
end
def add_members
group = Group.find(params[:id])
group.public ? ensure_logged_in : guardian.ensure_can_edit!(group)