Updates to groups sorting

• Updates to groups sorting
This commit is contained in:
mgabdev
2020-08-08 13:08:48 -05:00
parent d3aa5ddf4b
commit 4a8cd0b585
8 changed files with 47 additions and 6 deletions

View File

@@ -12,7 +12,8 @@ class Api::V1::GroupsController < Api::BaseController
def index
case current_tab
when 'featured'
@groups = Group.where(is_featured: true, is_archived: false).limit(100).all
@groupIds = FetchGroupsService.new.call("featured")
@groups = Group.where(id: @groupIds).limit(150).all
when 'new'
if !current_user
render json: { error: 'This method requires an authenticated user' }, status: 422

View File

@@ -62,7 +62,7 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController
@groupIds = []
if @collection_type == 'featured'
@groupIds = Group.where(is_featured: true, is_archived: false).limit(100).all.pluck(:id)
@groupIds = FetchGroupsService.new.call("featured")
elsif @collection_type == 'member' && !current_user.nil?
@groupIds = current_user.account.groups.pluck(:id)
else