Fixed - [navbar] [sticky-ui] [cookies] Kept the persistent navigation bar sticky for signed-out pages by reusing the saved preference from a site cookie.
- 1 - I updated `modules/web/middleware/cookie.go`, `routers/common/pagetmpl.go`, and `routers/web/user/setting/profile.go` to add a dedicated `gitea_persistent_navbar` cookie, synchronize it when authenticated users save or load the preference, and reuse that cookie as the anonymous-page fallback so the navbar stays sticky after logout just like the footer already does.
This commit is contained in:
@@ -808,3 +808,6 @@ History search guidance:
|
|||||||
|
|
||||||
161 - [2026-05-19 23:43:29] - v1.27.0-dev-172-g06e5bd7f46 - Type: Modified - [scripts] [configure] [git-lfs] Added conditional Git LFS setup to `configure.sh` when repository LFS hooks are installed.
|
161 - [2026-05-19 23:43:29] - v1.27.0-dev-172-g06e5bd7f46 - Type: Modified - [scripts] [configure] [git-lfs] Added conditional Git LFS setup to `configure.sh` when repository LFS hooks are installed.
|
||||||
- 1 - I updated `.configure.sh` so repositories that already have Git LFS hook scripts in `.git/hooks` now treat `git-lfs` as a required dependency during verification, install the `git-lfs` system package on supported package managers, and run `git lfs install --local` during non-verify setup.
|
- 1 - I updated `.configure.sh` so repositories that already have Git LFS hook scripts in `.git/hooks` now treat `git-lfs` as a required dependency during verification, install the `git-lfs` system package on supported package managers, and run `git lfs install --local` during non-verify setup.
|
||||||
|
|
||||||
|
162 - [2026-05-20 00:31:49] - v1.27.0-dev-173-gb66ec8c19d - Type: Fixed - [navbar] [sticky-ui] [cookies] Kept the persistent navigation bar sticky for signed-out pages by reusing the saved preference from a site cookie.
|
||||||
|
- 1 - I updated `modules/web/middleware/cookie.go`, `routers/common/pagetmpl.go`, and `routers/web/user/setting/profile.go` to add a dedicated `gitea_persistent_navbar` cookie, synchronize it when authenticated users save or load the preference, and reuse that cookie as the anonymous-page fallback so the navbar stays sticky after logout just like the footer already does.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const (
|
|||||||
CookieWebBannerDismissed = "gitea_disbnr"
|
CookieWebBannerDismissed = "gitea_disbnr"
|
||||||
CookieTheme = "gitea_theme"
|
CookieTheme = "gitea_theme"
|
||||||
CookiePersistentFooter = "gitea_persistent_footer"
|
CookiePersistentFooter = "gitea_persistent_footer"
|
||||||
|
CookiePersistentNavbar = "gitea_persistent_navbar"
|
||||||
cookieRedirectTo = "redirect_to"
|
cookieRedirectTo = "redirect_to"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ func PageGlobalData(ctx *context.Context) {
|
|||||||
log.Error("GetUserSetting[%s] for user %d: %v", user_model.SettingsKeyPersistentNavbar, ctx.Doer.ID, err)
|
log.Error("GetUserSetting[%s] for user %d: %v", user_model.SettingsKeyPersistentNavbar, ctx.Doer.ID, err)
|
||||||
} else {
|
} else {
|
||||||
showPersistentNavbar, _ = strconv.ParseBool(val)
|
showPersistentNavbar, _ = strconv.ParseBool(val)
|
||||||
|
ctx.SetSiteCookie(middleware.CookiePersistentNavbar, strconv.FormatBool(showPersistentNavbar), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
val, err = user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyStickySideMenus, "false")
|
val, err = user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyStickySideMenus, "false")
|
||||||
@@ -111,6 +112,7 @@ func PageGlobalData(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showPersistentFooter, _ = strconv.ParseBool(middleware.GetSiteCookie(ctx.Req, middleware.CookiePersistentFooter))
|
showPersistentFooter, _ = strconv.ParseBool(middleware.GetSiteCookie(ctx.Req, middleware.CookiePersistentFooter))
|
||||||
|
showPersistentNavbar, _ = strconv.ParseBool(middleware.GetSiteCookie(ctx.Req, middleware.CookiePersistentNavbar))
|
||||||
}
|
}
|
||||||
ctx.Data["ShowPersistentFooter"] = showPersistentFooter
|
ctx.Data["ShowPersistentFooter"] = showPersistentFooter
|
||||||
ctx.Data["ShowPersistentNavbar"] = showPersistentNavbar
|
ctx.Data["ShowPersistentNavbar"] = showPersistentNavbar
|
||||||
|
|||||||
@@ -465,6 +465,7 @@ func UpdatePersistentLayout(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.SetSiteCookie(middleware.CookiePersistentNavbar, strconv.FormatBool(showPersistentNavbar), 0)
|
||||||
ctx.SetSiteCookie(middleware.CookiePersistentFooter, strconv.FormatBool(showPersistentFooter), 0)
|
ctx.SetSiteCookie(middleware.CookiePersistentFooter, strconv.FormatBool(showPersistentFooter), 0)
|
||||||
|
|
||||||
log.Trace("User settings updated: %s", ctx.Doer.Name)
|
log.Trace("User settings updated: %s", ctx.Doer.Name)
|
||||||
@@ -481,6 +482,8 @@ func UpdatePersistentNavbar(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.SetSiteCookie(middleware.CookiePersistentNavbar, strconv.FormatBool(showPersistentNavbar), 0)
|
||||||
|
|
||||||
log.Trace("User settings updated: %s", ctx.Doer.Name)
|
log.Trace("User settings updated: %s", ctx.Doer.Name)
|
||||||
ctx.Flash.Success(ctx.Tr("settings.saved_successfully"))
|
ctx.Flash.Success(ctx.Tr("settings.saved_successfully"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings/appearance")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/appearance")
|
||||||
|
|||||||
Reference in New Issue
Block a user