Skip to content

Add ability to filter message recipients by activity#3325

Merged
mathjazz merged 7 commits into
mozilla:mainfrom
mathjazz:3244-messaging-activity-filters
Sep 13, 2024
Merged

Add ability to filter message recipients by activity#3325
mathjazz merged 7 commits into
mozilla:mainfrom
mathjazz:3244-messaging-activity-filters

Conversation

@mathjazz
Copy link
Copy Markdown
Collaborator

@mathjazz mathjazz commented Sep 11, 2024

Fix #3244.

This is a continuation of what was started in #3314. It implements the remaining bits of the Compose screen in the Messaging Center, namely Activity filters. As mentioned in #l10n-team last Friday, Activity filters are always visible, which is not what the spec says, but it’s simpler from the UX and codebase point of view.

The diff looks bigger than the changes actually are because of a dedent in Remove redundand condition and formatting of the HTML file in Update check-box and messaging styling. Hence, I suggest reviewing commit by commit.

Deployed to stage:
https://mozilla-pontoon-staging.herokuapp.com/messaging/

@mathjazz mathjazz requested review from bcolsson and eemeli September 11, 2024 09:51
Copy link
Copy Markdown
Member

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Selecting "Hide whitespace" from the diff view options got rid of the indent noise.

@@ -43,103 +46,188 @@ def messaging(request):
@require_POST
@transaction.atomic
def send_message(request):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This function seems to perform an excessive number of DB queries, but it's probably okay to leave this unoptimized given how rarely it'll be called.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Forgot to mention that the queries are very slow, and might time out. I'll work on that before unlocking the ability to actually send email to the selected users (not to yourself).

@eemeli
Copy link
Copy Markdown
Member

eemeli commented Sep 11, 2024

Testing the functionality on stage, I'm getting a 503 response from trying to send a test notification. Is that intentional?

@bcolsson
Copy link
Copy Markdown
Collaborator

I'm less concerned about the activity filters being shown, but right now it seems like activity filters are always going to be enabled. Even if number of translations min/max of 0/0 means any number of translations, the date filter is still restricted to within the last year.

At the bare minimum can we include an enabled checkbox (with the default being unchecked)?

@mathjazz
Copy link
Copy Markdown
Collaborator Author

but right now it seems like activity filters are always going to be enabled. Even if number of translations min/max of 0/0 means any number of translations, the date filter is still restricted to within the last year.

The default date values can be deleted and then activity filters aren't applied (which is the same as unchecking the box).

Should that (no value set) be the default behavior?

See the example for Translation filters below:

Screenshot 2024-09-12 at 20 41 40

@bcolsson
Copy link
Copy Markdown
Collaborator

but right now it seems like activity filters are always going to be enabled. Even if number of translations min/max of 0/0 means any number of translations, the date filter is still restricted to within the last year.

The default date values can be deleted and then activity filters aren't applied (which is the same as unchecking the box).

Should that (no value set) be the default behavior?

The likelihood of someone wanting all 3 filters applied is low, the likelihood of someone forgetting to delete default values if they don't want a filter enabled is high. Testing it out, to actually delete the date from the box I have to:
click, delete, tab, delete, tab, delete
That's for just 1 field, so I have to do that 6 times if I don't want to have any activity filters?

We could remove the defaults to keep everything empty, but I feel like clearly indicating whether an activity filter is enabled or not seems like a better UI

@mathjazz
Copy link
Copy Markdown
Collaborator Author

The likelihood of someone wanting all 3 filters applied is low, the likelihood of someone forgetting to delete default values if they don't want a filter enabled is high. Testing it out, to actually delete the date from the box I have to: click, delete, tab, delete, tab, delete That's for just 1 field, so I have to do that 6 times if I don't want to have any activity filters?

You don't need to do that if the dates are not set by default. 🤣

But yes, the default browser date field seems to work the way you describe it...

We could remove the defaults to keep everything empty, but I feel like clearly indicating whether an activity filter is enabled or not seems like a better UI

I 100% agree this is not an ideal UX.

But while I understand this feature is critical, it's also going to be used very rarely by very few people. And only after we start using it, we'll understand how it's going to be used.

So my suggestion is to get it to a point where it’s functional and solves the main problem, and then we can circle back to it after we've collected some usage data and delivered other features.

@bcolsson
Copy link
Copy Markdown
Collaborator

Alright, then the least bad option here would be to have no default values here then.
It seems like we're not doing validation- but I suppose not a big issue (the only would be sending to 0 people if the min is higher than the max for number of translations).

I'll approve now to not block, but would like default values removed from dates.

Copy link
Copy Markdown
Collaborator

@bcolsson bcolsson left a comment

Choose a reason for hiding this comment

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

Approved (assuming defaults are removed from the From / To date filters.

This reverts commit fe6289b.
@mathjazz
Copy link
Copy Markdown
Collaborator Author

It seems like we're not doing validation- but I suppose not a big issue (the only would be sending to 0 people if the min is higher than the max for number of translations).

The input is validated as per the spec. We could add additional validation for cases where Maximum < Minimum or To < From, but I'd leave that for later. As you mention, in cases like this we'll not send a message to any users anyways, which is also a validation.

@mathjazz mathjazz merged commit b8db57f into mozilla:main Sep 13, 2024
@mathjazz mathjazz deleted the 3244-messaging-activity-filters branch September 13, 2024 06:38
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.

Add ability to filter users by various criteria when sending messages

3 participants