Skip to content

On-site notifications#7030

Open
pablobm wants to merge 8 commits into
openstreetmap:masterfrom
pablobm:onsite-notifications
Open

On-site notifications#7030
pablobm wants to merge 8 commits into
openstreetmap:masterfrom
pablobm:onsite-notifications

Conversation

@pablobm

@pablobm pablobm commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

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:

The proposed Notifications page, showing a list of notifications: changeset comments, note comments, new followers, etc

Notifications are listed in a dedicated page so that client apps (eg: JOSM) can easily link to them.

What is not implemented:

  • Marking notifications as seen/read. That's its own can of design worms.
  • Similarly, any indication (number, red dot, etc) that there are unseen/unread notifications.
  • Any means to delete/hide notifications.
  • Hiding notifications that refer to items that have been made invisible (eg: a note was hidden). An email notification won't disappear from your inbox just because it refers to something that was removed, so it's not super important to do it here immediately.
  • Dealing with N+1 queries. I am not sure that it's worth it, with 20 items per page and 6 different types of content. Perhaps fragment caching would be better here, but I think this should be done separately.
  • Showing only an excerpt of potentially large pieces of text (eg: long diary comment). Again, several approaches are possible, so let's discuss it separately.

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.

@pablobm pablobm force-pushed the onsite-notifications branch from acdb057 to 6466916 Compare April 23, 2026 16:35

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yay, I’m excited to use this even before extra polish, instead of missing e-mail notifications that get lost in my inbox!

Comment on lines +5 to +19
<%= 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)
) %>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 %>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would be a good opportunity to link to the notification preferences in #7001, depending on which PR lands first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Yes, I think users are now used to "click here to change your notification preferences" at places like this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it makes sense to provide a unified "take me to the source of the notification" button.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have made it so that the headline of each type of notification links to the appropriate event (note comment, uploaded trace, etc).

@pablobm pablobm force-pushed the onsite-notifications branch 3 times, most recently from c8c1287 to 58acba4 Compare May 6, 2026 09:36
@pablobm pablobm force-pushed the onsite-notifications branch 3 times, most recently from 72131ba to 5eff28d Compare May 11, 2026 13:27
@github-actions

Copy link
Copy Markdown
1 Warning
⚠️ Number of updated lines of code is too large to be in one PR. Perhaps it should be separated into two or more?

Generated by 🚫 Danger

@pablobm pablobm force-pushed the onsite-notifications branch 11 times, most recently from 9090cf2 to 695362a Compare May 13, 2026 11:28
@pablobm pablobm marked this pull request as ready for review May 13, 2026 19:39
@pablobm

pablobm commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

This is not now ready for a proper review.

@pablobm

pablobm commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

I meant "now" in my previous comment... 😓 (Adding this new comment for the benefit of email notifications).

@1ec5

1ec5 commented May 13, 2026

Copy link
Copy Markdown
Collaborator

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. 😉

@pablobm pablobm force-pushed the onsite-notifications branch 2 times, most recently from f779c0c to 00bafaa Compare May 14, 2026 17:16
@pablobm pablobm force-pushed the onsite-notifications branch from 00bafaa to b61168c Compare May 14, 2026 17:19
@pablobm

pablobm commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants