Explorar o código

Fix panic when view issue without login

Unknown %!s(int64=11) %!d(string=hai) anos
pai
achega
4ef9494637
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  1. 6 4
      routers/repo/issue.go

+ 6 - 4
routers/repo/issue.go

@@ -254,10 +254,12 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) {
 		}
 	}
 
-	// Update issue-user.
-	if err = models.UpdateIssueUserPairByRead(ctx.User.Id, issue.Id); err != nil {
-		ctx.Handle(500, "issue.ViewIssue(UpdateIssueUserPairByRead): %v", err)
-		return
+	if ctx.IsSigned {
+		// Update issue-user.
+		if err = models.UpdateIssueUserPairByRead(ctx.User.Id, issue.Id); err != nil {
+			ctx.Handle(500, "issue.ViewIssue(UpdateIssueUserPairByRead): %v", err)
+			return
+		}
 	}
 
 	// Get poster and Assignee.