From 983ab40086da909f2c693b74ed36735aab40dbcb Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 22 Feb 2020 01:26:41 +0100 Subject: Fix previously OStatus-based accounts not being detected as ActivityPub (#13129) --- app/services/resolve_account_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/services') diff --git a/app/services/resolve_account_service.rb b/app/services/resolve_account_service.rb index 12e6544a0..1ad9ed407 100644 --- a/app/services/resolve_account_service.rb +++ b/app/services/resolve_account_service.rb @@ -99,7 +99,7 @@ class ResolveAccountService < BaseService if lock.acquired? @account = Account.find_remote(@username, @domain) - next if (@account.present? && !@account.activitypub?) || actor_json.nil? + next if actor_json.nil? @account = ActivityPub::ProcessAccountService.new.call(@username, @domain, actor_json) else -- cgit From 3704402dcce6775c32350d09cd3dc7d2ba95105a Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 24 Feb 2020 21:15:53 +0100 Subject: Fix duplicate accounts being created when fetching an account for its key only (#13147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #13136 When a user's canonical acct domain is different from its id's domain (WEB_DOMAIN ≠ LOCAL_DOMAIN), two webfinger queries are required to find the canonical domain from the URI. However, we skip webfinger queries when updating only the key of a remote user, which led to the creation of a duplicate account, using the URI's domain instead of the canonical acct: one. --- app/services/activitypub/process_account_service.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/services') diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index cef658e19..d5ede0388 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -18,9 +18,10 @@ class ActivityPub::ProcessAccountService < BaseService RedisLock.acquire(lock_options) do |lock| if lock.acquired? - @account = Account.find_remote(@username, @domain) - @old_public_key = @account&.public_key - @old_protocol = @account&.protocol + @account = Account.remote.find_by(uri: @uri) if @options[:only_key] + @account ||= Account.find_remote(@username, @domain) + @old_public_key = @account&.public_key + @old_protocol = @account&.protocol create_account if @account.nil? update_account -- cgit From d91946ae134f84889f26a08987cb75abeab62742 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 24 Feb 2020 21:18:26 +0100 Subject: Fix backups failing when files are missing from media attachments (#13146) Fixes #13123 --- app/services/backup_service.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/services') diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index d1090dff1..896699324 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -66,6 +66,8 @@ class BackupService < BaseService def dump_media_attachments!(tar) MediaAttachment.attached.where(account: account).reorder(nil).find_in_batches do |media_attachments| media_attachments.each do |m| + next unless m.file&.path + download_to_tar(tar, m.file, m.file.path) end -- cgit From cf4fe6caefc45e18c82d619933a9b5f662503aa4 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 24 Feb 2020 21:19:19 +0100 Subject: Fix misleading error when attempting to re-send a pending follow request (#13133) Fixes #13131 --- app/services/follow_service.rb | 5 ++--- app/views/authorize_interactions/show.html.haml | 6 ++++++ config/locales/en.yml | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'app/services') diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index dc47804c0..4d19002c4 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -18,14 +18,13 @@ class FollowService < BaseService if source_account.following?(target_account) # We're already following this account, but we'll call follow! again to # make sure the reblogs status is set correctly. - source_account.follow!(target_account, reblogs: reblogs) - return + return source_account.follow!(target_account, reblogs: reblogs) elsif source_account.requested?(target_account) # This isn't managed by a method in AccountInteractions, so we modify it # ourselves if necessary. req = source_account.follow_requests.find_by(target_account: target_account) req.update!(show_reblogs: reblogs) - return + return req end ActivityTracker.increment('activity:interactions') diff --git a/app/views/authorize_interactions/show.html.haml b/app/views/authorize_interactions/show.html.haml index 7ca9b98c1..42c874134 100644 --- a/app/views/authorize_interactions/show.html.haml +++ b/app/views/authorize_interactions/show.html.haml @@ -10,6 +10,12 @@ %strong = t('authorize_follow.already_following') + = render 'post_follow_actions' + - elsif current_account.requested?(@resource) + .flash-message + %strong + = t('authorize_follow.already_requested') + = render 'post_follow_actions' - else = form_tag authorize_interaction_path, method: :post, class: 'simple_form' do diff --git a/config/locales/en.yml b/config/locales/en.yml index 027b73d9d..1d2580101 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -661,6 +661,7 @@ en: trouble_logging_in: Trouble logging in? authorize_follow: already_following: You are already following this account + already_requested: You have already sent a follow request to that account error: Unfortunately, there was an error looking up the remote account follow: Follow follow_request: 'You have sent a follow request to:' -- cgit