From 70415714f14e067aba518a105c96475db31fa124 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 15 Dec 2022 18:50:11 +0100 Subject: Add follow request banner on account header (#20785) * Add requested_by to relationship maps * Display whether an account has requested to follow you on their profile --- app/models/concerns/account_interactions.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models/concerns') diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb index 15c49f2fe..de8bf338f 100644 --- a/app/models/concerns/account_interactions.rb +++ b/app/models/concerns/account_interactions.rb @@ -44,6 +44,10 @@ module AccountInteractions end end + def requested_by_map(target_account_ids, account_id) + follow_mapping(FollowRequest.where(account_id: target_account_ids, target_account_id: account_id), :account_id) + end + def endorsed_map(target_account_ids, account_id) follow_mapping(AccountPin.where(account_id: account_id, target_account_id: target_account_ids), :target_account_id) end -- cgit From ff70e5019910c309f8ab38d729c4eb5819512698 Mon Sep 17 00:00:00 2001 From: David Freedman Date: Fri, 13 Jan 2023 15:40:06 +0000 Subject: Don't crash on unobtainable avatars (#22462) --- app/models/concerns/omniauthable.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/models/concerns') diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb index a90d5d888..feac0a1f5 100644 --- a/app/models/concerns/omniauthable.rb +++ b/app/models/concerns/omniauthable.rb @@ -55,7 +55,14 @@ module Omniauthable user = User.new(user_params_from_auth(email, auth)) - user.account.avatar_remote_url = auth.info.image if /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/.match?(auth.info.image) + begin + if /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/.match?(auth.info.image) + user.account.avatar_remote_url = auth.info.image + end + rescue Mastodon::UnexpectedResponseError + user.account.avatar_remote_url = nil + end + user.skip_confirmation! if email_is_verified user.save! user -- cgit