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

❇️ Language filter on moderation queue #25

Merged
merged 14 commits into from
Feb 21, 2024
Merged

❇️ Language filter on moderation queue #25

merged 14 commits into from
Feb 21, 2024

Conversation

foysalit
Copy link
Contributor

@foysalit foysalit commented Feb 9, 2024

Depends on bluesky-social/atproto#2161

language_filter.mov

👆🏽 Out of sync

Updated look at the language picker 👇🏽
Screenshot 2024-02-19 at 16 57 52

Notice that it allows moderators to select one or more languages and/or exclude one or more languages from the queue.

@foysalit foysalit requested a review from devinivy February 9, 2024 01:45
Base automatically changed from handle-to-did-url to main February 16, 2024 22:31
@bnewbold
Copy link
Collaborator

What we're going to want in the short-term is one "unreviewed" queue which is only Japanese (this PR makes this possible), and another "unreviewed" which is everything except Japanese.

To support this, maybe we need backend support for "not" tag filtering?

As a small UI tweak, I think we'll probably want the most common options at the top of the language drop-down menu: "everything", "english", "japanese", "portuguese", "german", "everything minus japanese"

@foysalit
Copy link
Contributor Author

@bnewbold makes sense! I built the dropdown to be a bit more robust so that we can choose multiple language and exclude multiple languages from the queue. Of course, this also covers the use-case you drew out.

Copy link

render bot commented Feb 19, 2024

Copy link

render bot commented Feb 19, 2024

const excludedTags = excludeTagsParam?.split(',') || []
const includedLanguages = tags
.filter((tag) => tag.includes('lang:'))
.map((tag) => tag.split(':')[1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

This little snippet tag.split(':')[1] could be nicely self-documented by pulling it out into a function with a nice name.

.filter((tag) => tag.includes('lang:'))
.map((tag) => tag.split(':')[1])
const excludedLanguages = excludedTags
.filter((tag) => tag.includes('lang:'))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably fine either way, but figure this is just as easy!

Suggested change
.filter((tag) => tag.includes('lang:'))
.filter((tag) => tag.startsWith('lang:'))

onClick={() => !isDisabled && onSelect(code2)}
key={code2}
>
{LANGUAGES_MAP_CODE2[code2].name}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there anything that guarantees that LANGUAGES_MAP_CODE2[code2] will exist? Maybe we could just document near availableLanguageCodes that it must be a subset of LANGUAGES_MAP_CODE2. Alternately we could mark certain items in LANGUAGES_MAP_CODE2 as "available".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah documenting availableLanguageCodes should do the job because the languages I've added are the ones that bryan suggested and overtime we may add more but even then, the LANGUAGES_MAP_CODE2 is quite comprehensive so I don't see a lang code ever missing there.

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

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

💎

Copy link
Collaborator

@bnewbold bnewbold left a comment

Choose a reason for hiding this comment

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

overall, this looks great!

I tested a bit in prod and excluding Japanese didn't seem to work. When toggling through "quick take action" (aka, left/right arrow keys), I came across japanese posts, and could see that they had been tagged lang:ja, and I could confirm that language filter setting was just "not japanese" (no positive selection).

@foysalit foysalit merged commit 3089191 into main Feb 21, 2024
3 checks passed
@matthieusieben matthieusieben deleted the language-filter branch November 15, 2024 14:54
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