diff options
author | Bwko <bouwko@gmail.com> | 2016-11-19 16:53:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-19 16:53:34 +0100 |
commit | 7b75d93f3da42a9ea1783b0cb85f88977549cf05 (patch) | |
tree | 059f1b6d40797680a60aec0b81df583e12c6bb85 | |
parent | fc3ed8a1de0e35eefff083176211c4eb61a264ca (diff) | |
download | gitea-7b75d93f3da42a9ea1783b0cb85f88977549cf05.tar.gz gitea-7b75d93f3da42a9ea1783b0cb85f88977549cf05.zip |
Fix for anonymous users to switch views
-rw-r--r-- | routers/repo/middlewares.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go index b16b003cfe..11b0009dbf 100644 --- a/routers/repo/middlewares.go +++ b/routers/repo/middlewares.go @@ -23,14 +23,16 @@ func SetEditorconfigIfExists(ctx *context.Context) { } func SetDiffViewStyle(ctx *context.Context) { + queryStyle := ctx.Query("style") + if !ctx.IsSigned { + ctx.Data["IsSplitStyle"] = queryStyle == "split" return } var ( - userStyle = ctx.User.DiffViewStyle - queryStyle = ctx.Query("style") - style string + userStyle = ctx.User.DiffViewStyle + style string ) if queryStyle == "unified" || queryStyle == "split" { |