summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2016-11-19 14:30:37 -0200
committerGitHub <noreply@github.com>2016-11-19 14:30:37 -0200
commitbd13c816845356e96be507b69b8c733cc788b2d2 (patch)
tree059f1b6d40797680a60aec0b81df583e12c6bb85 /routers
parentcf045b029cc11dc48c3a626441b7017710088823 (diff)
parent7b75d93f3da42a9ea1783b0cb85f88977549cf05 (diff)
downloadgitea-bd13c816845356e96be507b69b8c733cc788b2d2.tar.gz
gitea-bd13c816845356e96be507b69b8c733cc788b2d2.zip
Merge pull request #196 from Bwko/fix/commit-view-panic
Fix panic when no user is signed in
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/middlewares.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go
index 757a049ab7..11b0009dbf 100644
--- a/routers/repo/middlewares.go
+++ b/routers/repo/middlewares.go
@@ -23,10 +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" {