go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.24k stars 5.5k forks source link

Update the list of watchers and stargazers when clicking watch/unwatch or star/unstar #32570

Open yardenshoham opened 2 days ago

yardenshoham commented 2 days ago

We make sure the user cards are updated

I also removed ctx.Data["PageIsWatchers"] = true and ctx.Data["PageIsStargazers"] = true as they are not used anywhere.

Before

before

After

after

silverwind commented 1 day ago

What happens to any potential JS event handlers in the swapped HTML when HTMX does the swap? How do we make sure that event handlers that need to be added to new cards are bound correctly after the swap? Likely there are currently no such event handlers, but it is something that must be considered when doing such swaps.

yardenshoham commented 1 day ago

This is true for any HTMX swap. This pull request is not the first one. There are no event handlers attached to the cards so we should be ok.