okfn / ckanext-pdeu

Custom CKAN Extension for PublicData.eu
9 stars 4 forks source link

Implement bubble notification of new activity #11

Closed seanh closed 11 years ago

seanh commented 12 years ago

We want a "bubble" with a number in it to appear in the top-right of the site next to your user name when you're logged in, telling you how many new activity stream items you have.

seanh commented 12 years ago

Assigned this to myself at first to think about what needs to be done in the backend to enable this, but I think the backend is already there and it will mostly be frontend work from John

srkunze commented 12 years ago

As far as I remember, do the bubbles disappear as soon as the user visited a page related to that bubble.

So, we just need is a table that stores every page that the user has visited + when. Having this, we can sort out the still-not-seen activities (date-wise) for each page pages:

seanh commented 12 years ago

I don't think we've decided whether the bubble disappears as soon as the user visits their dashboard, or whether we will have a "mark all as read" button. @johnmartin, any thoughts on this?

I'm not sure if I want a table storing all a user's page visits. I think it might be enough to store the date and time of the last time the user visited their dashboard (or clicked their 'mark all as read' button on their dashboard), then we can just search the activity streams table for items newer than this time. But then we have to decide where to save this last-visited-dashboard time. Alternatively we can add a boolean seen/unseen column to the activity streams table.

srkunze commented 12 years ago

I thought we had. In fact this suggestion came also from others that are not directly involved. They found it easier. First, I also had the idea of an 'accept' or 'mark as read' button, but it seems they aren't convenient.

Well, I personally favor a more general approach. That is because we have a syntax for URLs, so why not using it. For dashboard and its filters we need to invent a new one. Furthermore, maybe in the future we could re-use the visits for some other purpose that we cannot think of now (statistics etc.)

seanh commented 12 years ago

Bubble disappears as soon as you visit the page is fine with me. @johnmartin I also wonder if, when the user clicks on the bubble, they could just see their activity stream in one of those popup speech bubble things, instead of having to actually go to their dashboard page.

@srkunze I think for flexibility we want to record which activity stream items are seen/unseen separately from recording which pages have been viewed or not. There could be many ways to mark my activity stream as viewed: by viewing my activity stream on my dashboard page, by seeing it in a popup bubble created by javascript, via the API, etc.

seanh commented 11 years ago

@johnmartin Handing this over to you. The branch is https://github.com/okfn/ckan/compare/3009-on-site-notification-of-new-activity. c.new_activities is in the template context on every page when logged in, is the number of new activities, automatically gets reset to 0 on loading the dashboard page.

johnmartin commented 11 years ago

Excellent. I'll work on this today so we can have a pull request for tomorrow.

johnmartin commented 11 years ago

This was merged into master, so I'm closing this.