diff options
author | ThibG <thib@sitedethib.com> | 2018-05-16 23:10:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 23:10:12 +0200 |
commit | 4bf43e6f3e93643d989a2872763b41505fab2206 (patch) | |
tree | e1b781fe4fae9d02284e5e836338cc598431413f /app/controllers | |
parent | 80aad16e1035a72fec1af56aaac458a35e1f02c5 (diff) | |
parent | 78ac246b877072bb5f94da34d29612fafde3a8ae (diff) |
Merge pull request #486 from ThibG/glitch-soc/merge-upstream
Merge changes from upstream
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/api/v1/accounts/statuses_controller.rb | 16 | ||||
-rw-r--r-- | app/controllers/media_proxy_controller.rb | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index cbcc7ef04..c40155cb5 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -27,19 +27,17 @@ class Api::V1::Accounts::StatusesController < Api::BaseController end def account_statuses - default_statuses.tap do |statuses| - statuses.merge!(only_media_scope) if truthy_param?(:only_media) - statuses.merge!(pinned_scope) if truthy_param?(:pinned) - statuses.merge!(no_replies_scope) if truthy_param?(:exclude_replies) - end - end - - def default_statuses - permitted_account_statuses.paginate_by_max_id( + statuses = truthy_param?(:pinned) ? pinned_scope : permitted_account_statuses + statuses = statuses.paginate_by_max_id( limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id] ) + + statuses.merge!(only_media_scope) if truthy_param?(:only_media) + statuses.merge!(no_replies_scope) if truthy_param?(:exclude_replies) + + statuses end def permitted_account_statuses diff --git a/app/controllers/media_proxy_controller.rb b/app/controllers/media_proxy_controller.rb index 155670837..d820b257e 100644 --- a/app/controllers/media_proxy_controller.rb +++ b/app/controllers/media_proxy_controller.rb @@ -8,6 +8,8 @@ class MediaProxyController < ApplicationController if lock.acquired? @media_attachment = MediaAttachment.remote.find(params[:id]) redownload! if @media_attachment.needs_redownload? && !reject_media? + else + raise Mastodon::RaceConditionError end end |