Skip to content

Commit

Permalink
WIP WIP WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
naaaaaaaaaaaf committed Oct 2, 2023
1 parent a4cb224 commit b63f84e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
8 changes: 6 additions & 2 deletions app/controllers/api/v1/accounts/statuses_controller.rb
Expand Up @@ -9,8 +9,12 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
def index
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
end
account_ids = @statuses.filter(&:quote?).map { |status| status.quote.account_id }.uniq

render json: @statuses,
each_serializer: REST::StatusSerializer,
relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id),
account_relationships: AccountRelationshipsPresenter.new(account_ids, current_user&.account_id) end

Check failure on line 17 in app/controllers/api/v1/accounts/statuses_controller.rb

View workflow job for this annotation

GitHub Actions / lint

[Correctable] Layout/ExtraSpacing: Unnecessary spacing detected.

Check failure on line 17 in app/controllers/api/v1/accounts/statuses_controller.rb

View workflow job for this annotation

GitHub Actions / lint

[Correctable] Style/TrailingMethodEndStatement: Place the end statement of a multi-line method on its own line.

private

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/api/v1/timelines/home_controller.rb
Expand Up @@ -7,13 +7,15 @@ class Api::V1::Timelines::HomeController < Api::BaseController

def show
with_read_replica do
@statuses = load_statuses
@statuses = load_statuses
account_ids = @statuses.filter(&:quote?).map { |status| status.quote.account_id }.uniq

Check warning on line 11 in app/controllers/api/v1/timelines/home_controller.rb

View workflow job for this annotation

GitHub Actions / lint

[Correctable] Lint/UselessAssignment: Useless assignment to variable - account_ids. (https://rubystyle.guide#underscore-unused-vars)
@relationships = StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
end

render json: @statuses,
each_serializer: REST::StatusSerializer,
relationships: @relationships,
account_relationships: AccountRelationshipsPresenter.new(account_ids, current_user&.account_id),
status: account_home_feed.regenerating? ? 206 : 200
end

Expand Down
9 changes: 7 additions & 2 deletions app/controllers/api/v1/timelines/public_controller.rb
Expand Up @@ -6,8 +6,13 @@ class Api::V1::Timelines::PublicController < Api::BaseController

def show
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
@statuses = load_statuses
account_ids = @statuses.filter(&:quote?).map { |status| status.quote.account_id }.uniq

render json: @statuses,
each_serializer: REST::StatusSerializer,
relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id),
account_relationships: AccountRelationshipsPresenter.new(account_ids, current_user&.account_id)
end

private
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/api/v1/timelines/tag_controller.rb
Expand Up @@ -6,8 +6,12 @@ class Api::V1::Timelines::TagController < Api::BaseController

def show
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
@statuses = load_statuses
account_ids = @statuses.filter(&:quote?).map { |status| status.quote.account_id }.uniq

render json: @statuses, each_serializer: REST::StatusSerializer,
relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id),
account_relationships: AccountRelationshipsPresenter.new(account_ids, current_user&.account_id)
end

private
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/has_user_settings.rb
Expand Up @@ -99,6 +99,10 @@ def setting_always_send_emails
settings['always_send_emails']
end

def setting_show_quote_button
settings['show_quote_button']
end

def setting_default_privacy
settings['default_privacy'] || (account.locked? ? 'private' : 'public')
end
Expand Down

0 comments on commit b63f84e

Please sign in to comment.