This commit is contained in:
mgabdev
2020-05-09 23:57:38 -04:00
parent 2c9030f3a3
commit bb0182c1e1
9 changed files with 15 additions and 27 deletions

View File

@@ -16,7 +16,7 @@ class Api::V1::GroupsController < Api::BaseController
when 'new'
@groups = Group.where(is_archived: false).limit(24).order('created_at DESC').all
when 'member'
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).order('group_accounts.unread_count DESC, group_accounts.id DESC').all
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).order('group_accounts.id DESC').all
when 'admin'
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account, role: :admin }).all
end

View File

@@ -9,8 +9,6 @@ class Api::V1::Timelines::GroupController < Api::BaseController
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
def show
mark_as_unread
render json: @statuses,
each_serializer: REST::StatusSerializer,
relationships: StatusRelationshipsPresenter.new(@statuses, current_user.account_id)
@@ -18,10 +16,6 @@ class Api::V1::Timelines::GroupController < Api::BaseController
private
def mark_as_unread
GroupAccount.where(group: @group, account: current_account).update_all("unread_count = 0")
end
def set_group
@group = Group.find(params[:id])
end