Page MenuHome

Basic personal notifications
AbandonedPublic

Authored by Anna Sirota (railla) on Nov 6 2020, 3:40 PM.

Details

Summary

Goal

As part of achieving feature parity with the old Cloud, notifications need to be implemented in the new Cloud.
The goal is to have at least basic personal notifications about things like likes and replies to your comments, new activity under your blog posts etc, that could be displayed at the top bar.

https://developer.blender.org/T82135

What this does

Using actstream and Django post_save signals, generates activity records about likes, replies and new comments under blog posts.
The following notifications have been implemented implemented so far:

  • notifications about replies to your comments;
  • notifications about likes on your comments;
  • notifications about comments under blog posts;
  • notifications about comments under training sections;
  • notifications about comments under assets.

These can be viewed on the /notifications page, and the latest ones also shown in a nav dropdown (no polling, back-end rendered for now):

Notifications are marked as read via buttons on the notifications page or when clicked on.

Diff Detail

Event Timeline

Anna Sirota (railla) requested review of this revision.Nov 6 2020, 3:40 PM
Anna Sirota (railla) created this revision.

The notification system of Pillar was rather troublesome, as clients polled for new notifications every 30 seconds on every open page, and the query for constructing the response wasn't too simple either. Because of the nature of the Apache/mod_wsgi/Flask stack, it was hard to implement things like long polls or server-sent events (SSE), and thus caused a big performance bottleneck. Furthermore, back then Internet Explorer was incompatible with SSE, which is no longer an issue since it got replaced by Edge.

Will the notification system get a much-deserved redesign, so that such issues will not occur in the future? How will notifications be sent to the client? What is the overall design of the system?

The notification system of Pillar was rather troublesome, as clients polled for new notifications every 30 seconds on every open page, and the query for constructing the response wasn't too simple either. Because of the nature of the Apache/mod_wsgi/Flask stack, it was hard to implement things like long polls or server-sent events (SSE), and thus caused a big performance bottleneck. Furthermore, back then Internet Explorer was incompatible with SSE, which is no longer an issue since it got replaced by Edge.

Will the notification system get a much-deserved redesign, so that such issues will not occur in the future? How will notifications be sent to the client? What is the overall design of the system?

We taking an incremental approach. The steps are:

  • Leverage the actstream library to record likes, comments, replies etc.
  • Provide a context variable that notifies a user if any unread activity is available
  • Provide a dedicated endpoint to visualize, browse (paginate) and interact with notifications, without any JS

This is straightforward to implement, test and deploy. We will look into a more integrated and "interactive" notification system once we adopt a modern JS framework like Vue.

I have never worked with actstream, so I can't really review the code. I'd have no idea whether it's doing the right thing or not.

blog/views/api/comment.py
22

Do you want to accept {"reply_to": undefined} in the JSON? If not, you can replace parsed_body.get('reply_to') is None with simply 'reply_to' in parsed_body.

Comment anchors, notification and activity pages rBLSd723eec2fce8
Minor fix to reply_to_pk rBLSeab7a0b1b238

Anna Sirota (railla) updated this revision to Diff 30980.
Anna Sirota (railla) edited the summary of this revision. (Show Details)