feat: add notifications when user mentioned in how-to#2014
feat: add notifications when user mentioned in how-to#2014thisislawatts wants to merge 15 commits intomasterfrom
Conversation
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
| @@ -34,6 +34,7 @@ export const HOWTO_MOCK: IHowto[] = [ | |||
| ], | |||
There was a problem hiding this comment.
thought: I wonder if we can remove these static mocks entirely in favour of using the factories 🤔 Not an item for this round of changes, but a future clean up.
There was a problem hiding this comment.
As far as I'm aware these mocks aren't really used at all (legacy code). There are also additional mocks in the oa-shared folder which are used in cypress e2e tests - I'm not sure what's best practice in terms of unit vs e2e test data, but definitely would have no issue if you wanted to tidy either of these up.
The only minor issue I can think of is handling cases where we want to ensure unit tests cover certain data conditions, e.g. in the userNotification store there is both a read and notified property, but the code doesn't allow for notifications that are both read:true and notified:false. I still went for mock data factory because I like the pattern you had set up on the research store, although I added overrides for those fields to make sure the test cases I wanted were populated.
| @@ -0,0 +1,46 @@ | |||
| jest.mock('../common/module.store') | |||
There was a problem hiding this comment.
🥳 New tests which can be used to document the behaviour of the store.
There was a problem hiding this comment.
looks great! Really wish I had seen these before going ahead and writing tests for the refactored userNotifications store! (oh well, all good learning experiences and can merge the two together)
|
Visit the preview URL for this PR (updated for commit 96ef1e5): https://onearmy-next--pr2014-feat-add-notificatio-q05g68p2.web.app (expires Thu, 19 Jan 2023 23:58:21 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59 |
|
let me know when you need a tester :) |
|
@davehakkens, I think it's ready for a first pass. In the interests of releasing small changes frequently, what do you think about making this available for how-to articles first and then adding it for Research articles in a future iteration? The reasoning here being that Research is only available to beta-testers and actively being used on the Project Kamp instance. |
|
Seems to work here! (always so clunky to approve a howto for testing) Up for releasing gradual. Not sure if I fully get the logic behind it, but I guess it would make the workload more distributed? That said the main important area where @mentions would be powerful is comments. This would be the only way to have follow ups in a conversation. Very much missing right now |
|
@davehakkens The changes in this PR should generate a notification when you mention a user in a howto comment. The behaviour still missing here is scrolling a comment into view. |
|
oe nicee! |
|
ah and not sure if you are aware but we already have a similair behaviour in notifications for research. |
|
@davehakkens good catch on that behaviour in Research, I think it would be worth making this behaviour consistent between the implementations. That work should likely be done as part of a separate PR. We should aim for the behaviour when clicking from a notification to a comment to be the same, regardless of whether it is a new comment or mention. I think there's an additional visual hint we can introduce here which needs some design detailing. For reference please look at the following Stack Overflow link which will scroll you to a specific item on the page which initially has a yellow background that fades to white. We don't have anything like that in the design language at the moment so I added a black outline, which looks a little… 🤢 |
|
Ah good catch, the Storybook environment where I took the screengrab from defaults to a white background which is a little unhelpful when we have components being deployed into contexts with a different background. |
|
aha that explains! Anyway looks good now here |
The original implementation relied heavily on the component library knowing about the structure of the notification object. The interface has been simplified so that all it does it use type to determine the icon and otherwise wrap the passed content. A local theme context has been introduced to style any nested anchor elements to match the original design.
|
Ready for a functional/design re-review @davehakkens and a code review from @chrismclarke |
|
works awesome. Very smooth 👌 |
|
Is it a big job to also add this for mentions in research/comments? |
|
@davehakkens I am up for implementing this on Research items as well but let's introduce those changes as a separate PR rather than add it to this one. I believe that there are already enough changes in here and rolling |
|
Nice. Was just planning on how-to (hihi) move forward with this feature. But what you suggest sounds great! |
|
I will start work on the research iteration once these changes have been merged. |
chrismclarke
left a comment
There was a problem hiding this comment.
Thanks @thisislawatts
The changes look great to me. I had a slight issue with conflicts from the refactor in @1917 which were merged ahead of this, and so have tried rebasing onto #2014.
I'll put a block on this PR for now and shift follow-ups to the rebased pr
hey @thisislawatts, just checking in if the @mentions for research is still somewhere on your todo? (No rush, just to keep track of open developments and what needs help) |
|
@davehakkens Thanks for pinging on that. Do you know what the status is of the email notifications work? I figure there could be some churn in the notifications area as part of that. Whose leading that effort atm? |
|
@thisislawatts We're slowly moving ahead with it, we're starting more with the digest approach (summary of recent notifications either daily/weekly/monthly) instead of trying to email any time triggered. I drafted a PR to handle the process of aggregating notifications in #2027, we have frontend opt-in via #2039, and have also had some work done on email templates on the side (as well as setting up a transactional email account). So that leaves one PR to integrate scheduled functions to check the aggregations and prep/format the emails, and then another to handle the actual emailing (either via firebase extension or adapting the source code into our own function depending on whether we want to enable on individual platforms manually or not). Likely also will need a few minor tweaks as I'm not sure the current way the read/notified system is implemented quite matches what you guys had drafted in the RFC (TBC), some general testing, and also likely integrating the pending migrations work if we want to retroactively opt-in all users. I've taken on those PRs up to now and reckon it will be a couple of days of work more, had planned on it last weekend but got sidetracked with build issues, so now likely at some point next month. |
|
🎉 This issue has been resolved in version 1.33.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
Thanks @chrismclarke, it was this particular point I was uncertain of:
If you are not looking to make any immediate changes to the Notification format then perhaps I can get this |
|
Yeah I won't be deep-diving anything for the next week or so, so anything you want to add/edit/refactor happy to review at the same time. I remember when doing some manual tests not being sure myself exactly which of the read/notified properties made things appear in the notification list and/or make the notification icon active, possibly a candidate to add a few more tests to for clarity I think there's a lot for generating and marking as read, maybe just one or two more to cover any notified state changes that happens from opening the list in app. But that's just what's in the back of my head, might just be that I missed something and just need to take a better look. |
|
How are you with this one @thisislawatts? |
|
I will be offline this week @davehakkens but otherwise will pick it up over the weekend. Almost there with this work 📈 |



PR Checklist
Not yet, I will squash and tidy the commit messages after review process has been undertaken
PR Type
Description
Adds notification items to a users Notification drop down if they are mentioned in a How-to article description, how-to step or comment.
As part of this work:
Git Issues
Closes #1543
Screenshots/Videos
What a users sees when they have been mentioned within a Howto Article, this could be in the description, individual step or comments.

What happens next?
Thanks for the contribution! We try to make sure all PRs are reviewed ahead of a monthly dev call (first Monday of the month, open to all!).
If the PR is working as intended it'll be merged and included in the next platform release, if not changes will be requested and re-reviewed once updated.
If you need more immediate feedback you can try reaching out on Discord in the Community Platform
developmentchannel.