diff options
Diffstat (limited to 'app/services/resolve_url_service.rb')
-rw-r--r-- | app/services/resolve_url_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/resolve_url_service.rb b/app/services/resolve_url_service.rb index 2b10ac1e0..5981e4d98 100644 --- a/app/services/resolve_url_service.rb +++ b/app/services/resolve_url_service.rb @@ -34,16 +34,16 @@ class ResolveURLService < BaseService # It may happen that the resource is a private toot, and thus not fetchable, # but we can return the toot if we already know about it. - uris = [@url] + scope = Status.where(uri: @url) # We don't have an index on `url`, so try guessing the `uri` from `url` parsed_url = Addressable::URI.parse(@url) parsed_url.path.match(%r{/@(?<username>#{Account::USERNAME_RE})/(?<status_id>[0-9]+)\Z}) do |matched| parsed_url.path = "/users/#{matched[:username]}/statuses/#{matched[:status_id]}" - uris << parsed_url.to_s + scope = scope.or(Status.where(uri: parsed_url.to_s, url: @url)) end - status = Status.find_by(uri: uris) + status = scope.first authorize_with @on_behalf_of, status, :show? unless status.nil? status |