Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(notifications): show and read unread notifications #686

Merged
merged 9 commits into from
Jan 22, 2025

Conversation

tris203
Copy link
Contributor

@tris203 tris203 commented Nov 24, 2024

Describe what this PR does / why we need it

Add ability to see unread notifications, review and mark as read from within octo

image

Does this pull request fix one issue?

Fixes #119

Describe how you did it

Use REST API for notifications as GraphQL is lacking

Describe how to verify it

  1. :Octo notification
  2. See unread notifications
  3. scroll the list of PRs/Issues
  4. Enter will open that issue/PR
  5. <leader>nr will mark the notification as read

Special notes for reviews

Currently limited to unread notifications only due to API limitations
Icons are in place for unread, for extension in the future

Checklist

  • Passing tests and linting standards
  • Documentation updates in README.md and doc/octo.txt

@pwntester
Copy link
Owner

Thanks for the PR @tris203 This is great! I was waiting for GitHub to give us access to the more advanced notification implementation where you can mark them as done and read separately but it seems that is not going to happen anytime soon

@tris203 tris203 force-pushed the notifications branch 2 times, most recently from f084a6d to 0b56dae Compare November 28, 2024 15:34
@tris203
Copy link
Contributor Author

tris203 commented Nov 28, 2024

Done and rebased @pwntester

@tris203 tris203 requested a review from pwntester November 28, 2024 15:35
@wd60622
Copy link
Collaborator

wd60622 commented Dec 7, 2024

My telescope picker from the Octo is pretty tight. Can we make the first column width based on the width of the longest word (maybe with some padding)

notifications

@wd60622
Copy link
Collaborator

wd60622 commented Dec 7, 2024

I tend to have use Octo from within the single repo, how about a configuration to filter to just the notifications for the current repo. Then no need to show the repo name as well. What are your thoughts?

@tris203
Copy link
Contributor Author

tris203 commented Dec 7, 2024

I tend to have use Octo from within the single repo, how about a configuration to filter to just the notifications for the current repo. Then no need to show the repo name as well. What are your thoughts?

I don't think that particularly makes sense given the current API limitations. Given that we only show unread notifications, you would end up looking at an empty list 99% of the time.

Also a general, what do I have to do would mean pinging around all over the place to see where you might have notifications

@wd60622
Copy link
Collaborator

wd60622 commented Dec 7, 2024

I tend to have use Octo from within the single repo, how about a configuration to filter to just the notifications for the current repo. Then no need to show the repo name as well. What are your thoughts?

I don't think that particularly makes sense given the current API limitations. Given that we only show unread notifications, you would end up looking at an empty list 99% of the time.

Also a general, what do I have to do would mean pinging around all over the place to see where you might have notifications

I was thinking pull all notifications but filter before passing to picker

@tris203
Copy link
Contributor Author

tris203 commented Dec 7, 2024

I tend to have use Octo from within the single repo, how about a configuration to filter to just the notifications for the current repo. Then no need to show the repo name as well. What are your thoughts?

I don't think that particularly makes sense given the current API limitations. Given that we only show unread notifications, you would end up looking at an empty list 99% of the time.
Also a general, what do I have to do would mean pinging around all over the place to see where you might have notifications

I was thinking pull all notifications but filter before passing to picker

That works, but I don't know if with the telescope API if we can "mark an item read" without refreshing the whole list?

@wd60622
Copy link
Collaborator

wd60622 commented Dec 7, 2024

That works, but I don't know if with the telescope API if we can "mark an item read" without refreshing the whole list?

But that affects even the case without the filter, right?

@tris203
Copy link
Contributor Author

tris203 commented Dec 7, 2024

That works, but I don't know if with the telescope API if we can "mark an item read" without refreshing the whole list?

But that affects even the case without the filter, right?

No, because we just grab the unread items list, and marking it read fires the API even and optimistically removes it from the selector without the need to refresh the whole thing.

We could change it to a notification list and a notification list all or something similar, but I don't know how that best fits with the command list, and your still going to end up looking at an empty list most of the time.

@wd60622
Copy link
Collaborator

wd60622 commented Dec 7, 2024

No, because we just grab the unread items list, and marking it read fires the API even and optimistically removes it from the selector without the need to refresh the whole thing.

Seems like the same logic for the case where the list is already filtered

We could change it to a notification list and a notification list all or something similar,

Would a configuration option not suffice?

but I don't know how that best fits with the command list, and your still going to end up looking at an empty list most of the time.

The other pickers have a "no matching ... found". Would a message like that be applicable here? What is the behavior with no notifications at the moment?

@tris203
Copy link
Contributor Author

tris203 commented Dec 11, 2024

No, because we just grab the unread items list, and marking it read fires the API even and optimistically removes it from the selector without the need to refresh the whole thing.

Seems like the same logic for the case where the list is already filtered

We could change it to a notification list and a notification list all or something similar,

Would a configuration option not suffice?

Sure

but I don't know how that best fits with the command list, and your still going to end up looking at an empty list most of the time.

The other pickers have a "no matching ... found". Would a message like that be applicable here? What is the behavior with no notifications at the moment?

an empty list at the moment, i guess a no matching notifactions makes sense

Seeing as this is fully new functionality, IMO i think it makes sense to get a base design in and iterate on it later once it is being used.
At the moment, the state of this seems to work for my functionality of opening neovim and looking what needs to be done.
Or being working on something, seeing the email notification come in and opening the list in neovim without having to think about switching to the right project first

Also given that this is a bit of a stop gap until the "real" graphql endpoint eventually comes

@wd60622
Copy link
Collaborator

wd60622 commented Jan 17, 2025

I think a rebase and address my comments would make this good to go

@github-actions github-actions bot added the enhancement New feature or request label Jan 17, 2025
Copy link
Collaborator

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

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

Just one final suggestion on the spacing being too big

@wd60622 wd60622 removed the request for review from pwntester January 17, 2025 11:31
@wd60622
Copy link
Collaborator

wd60622 commented Jan 17, 2025

Could @pwntester take another look. Your requested change is blocking a potential merge

@tris203
Copy link
Contributor Author

tris203 commented Jan 17, 2025

I think your rebase has broken the icons too, but I will have a look

@wd60622
Copy link
Collaborator

wd60622 commented Jan 17, 2025

I think your rebase has broken the icons too, but I will have a look

I did a rebase then fix for the icons. Take a look now. I had all items working

@wd60622 wd60622 merged commit f75ec17 into pwntester:master Jan 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request - open issues and PRs via notifications
3 participants