-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Contact User as Relay, Report, Subscribe. #9661
Conversation
a58874f
to
c7c6496
Compare
app/models/relay.rb
Outdated
@@ -68,7 +68,7 @@ def unfollow_activity(activity_id) | |||
end | |||
|
|||
def some_local_account | |||
@some_local_account ||= Account.local.find_by(suspended: false) | |||
@some_local_account ||= Account.find_local(Setting.site_contact_username.gsub(/\A@/, '')) || Account.local.find_by(suspended: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps create Account.representative
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Sorry for many force-pushes, all done.
dda40e0
to
00c4f51
Compare
00c4f51
to
d1e4342
Compare
app/services/subscribe_service.rb
Outdated
@@ -43,7 +43,7 @@ def subscription_params | |||
end | |||
|
|||
def some_local_account | |||
@some_local_account ||= Account.local.where(suspended: false).first | |||
@some_local_account ||= Account.representative || Account.local.where(suspended: false).first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no reason to use Account.representative here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly, that's right.
I'm a little nervous about using some_local_account or Account.representative interchangeably—if we're saying relay subscription confers responsibility in some way, then the silent fallback could be dangerous. Certainly federated reports do confer responsibility. But at the same time, we can't expect that all instances have a contact_username set. I think we should resolve this by having a "server" actor as suggested a couple of times when the relay and federated reports were being developed—the combined usecases of relays and federated reports make this make sense, even if we wouldn't want the complexity for either alone. |
A |
@@ -4,6 +4,10 @@ module AccountFinderConcern | |||
extend ActiveSupport::Concern | |||
|
|||
class_methods do | |||
def representative! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not used anywhere, I do not think it is required.
@@ -12,6 +16,10 @@ def find_remote!(username, domain) | |||
find_remote(username, domain) || raise(ActiveRecord::RecordNotFound) | |||
end | |||
|
|||
def representative | |||
find_local(Setting.site_contact_username.gsub(/\A@/, '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the || Account.local.find_by(suspended: false)
logic should be included here, since it is repeated everywhere this method is called.
I thought too server actor may best way to solve problem, but that may need more time to implement. |
* 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.
Following relay, sending report and subscribing are used user selected by
Account.local.where(suspend: false)
in Mastodon.This method may give responsibility someone who does not know anything.
Use Contact User if set.