Skip to content
Extraits de code Groupes Projets
Valider fae32634 rédigé par Naoki Kosaka's avatar Naoki Kosaka Validation de Eugen Rochko
Parcourir les fichiers

Use Contact User as Relay, Report, Subscribe. (#9661)

* Use Contact User as Relay, Report, Subscribe.

* Use Account.representative to fetch contact user.

* Use find_local.

* No reason to use Account.representative in subscribe_service.

* Don't required representative!

* Fallback is included in Account.representative method.
parent 45899cfa
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,6 +12,10 @@ module AccountFinderConcern ...@@ -12,6 +12,10 @@ module AccountFinderConcern
find_remote(username, domain) || raise(ActiveRecord::RecordNotFound) find_remote(username, domain) || raise(ActiveRecord::RecordNotFound)
end end
def representative
find_local(Setting.site_contact_username.gsub(/\A@/, '')) || Account.local.find_by(suspended: false)
end
def find_local(username) def find_local(username)
find_remote(username, nil) find_remote(username, nil)
end end
......
...@@ -68,7 +68,7 @@ class Relay < ApplicationRecord ...@@ -68,7 +68,7 @@ class Relay < ApplicationRecord
end end
def some_local_account def some_local_account
@some_local_account ||= Account.local.find_by(suspended: false) @some_local_account ||= Account.representative
end end
def ensure_disabled def ensure_disabled
......
...@@ -52,6 +52,6 @@ class ReportService < BaseService ...@@ -52,6 +52,6 @@ class ReportService < BaseService
end end
def some_local_account def some_local_account
@some_local_account ||= Account.local.where(suspended: false).first @some_local_account ||= Account.representative
end end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter