FEATURE: add support for group visibility level

There are 4 visibility levels

- public (default)
- members only
- staff
- owners

Note, admins and group owners ALWAYS have visibility to groups

Migration treated old "non public" as "members only"
This commit is contained in:
Sam
2017-07-03 15:26:46 -04:00
parent c79418d334
commit 845170bd6b
17 changed files with 248 additions and 117 deletions

View File

@@ -20,6 +20,12 @@ class GroupsController < ApplicationController
page = params[:page]&.to_i || 0
groups = Group.visible_groups(current_user)
unless guardian.is_staff?
# hide automatic groups from all non stuff to de-clutter page
groups = groups.where(automatic: false)
end
count = groups.count
groups = groups.offset(page * page_size).limit(page_size)