Skip to content

Commit 0275ba6

Browse files
Naoki Kosakahiyuki2578
authored andcommitted
Use Contact User as Relay, Report, Subscribe. (mastodon#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.
1 parent f6eb0f2 commit 0275ba6

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/models/concerns/account_finder_concern.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def find_remote!(username, domain)
1212
find_remote(username, domain) || raise(ActiveRecord::RecordNotFound)
1313
end
1414

15+
def representative
16+
find_local(Setting.site_contact_username.gsub(/\A@/, '')) || Account.local.find_by(suspended: false)
17+
end
18+
1519
def find_local(username)
1620
find_remote(username, nil)
1721
end

app/models/relay.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def unfollow_activity(activity_id)
6868
end
6969

7070
def some_local_account
71-
@some_local_account ||= Account.local.find_by(suspended: false)
71+
@some_local_account ||= Account.representative
7272
end
7373

7474
def ensure_disabled

app/services/report_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ def payload
5252
end
5353

5454
def some_local_account
55-
@some_local_account ||= Account.local.where(suspended: false).first
55+
@some_local_account ||= Account.representative
5656
end
5757
end

0 commit comments

Comments
 (0)