Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
e4d75f23
Commit
e4d75f23
authored
5 years ago
by
ThibG
Committed by
Eugen Rochko
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix URL search not returning private toots user has access to (#12742)
parent
6a8c8dc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/resolve_url_service.rb
+12
-6
12 additions, 6 deletions
app/services/resolve_url_service.rb
with
12 additions
and
6 deletions
app/services/resolve_url_service.rb
+
12
−
6
View file @
e4d75f23
...
...
@@ -12,6 +12,8 @@ class ResolveURLService < BaseService
process_local_url
elsif
!
fetched_resource
.
nil?
process_url
elsif
@on_behalf_of
.
present?
process_url_from_db
end
end
...
...
@@ -24,15 +26,19 @@ class ResolveURLService < BaseService
status
=
FetchRemoteStatusService
.
new
.
call
(
resource_url
,
body
)
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
def
process_url_from_db
# 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
rescue
Mastodon
::
NotPermittedError
nil
end
def
fetched_resource
@fetched_resource
||=
FetchResourceService
.
new
.
call
(
@url
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment