Skip to content

Add ability to add/remove watchers on an issue #29

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

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

danielcmccarthy
Copy link
Contributor

In jira-detail-mode, w pops up a transient with commands for adding or removing a user from the watchers list. To make that easier to use, I also added a table mapping Jira display names to account IDs. Now we can offer completion when prompting for a user name.

It's not the best to have the watchers commands in a nested transient. There's plenty of room left in jira-detail--actions-menu. I originally wanted to use two-letter commands w + and w -, but those don't work for the major mode. So using a nested transient bound to w means at least the complete key sequences are the same.

In my testing, adding watchers works, but removing fails with 403 every time. I can remove watchers on the web page, so I definitely have the correct permissions, and I'm pretty sure the code is correct. Let me know if you have any ideas!

Copy link
Owner

@unmonoqueteclea unmonoqueteclea left a comment

Choose a reason for hiding this comment

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

Awesome work, thanks!

Just a few changes, and it will be ready to be merged!

@danielcmccarthy
Copy link
Contributor Author

I want to avoid one of the big pains of Jira Web UI that is: issues take too much time to load because they are doing dozens of API requests.

I completely agree. I tried to avoid concurrent callback problems by creating the magit-section before requesting the watchers API, saving the location of the section body. It "works", but the problem is that the inserted text isn't really part of the section: you can't collapse it or expand it. It doesn't seem like you can add text to a magit-section outside of the magit-section-* macros.

So the solution should be to fetch the data, then create the section, like jira-detail--comments. But when I tried that I had bizarre errors: the section header ended up below the contents. I'll try again tonight; maybe it was just a problem with my setup.

It seems like it would work if "Other" was at the bottom of the buffer, but that doesn't seem right to me. Comments should be at the bottom, since there can be indefinitely many of them.

Can we call it "Update watchers"?

Done: b6a8c95

Instead of showing all the users, could we just show the users watching current issue?

Did you mean this for jira-actions-remove-watchers? I think that's a good idea.

Just use "DELETE" instead of "DEL" and it will work like a charm!

Fixed 🤦: 994d5fb.

@unmonoqueteclea
Copy link
Owner

unmonoqueteclea commented Jul 18, 2025

I want to avoid one of the big pains of Jira Web UI that is: issues take too much time to load because they are doing dozens of API requests.

I completely agree. I tried to avoid concurrent callback problems by creating the magit-section before requesting the watchers API, saving the location of the section body. It "works", but the problem is that the inserted text isn't really part of the section: you can't collapse it or expand it. It doesn't seem like you can add text to a magit-section outside of the magit-section-* macros.

So the solution should be to fetch the data, then create the section, like jira-detail--comments. But when I tried that I had bizarre errors: the section header ended up below the contents. I'll try again tonight; maybe it was just a problem with my setup.

It seems like it would work if "Other" was at the bottom of the buffer, but that doesn't seem right to me. Comments should be at the bottom, since there can be indefinitely many of them.

There is another option. Trigger the comments load in the callback of the function that shows the watchers after they are obtained (asynchronously) from the API. While the watchers are loading, we are able to see the rest of fields. When the watchers finish loading they are shown and the comments are requested (asynchronously) to the API

Instead of showing all the users, could we just show the users watching current issue?
Did you mean this for jira-actions-remove-watchers? I think that's a good idea.
Yes, there.

@unmonoqueteclea unmonoqueteclea mentioned this pull request Jul 20, 2025
8 tasks
Copy link
Owner

@unmonoqueteclea unmonoqueteclea left a comment

Choose a reason for hiding this comment

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

Thanks you!! I will squash and merge the branch

@unmonoqueteclea unmonoqueteclea merged commit 8685301 into unmonoqueteclea:main Jul 21, 2025
1 of 2 checks passed
@danielcmccarthy danielcmccarthy deleted the watchers branch July 22, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy