aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2024-11-22 20:51:51 +0200
committerGitHub <noreply@github.com>2024-11-22 18:51:51 +0000
commitf2a995174101b9fa9409acb2b47b065262098b28 (patch)
treed1810343bd313c00f74eeb5aa38ff7daac4c7996 /templates/repo
parentae90b21db036507b8df9ed22e7ba416139037547 (diff)
downloadgitea-f2a995174101b9fa9409acb2b47b065262098b28.tar.gz
gitea-f2a995174101b9fa9409acb2b47b065262098b28.zip
Update the list of watchers and stargazers when clicking watch/unwatch or star/unstar (#32570)
We make sure the user cards are updated - Fixes https://github.com/go-gitea/gitea/issues/32561 I also removed `ctx.Data["PageIsWatchers"] = true` and `ctx.Data["PageIsStargazers"] = true` as they are not used anywhere. # Before ![before](https://github.com/user-attachments/assets/e3bc3235-35eb-4eda-862d-bdf2510282ea) # After ![after](https://github.com/user-attachments/assets/bc0488a5-8399-4cf6-95c9-17328a9702eb) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/user_cards.tmpl12
1 files changed, 11 insertions, 1 deletions
diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl
index 7cd3d4517a..360aeaf619 100644
--- a/templates/repo/user_cards.tmpl
+++ b/templates/repo/user_cards.tmpl
@@ -1,4 +1,14 @@
-<div class="user-cards">
+<!-- Refresh the content if a htmx response contains "HX-Trigger" header.
+This usually happens when a user stays on the watchers/stargazers page
+when they watched/unwatched/starred/unstarred and the list should be refreshed.
+To test go to the watchers page and click the watch button. The user cards should reload.
+At the moment, no JS initialization would re-trigger (fortunately there is no JS for this page).
+-->
+<div class="no-loading-indicator tw-hidden"></div>
+<div class="user-cards"
+ hx-trigger="refreshUserCards from:body" hx-indicator=".no-loading-indicator"
+ hx-get="{{$.CurrentURL}}" hx-swap="outerHTML" hx-select=".user-cards"
+>
{{if .CardsTitle}}
<h2 class="ui dividing header">
{{.CardsTitle}}