On-site notifications#7030
Conversation
acdb057 to
6466916
Compare
1ec5
left a comment
There was a problem hiding this comment.
Yay, I’m excited to use this even before extra polish, instead of missing e-mail notifications that get lost in my inbox!
| <%= t( | ||
| ".notification_header_html", | ||
| :changeset_comment_link => link_to( | ||
| t(".changeset_comment"), | ||
| changeset_path( | ||
| notification.changeset, | ||
| :anchor => "c#{notification.comment_id}" | ||
| ) | ||
| ), | ||
| :commenter_name_link => link_to( | ||
| notification.commenter.display_name, | ||
| notification.commenter | ||
| ), | ||
| :time_ago => friendly_date_ago(notification.timestamp) | ||
| ) %> |
There was a problem hiding this comment.
All other notification types.
As we add more notification types, would there be any opportunity to factor out some common elements to avoid boilerplate? This code to generate the header seems like a candidate for that, except that some notification types probably won’t have anything analogous to a commenter or a page to link to.
Since the intention is to communicate all the information that’s currently going out in e-mails, what if we add a consistent heading that’s based on the subject line of those e-mails? For simplicity, it could remain as plain text. Then, these details specific to changeset comments could be a separate line below it. Or maybe the code to generate a rich text heading could live alongside the existing code that generates the plain text subject line.
There was a problem hiding this comment.
Sharing content with the emails, including the subject line, makes a lot of sense; I'll play a bit with the idea. Sharing code between the two might be tricky but at worst we can accept it as incidental duplication and that's fine.
As for sharing code across notifications, let's see where this goes. This line in particular looks difficult to factor out to me, as each translation line will have different names and fiddly details, but who knows.
There was a problem hiding this comment.
I have reached a design that I'm liking enough for now and should cover all the bases. I have gone for different wordings from those used in email... because I don't like the email ones 😓 I think my choices are simpler and the emails could be improved.
Also the ability for reuse is a bit limited. Even for translation strings, reusing across different contexts is tricky. I'm not sure it can be done without having to write long keys in each case (eg: t(".subject") vs t("some_context.notifications.changeset_comment.subject")).
The templates do have a lot of repetition. I could go try DRY them up a bit, but at this stage it's better if we put them to the test first.
|
|
||
| <% @notifications.each do |notification| %> | ||
| <%= render :partial => notification.to_partial_path, :object => notification, :as => :notification %> | ||
| <% end %> |
There was a problem hiding this comment.
This would be a good opportunity to link to the notification preferences in #7001, depending on which PR lands first.
There was a problem hiding this comment.
Good point. Yes, I think users are now used to "click here to change your notification preferences" at places like this.
There was a problem hiding this comment.
I have added a link to this effect at the top, in the header section (see latest screenshot).
| </p> | ||
| <blockquote class="mx-2 fst-italic"> | ||
| <p class="text-truncate"><%= notification.comment_body.truncate(200, :separator => " ") %></p> | ||
| </blockquote> |
There was a problem hiding this comment.
Should we add some kind of action button below or to the right of the notification, like an “Open Comment” button that does the same thing as the “Changeset Comment” link currently does? It would be a nice place to put a Mark as Read/Unread button once we have that functionality, similar to what we have in the Inbox.
There was a problem hiding this comment.
Yes, it makes sense to provide a unified "take me to the source of the notification" button.
There was a problem hiding this comment.
I have made it so that the headline of each type of notification links to the appropriate event (note comment, uploaded trace, etc).
c8c1287 to
58acba4
Compare
72131ba to
5eff28d
Compare
Generated by 🚫 Danger |
9090cf2 to
695362a
Compare
|
This is |
|
I meant "now" in my previous comment... 😓 (Adding this new comment for the benefit of email notifications). |
|
Apparently there’s some delay in the GitHub notification e-mails so that I saw your edit reflected there. This is not a feature request for OSM e-mail notifications. 😉 |
f779c0c to
00bafaa
Compare
00bafaa to
b61168c
Compare
|
Pushed a change to allow for the case when changesets don't have a summary "comment". Updated the screenshot in the description to show an example. |
Partially addresses #7018
This implements on-site notifications. The risk of scope creep is high on a feature like this, so I have kept it intentionally simple. It can be improved over time, as we learn more.
To see it in action, you can visit https://pablobm.apis.dev.openstreetmap.org/notifications (credentials:
mapper//password). As of writing these lines, all types of notifications are present and it should look a bit like this:Notifications are listed in a dedicated page so that client apps (eg: JOSM) can easily link to them.
What is not implemented:
The design can also lend itself to a lot of discussion. I gave it a few iterations and ended up with something that I think works, even if it can be improved over time.