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 ability to see and recycle sent messages #3353

Merged
merged 17 commits into from
Oct 3, 2024

Conversation

mathjazz
Copy link
Collaborator

@mathjazz mathjazz commented Sep 18, 2024

Fix #3246: After the message is sent, it gets stored to the DB and displayed in the Sent panel.
Fix #3247: Add ability to edit sent messages as new

Since @eemeli is on a PTO, I'll be integrating my work on #3247 directly into this PR. That will allow opening sent messages in the Compose panel, revealing more details about them, like the selected filters. It'll also make Sent and Compose panels accessible via URL, which will allow redirecting to the (updated) Sent panel after the message is sent (right now you need to refresh the page to see the sent message, which is annoying).

@bcolsson Could you please take this for a spin on stage? Note that temporarily messages are always sent to the sender, regardless if you click Send to myself or Send. You can also manage messages via Django Admin.

Also included are some under the hood changes that will make code more maintainable:

Updated on Sep 19, 14:20 UTC: I've now integrated the fix for #3247. Related to that:

  • Compose and Sent panels can now be linked to.
  • After the message is sent, show it in the Sent panel.

@mathjazz mathjazz changed the title Add ability to see sent messages Add ability to see and recycle sent messages Sep 19, 2024
@mathjazz
Copy link
Collaborator Author

mathjazz commented Sep 19, 2024

Known bugs:

  • Checking Email as message type will result in an error (sending emails on stage is disabled by design)
  • Messages are stored and sent as (sanitized) HTML for security reasons. When you edit sent messages, HTML is converted back to Markdown, which might not be exactly the same as the Markdown the message was originally written in.

@bcolsson
Copy link
Collaborator

@mathjazz - testing from a user perspective everything seems nice and functional. Liking it!

@flodolo
Copy link
Collaborator

flodolo commented Sep 20, 2024

When previewing the message, it would be nice to visually differentiate the text from the rest the the UI, e.g.

Screenshot 2024-09-20 alle 07 51 43

Questions:

  • Do we want all locales and all projects selected by default?

Issues:

  • There are no checks on the fact that Maximum should be bigger than Minimum, or From earlier than To.

@mathjazz
Copy link
Collaborator Author

mathjazz commented Sep 20, 2024

When previewing the message, it would be nice to visually differentiate the text from the rest the the UI, e.g.

Makese sense, I'll play with it a little.

Do we want all locales and all projects selected by default?

That's what the spec says. It's also what we've been using in the recent emails. But not in manual notifications. Maybe leave it for now and adapt if data shows it's not the right default?

There are no checks on the fact that Maximum should be bigger than Minimum, or From earlier than To.

This is checked implicitly, because the number of recipients in cases like this will be zero. Same as above, I'd add an explicit check if this actually turns out to be a problem.

@mathjazz
Copy link
Collaborator Author

mathjazz commented Sep 23, 2024

When previewing the message, it would be nice to visually differentiate the text from the rest the the UI, e.g.

Makese sense, I'll play with it a little.

Made some minor adjustments to the overall styling, including this.

Copy link
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.

Sorry for the time it took me to get to this. A few small things inline, but I'd appreciate a chance to see this on stage again and take it for a spin?

pontoon/messaging/static/js/messaging.js Outdated Show resolved Hide resolved
pontoon/messaging/static/js/messaging.js Show resolved Hide resolved
pontoon/messaging/static/js/messaging.js Outdated Show resolved Hide resolved
Comment on lines 228 to 232
// Keep default middle-, control- and command-click behaviour (open in new tab)
if (e.which === 2 || e.metaKey || e.ctrlKey) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

How about shift+click?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We'd need to file a bug for that and change it across all pages with tabs.

Copy link
Member

@eemeli eemeli Oct 3, 2024

Choose a reason for hiding this comment

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

The translate frontend already checks for shiftKey when it checks for ctrlKey, so we shouldn't deviate from that more in the places where we do special stuff on clicks.

Suggested change
// Keep default middle-, control- and command-click behaviour (open in new tab)
if (e.which === 2 || e.metaKey || e.ctrlKey) {
return;
}
// Keep default middle-, shift-, control- and command-click behaviour (open in new tab)
if (e.which === 2 || e.metaKey || e.ctrlKey || e.shiftKey) {
return;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll update both files.

@mathjazz
Copy link
Collaborator Author

mathjazz commented Oct 3, 2024

Sorry for the time it took me to get to this. A few small things inline, but I'd appreciate a chance to see this on stage again and take it for a spin?

Deployed to stage.

@mathjazz mathjazz requested a review from eemeli October 3, 2024 16:24
pontoon/messaging/templates/messaging/includes/sent.html Outdated Show resolved Hide resolved
</div>
<div class="footer">
<a href="{{ url('pontoon.messaging.edit_as_new', message.pk) }}" class="edit-as-new"><i class="fa fa-pencil-alt"></i>Edit as new</a>
<time>{{ message.sent_at|format_for_inbox }}</time>
Copy link
Member

Choose a reason for hiding this comment

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

I initially didn't see this "sent at" info at all. I would expect for this to be near the top of the message, where we also have the sender, the recipient count & message type.

Copy link
Collaborator Author

@mathjazz mathjazz Oct 3, 2024

Choose a reason for hiding this comment

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

It's a common pattern to show timestamp under the message bubble in the messaging apps. I think you'll get used to it quickly.

It'll be busy in the header.

@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 63.63636% with 40 lines in your changes missing coverage. Please review.

Project coverage is 80.44%. Comparing base (b8a2030) to head (2abf95c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pontoon/messaging/views.py 23.52% 26 Missing ⚠️
pontoon/base/templatetags/helpers.py 30.76% 9 Missing ⚠️
pontoon/messaging/forms.py 71.42% 4 Missing ⚠️
pontoon/messaging/models.py 97.05% 1 Missing ⚠️
Additional details and impacted files

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mathjazz
Copy link
Collaborator Author

mathjazz commented Oct 3, 2024

Updated and re-deployed to stage. I also had to rebase.

@mathjazz mathjazz requested a review from eemeli October 3, 2024 18:28
Copy link
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.

Looks good to go. Instead of rebasing, doing a merge from main to the PR branch would make the changes easier to review.

@mathjazz mathjazz merged commit 138be1b into mozilla:main Oct 3, 2024
4 checks passed
@mathjazz mathjazz deleted the 3246-messaging-sent branch October 3, 2024 20:00
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 recycle Sent messages Add ability to see the Sent messages
5 participants