about summary refs log tree commit diff
path: root/app/services/resolve_url_service.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-11-21 10:01:26 +0100
committerGitHub <noreply@github.com>2019-11-21 10:01:26 +0100
commit55f5e81a9dc4c6cede5d43e549061be2ea9be614 (patch)
tree6b8944b2bf8e13ba76627a0e38886dfb3b35c566 /app/services/resolve_url_service.rb
parent707c4918b21d19dd53b64120dbc7263f45fc5ecd (diff)
parente87cc59811fab285033cc78d97ad7f0b8df9c081 (diff)
Merge pull request #1246 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services/resolve_url_service.rb')
-rw-r--r--app/services/resolve_url_service.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/resolve_url_service.rb b/app/services/resolve_url_service.rb
index aa883597a..4e971a4b8 100644
--- a/app/services/resolve_url_service.rb
+++ b/app/services/resolve_url_service.rb
@@ -24,6 +24,12 @@ class ResolveURLService < BaseService
       status = FetchRemoteStatusService.new.call(resource_url, body, protocol)
       authorize_with @on_behalf_of, status, :show? unless status.nil?
       status
+    elsif fetched_resource.nil? && @on_behalf_of.present?
+      # 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.
+      status = Status.find_by(uri: @url) || Status.find_by(url: @url)
+      authorize_with @on_behalf_of, status, :show? unless status.nil?
+      status
     end
   end