New groups
This commit is contained in:
@@ -9,7 +9,7 @@ class Api::V1::Groups::AccountsController < Api::BaseController
|
||||
before_action :require_user!
|
||||
before_action :set_group
|
||||
|
||||
after_action :insert_pagination_headers, only: :index
|
||||
after_action :insert_pagination_headers, only: :show
|
||||
|
||||
def show
|
||||
@accounts = load_accounts
|
||||
|
||||
@@ -10,10 +10,24 @@ class Api::V1::GroupsController < Api::BaseController
|
||||
before_action :set_group, except: [:index, :create]
|
||||
|
||||
def index
|
||||
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).all
|
||||
case current_tab
|
||||
when 'featured'
|
||||
@groups = Group.where(is_featured: true).limit(25).all
|
||||
when 'member'
|
||||
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).all
|
||||
when 'admin'
|
||||
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account, write_permissions: true }).all
|
||||
end
|
||||
|
||||
render json: @groups, each_serializer: REST::GroupSerializer
|
||||
end
|
||||
|
||||
def current_tab
|
||||
tab = 'featured'
|
||||
tab = params[:tab] if ['featured', 'member', 'admin'].include? params[:tab]
|
||||
return tab
|
||||
end
|
||||
|
||||
def show
|
||||
render json: @group, serializer: REST::GroupSerializer
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ class Api::V1::Timelines::GroupController < Api::BaseController
|
||||
end
|
||||
|
||||
def group_statuses
|
||||
statuses = tag_timeline_statuses.paginate_by_id(
|
||||
statuses = group_timeline_statuses.paginate_by_id(
|
||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
||||
params_slice(:max_id, :since_id, :min_id)
|
||||
)
|
||||
@@ -43,7 +43,7 @@ class Api::V1::Timelines::GroupController < Api::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def group_statuses
|
||||
def group_timeline_statuses
|
||||
GroupQueryService.new.call(@group)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user