Procházet zdrojové kódy

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.
master
Naoki Kosaka před 5 roky
committed by Eugen Rochko
rodič
revize
fae32634b1
3 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. +4
    -0
      app/models/concerns/account_finder_concern.rb
  2. +1
    -1
      app/models/relay.rb
  3. +1
    -1
      app/services/report_service.rb

+ 4
- 0
app/models/concerns/account_finder_concern.rb Zobrazit soubor

@@ -12,6 +12,10 @@ module AccountFinderConcern
find_remote(username, domain) || raise(ActiveRecord::RecordNotFound)
end

def representative
find_local(Setting.site_contact_username.gsub(/\A@/, '')) || Account.local.find_by(suspended: false)
end

def find_local(username)
find_remote(username, nil)
end


+ 1
- 1
app/models/relay.rb Zobrazit soubor

@@ -68,7 +68,7 @@ class Relay < ApplicationRecord
end

def some_local_account
@some_local_account ||= Account.local.find_by(suspended: false)
@some_local_account ||= Account.representative
end

def ensure_disabled


+ 1
- 1
app/services/report_service.rb Zobrazit soubor

@@ -52,6 +52,6 @@ class ReportService < BaseService
end

def some_local_account
@some_local_account ||= Account.local.where(suspended: false).first
@some_local_account ||= Account.representative
end
end

Načítá se…
Zrušit
Uložit