Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
	app/models/status.rb
	db/migrate/20180528141303_fix_accounts_unique_index.rb
	db/schema.rb

Resolved by taking upstream changes (no real conflicts, just glitch-soc
specific code too close to actual changes).
This commit is contained in:
Thibaut Girka
2018-08-17 17:43:54 +02:00
43 changed files with 353 additions and 91 deletions

View File

@@ -3,7 +3,7 @@
class AuthorizeFollowService < BaseService
def call(source_account, target_account, **options)
if options[:skip_follow_request]
follow_request = FollowRequest.new(account: source_account, target_account: target_account)
follow_request = FollowRequest.new(account: source_account, target_account: target_account, uri: options[:follow_request_uri])
else
follow_request = FollowRequest.find_by!(account: source_account, target_account: target_account)
follow_request.authorize!

View File

@@ -2,11 +2,13 @@
class ResolveURLService < BaseService
include JsonLdHelper
include Authorization
attr_reader :url
def call(url)
def call(url, on_behalf_of: nil)
@url = url
@on_behalf_of = on_behalf_of
return process_local_url if local_url?
@@ -84,6 +86,10 @@ class ResolveURLService < BaseService
def check_local_status(status)
return if status.nil?
status if status.public_visibility? || status.unlisted_visibility?
authorize_with @on_behalf_of, status, :show?
status
rescue Mastodon::NotPermittedError
# Do not disclose the existence of status the user is not authorized to see
nil
end
end

View File

@@ -53,7 +53,7 @@ class SearchService < BaseService
end
def url_resource
@_url_resource ||= ResolveURLService.new.call(query)
@_url_resource ||= ResolveURLService.new.call(query, on_behalf_of: @account)
end
def url_resource_symbol