readthedocs / ext-theme

Read the Docs drop in replacement site templates
2 stars 2 forks source link

Notification: support new notifications through API #259

Closed agjohnson closed 6 months ago

agjohnson commented 8 months ago

Edit: in discussion below we narrowed the focus of this for right now. Currently, everything is template driven, but the build detail page needs to be API driven still. We'll punt on the rest of the items as there isn't a huge amount of value in API driven user/organization notifications yet.


Decisions

Work

cc @humitos, you might have some input on what is needed here

humitos commented 8 months ago

Will project/organization/user notifications be rendered by templates? Is there a need to make these API driven?

Regarding template rendering vs. API driven, there are a few things to consider IMO:

With that in mind, I would start with template rendering because it's easier to implement. We can keep thinking about this and change the approach if we find a more dynamic UX is required.

We need to create the PATCH endpoint to mark them as read / dismissed either way (see https://github.com/readthedocs/readthedocs.org/issues/10983)

Create a Notification listing for build detail page

This is already implemented and it's working.

Since we will mark the notification as read dynamically here, we need to add the _links field in the notification response for this use case (see https://github.com/readthedocs/readthedocs.org/issues/10982)

We did talk about how to use the bell icon menu and what notifications might go there. I feel we still aren't settled here, and maybe need to try out some options like news messages and high priority messages.

I still don't have a great answer. I'm happy to discuss more these approaches and figure it out while working on this or after implementing the initial version of the front-end. I think that will give us some valuable input to make a better decision here.

agjohnson commented 8 months ago

With that in mind, I would start with template rendering because it's easier to implement.

Cool, those are all my exact thoughts too, we're on the same page :+1:

Create a Notification listing for build detail page

This is already implemented and it's working.

Sorry, I wasn't super clear here. I was trying to refer to the notification listing UI elements in the build detail page, created from the Notification API. Your first pass in #254 on that UI will be close, but we need to add styling for the message levels, custom icons, etc, and feed it API data.

I still don't have a great answer.

Same. I think I need to see it in aciton. When I get to theme pieces, I'll try to mock something up -- I've had a hard time making time to do this so far

agjohnson commented 7 months ago

@humitos Can this be closed?

agjohnson commented 7 months ago

Nevermind, this is still a valid issue. I thought we got rid of this hack but we do need to return to it:

https://github.com/readthedocs/ext-theme/blob/e063afa454f1895b2e011f265219d5365d6cffeb/src/js/build/detail.js#L447-L455

The other notifications are fine to drive with template logic however, I don't feel we need to adjust those yet. We can focus this issue on the build detail notifications instead.

So the question instead is: can we finish this work now, or are we still blocked?

humitos commented 7 months ago

This work is about "rendering all the notifications via APIv3". This requires creating all the KO structure/pattern to consume the APIv3 endpoints --which is not implemented already and think you are the best one to do this work here.

Besides, there are some other work here missing as well:

Note that rending the notifications by using template logic was only just a temporal workaround to allow us to move forward with the implementation of the new notification system.

agjohnson commented 7 months ago

From our chat on this:

agjohnson commented 6 months ago

I started poking this on the build detail view and found that we can't use the APIv3 build endpoint still. This view uses the build v2 API for access to BuildCommands. I opened up

I didn't realize we implemented the Notifications in v2 API, so can at least start there.

agjohnson commented 6 months ago

I started poking this last night when I got back to my desk, it did go in fairly easy on the build detail view. Still some rough edges but solid improvement:

Image

humitos commented 6 months ago

This can be closed since it was implemented in https://github.com/readthedocs/ext-theme/pull/300