Skip to content
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

Change auto-following admin-selected accounts, show in recommendations #16078

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Apr 20, 2021

Instead of making new users automatically follow accounts specified in admin settings, show them at the top of follow recommendations. Also, allow picking remote accounts instead of limiting them to local only.

The "Enable default follows for new users" setting has been removed. "Default follows for new users" has been renamed to "Recommend these accounts to new users", and it no longer defaults to all admin accounts.

@Gargron Gargron force-pushed the fix-change-autofollow branch 3 times, most recently from 009e151 to 6169d8e Compare April 20, 2021 02:08
@Gargron
Copy link
Member Author

Gargron commented Apr 20, 2021

Note: CI fails because other translations have not been updated with the new variable in the setting description.

app/models/account_suggestions.rb Outdated Show resolved Hide resolved
app/views/admin/settings/edit.html.haml Outdated Show resolved Hide resolved
Comment on lines +7 to +25
usernames_and_domains = begin
value.split(',').map do |str|
username, domain = str.strip.gsub(/\A@/, '').split('@')
domain = nil if TagManager.instance.local_domain?(domain)

next if username.blank?

[str, username, domain]
end.compact
end

usernames_with_no_accounts = usernames_and_domains.filter_map do |(str, username, domain)|
str unless Account.find_remote(username, domain)
end

if usernames_with_no_accounts.any? && options[:multiple]
record.errors.add(attribute, I18n.t('existing_username_validator.not_found_multiple', usernames: usernames_with_no_accounts.join(', ')))
elsif usernames_with_no_accounts.any? || usernames_and_domains.size > 1
record.errors.add(attribute, I18n.t('existing_username_validator.not_found'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the scope of this validator from local accounts only to any known account, which kind of makes sense for recommendations but less so for site_contact_username which also uses this validator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Counter-point: On mastodon.online, I might as well just point to my mastodon.social account in that field

Not sure if there's any true benefit to enforcing locality in this validator.

@Gargron Gargron force-pushed the fix-change-autofollow branch from 6169d8e to 0fa49f3 Compare April 24, 2021 02:09
@Gargron Gargron force-pushed the fix-change-autofollow branch from 0fa49f3 to 90c5b84 Compare April 24, 2021 02:15
@Gargron Gargron requested a review from ClearlyClaire April 24, 2021 02:45
@Gargron Gargron merged commit daccc07 into main Apr 24, 2021
@Gargron Gargron deleted the fix-change-autofollow branch April 24, 2021 15:01
chrisguida pushed a commit to Start9Labs/mastodon that referenced this pull request Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants