diff options
author | ThibG <thib@sitedethib.com> | 2019-10-05 18:04:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-05 18:04:36 +0200 |
commit | 3921125e5578fb3871fdcae0e8e8a77179f1ad72 (patch) | |
tree | 997c8ed2e7a6b8152266edc0c37ea8264c59d1ab /app/services | |
parent | 857c67f31b23b9c496e07eda41755ba449a37f17 (diff) | |
parent | bc8543d9af0045fe2175f7e2234da9c77dc55023 (diff) |
Merge pull request #1228 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/app_sign_up_service.rb | 7 | ||||
-rw-r--r-- | app/services/bootstrap_timeline_service.rb | 8 | ||||
-rw-r--r-- | app/services/fetch_link_card_service.rb | 6 | ||||
-rw-r--r-- | app/services/update_account_service.rb | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/app/services/app_sign_up_service.rb b/app/services/app_sign_up_service.rb index 6dee9cd81..c9739c77d 100644 --- a/app/services/app_sign_up_service.rb +++ b/app/services/app_sign_up_service.rb @@ -4,9 +4,10 @@ class AppSignUpService < BaseService def call(app, params) return unless allowed_registrations? - user_params = params.slice(:email, :password, :agreement, :locale) - account_params = params.slice(:username) - user = User.create!(user_params.merge(created_by_application: app, password_confirmation: user_params[:password], account_attributes: account_params)) + user_params = params.slice(:email, :password, :agreement, :locale) + account_params = params.slice(:username) + invite_request_params = { text: params[:reason] } + user = User.create!(user_params.merge(created_by_application: app, password_confirmation: user_params[:password], account_attributes: account_params, invite_request_attributes: invite_request_params)) Doorkeeper::AccessToken.create!(application: app, resource_owner_id: user.id, diff --git a/app/services/bootstrap_timeline_service.rb b/app/services/bootstrap_timeline_service.rb index db2c83e5d..c489601c1 100644 --- a/app/services/bootstrap_timeline_service.rb +++ b/app/services/bootstrap_timeline_service.rb @@ -17,7 +17,11 @@ class BootstrapTimelineService < BaseService def autofollow_bootstrap_timeline_accounts! bootstrap_timeline_accounts.each do |target_account| - FollowService.new.call(@source_account, target_account) + begin + FollowService.new.call(@source_account, target_account) + rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError + nil + end end end @@ -40,7 +44,9 @@ class BootstrapTimelineService < BaseService def local_unlocked_accounts(usernames) Account.local + .without_suspended .where(username: usernames) .where(locked: false) + .where(moved_to_account_id: nil) end end diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index ac5503d46..f0b1169db 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -39,12 +39,6 @@ class FetchLinkCardService < BaseService def process_url @card ||= PreviewCard.new(url: @url) - failed = Request.new(:head, @url).perform do |res| - res.code != 405 && res.code != 501 && (res.code != 200 || res.mime_type != 'text/html') - end - - return if failed - Request.new(:get, @url).perform do |res| if res.code == 200 && res.mime_type == 'text/html' @html = res.body_with_limit diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index ebf24be37..4172d5774 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -21,7 +21,7 @@ class UpdateAccountService < BaseService def authorize_all_follow_requests(account) follow_requests = FollowRequest.where(target_account: account) - follow_requests = follow_requests.select { |req| !req.account.silenced? } + follow_requests = follow_requests.preload(:account).select { |req| !req.account.silenced? } AuthorizeFollowWorker.push_bulk(follow_requests) do |req| [req.account_id, req.target_account_id] end |