-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Make autofollow_on_join_user
configuration a list
#8430
base: develop
Are you sure you want to change the base?
Changes from 7 commits
5930d75
39ee7f7
5cc3e58
02383ef
24ebe36
16f699b
38e13f6
25ae7a9
8208518
7d8ee57
dafaf7e
9593831
b700add
a80e2e8
a2df942
4d97cbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -442,28 +442,39 @@ def self.diaspora_id_host | |||||
end | ||||||
|
||||||
def seed_aspects | ||||||
self.aspects.create(:name => I18n.t('aspects.seed.family')) | ||||||
self.aspects.create(:name => I18n.t('aspects.seed.friends')) | ||||||
self.aspects.create(:name => I18n.t('aspects.seed.work')) | ||||||
aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances')) | ||||||
|
||||||
if AppConfig.settings.autofollow_on_join? | ||||||
begin | ||||||
default_account = Person.find_or_fetch_by_identifier(AppConfig.settings.autofollow_on_join_user) | ||||||
share_with(default_account, aq) | ||||||
rescue DiasporaFederation::Discovery::DiscoveryError | ||||||
logger.warn "Error auto-sharing with #{AppConfig.settings.autofollow_on_join_user} | ||||||
aspects.create(name: I18n.t("aspects.seed.family")) | ||||||
aspects.create(name: I18n.t("aspects.seed.friends")) | ||||||
aspects.create(name: I18n.t("aspects.seed.work")) | ||||||
acquaintances = aspects.create(name: I18n.t("aspects.seed.acquaintances")) | ||||||
|
||||||
acquaintances.tap do |aq| | ||||||
if AppConfig.settings.autofollow_on_join? | ||||||
autofollow_user = AppConfig.settings.autofollow_on_join_user | ||||||
autofollow_accounts = Array.wrap(AppConfig.settings.autofollow_on_join_accounts) | ||||||
autofollow_accounts.push(autofollow_user) if autofollow_user.present? | ||||||
|
||||||
begin | ||||||
autofollow_accounts.uniq.each { |user_id| follow_account(user_id, aq) } if autofollow_accounts.present? | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved here: 25ae7a9. |
||||||
rescue DiasporaFederation::Discovery::DiscoveryError | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we fold the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved here: 25ae7a9. |
||||||
logger.warn "Error auto-sharing with #{AppConfig.settings.autofollow_on_join_user} | ||||||
fix autofollow_on_join_user in configuration." | ||||||
end | ||||||
end | ||||||
end | ||||||
aq | ||||||
end | ||||||
|
||||||
def follow_account(account_id, aq) | ||||||
abrahamparayil marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
account = Person.find_or_fetch_by_identifier(account_id) | ||||||
share_with(account, aq) | ||||||
end | ||||||
|
||||||
def send_welcome_message | ||||||
return unless AppConfig.settings.welcome_message.enabled? && AppConfig.admins.account? | ||||||
|
||||||
sender_username = AppConfig.admins.account.get | ||||||
sender = User.find_by(username: sender_username) | ||||||
return if sender.nil? | ||||||
|
||||||
conversation = sender.build_conversation( | ||||||
participant_ids: [sender.person.id, person.id], | ||||||
subject: AppConfig.settings.welcome_message.subject.get, | ||||||
|
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'm not sure if just adding the old
autofollow_on_join_user
to the new default value ofautofollow_on_join_accounts
is the correct thing to do. For podmins who didn't configure anything, nothing chnages, but podmins who manually set another account, it silently adds the HQ-account to the list (as it's the default value for the new setting), until they manually migrate their config to the newautofollow_on_join_accounts
and decide if they want to include the HQ-account now (in addition to their account), or if they still want to keep it with only one account.My expectations would have been, that if the old
autofollow_on_join_user
is set, it still behaves as it was before, so just following that one user. And only if the newautofollow_on_join_accounts
is the only option used, it follows multiple users.But maybe the behavior is fine, as this will be released in a major version with a big changelog entry, so we can expect podmins to read that and react accordingly if they don't want the HQ-Account to be added by default? 🤔
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'm fine with breaking things in major releases. It's not our fault if people don't read changelogs, and in this case, this seems like a worthy change.