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

Add support for language preferences for trending statuses and links #18288

Merged
merged 1 commit into from
Oct 8, 2022

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented May 3, 2022

Instead of storing trends in a separate sorted Redis set for each language, store them all in a single table in the database. This allows querying by preferred languages but also including other languages.

When multiple languages are chosen in preferences, these are displayed at the top, otherwise, current content locale.

Instead asking moderators to review a trend only when it reaches a global threshold, which most languages can never do, it is now done for each language separately.

There is one regression, and that is that multiple posts by the same author can once again appear among trending statuses. Unfortunately I could not figure out how to best implement that.

@Gargron Gargron added the new user experience Features for attracting and onboarding new users label May 3, 2022
@Gargron Gargron force-pushed the feature-trending-statuses-language-fallbacks branch 4 times, most recently from 726ee08 to a12834d Compare August 27, 2022 21:11
app/controllers/admin/trends/statuses_controller.rb Outdated Show resolved Hide resolved
app/models/trends/statuses.rb Outdated Show resolved Hide resolved
app/models/trends/statuses.rb Outdated Show resolved Hide resolved
@Gargron Gargron force-pushed the feature-trending-statuses-language-fallbacks branch 3 times, most recently from 541e6d1 to 38fbbb8 Compare October 6, 2022 07:02
@Gargron Gargron changed the title Add fallbacks for trending statuses when none are available in locale Add support for language preferences for trending statuses and links Oct 6, 2022
@Gargron Gargron force-pushed the feature-trending-statuses-language-fallbacks branch from 38fbbb8 to 8b77b74 Compare October 6, 2022 07:08
@Gargron Gargron force-pushed the feature-trending-statuses-language-fallbacks branch from 8b77b74 to 2982d72 Compare October 6, 2022 21:28
app/models/trends.rb Show resolved Hide resolved
app/models/trends/links.rb Outdated Show resolved Hide resolved
else
scope.not_excluded_by_account(@account).not_domain_blocked_by_account(@account)
@locale
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the @locale thing override chosen_languages?

Copy link
Member Author

Choose a reason for hiding this comment

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

As per #19291 the preference takes precedence and allows seeing multiple languages.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it makes sense if @locale isn't something the user has direct/easy control on, but it's weird to have an API parameter ignored like that, it makes more sense to me that it would be an override than the opposite (e.g. if apps want to implement a language switch for popular posts).

app/models/trends/links.rb Show resolved Hide resolved
@Gargron Gargron force-pushed the feature-trending-statuses-language-fallbacks branch from 2982d72 to d4b207c Compare October 7, 2022 18:32
@Gargron Gargron merged commit 45ebdb7 into main Oct 8, 2022
@Gargron Gargron deleted the feature-trending-statuses-language-fallbacks branch October 8, 2022 14:45
@joenepraat
Copy link
Contributor

Thanks, this will hopefully fix empty trends for Dutch and smaller languages on the landing page of e.g. mastodon.social (see screenshot).
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new user experience Features for attracting and onboarding new users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants