diff options
author | Unknwon <u@gogs.io> | 2017-04-06 23:48:49 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-06 23:48:49 -0400 |
commit | ac43eab51f9ac0d4c4bcc6db2bbc9ce3dbb34b7b (patch) | |
tree | 4e5fd54b821ef1af312e4d1f1c1a9befad7054a7 /routers | |
parent | 8d0417497b39aa196400d39c99bbd79cfb364f9f (diff) |
Refactoring: rename Signed -> Logged
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/api.go | 8 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/user.go | 4 | ||||
-rw-r--r-- | routers/home.go | 2 | ||||
-rw-r--r-- | routers/repo/issue.go | 18 | ||||
-rw-r--r-- | routers/repo/pull.go | 2 | ||||
-rw-r--r-- | routers/user/home.go | 4 | ||||
-rw-r--r-- | routers/user/profile.go | 4 |
8 files changed, 22 insertions, 22 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index d4aa8aee..b54e47b7 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -34,7 +34,7 @@ func repoAssignment() macaron.Handler { ) // Check if the user is the same as the repository owner. - if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) { + if ctx.IsLogged && ctx.User.LowerName == strings.ToLower(userName) { owner = ctx.User } else { owner, err = models.GetUserByName(userName) @@ -63,7 +63,7 @@ func repoAssignment() macaron.Handler { return } - if ctx.IsSigned && ctx.User.IsAdmin { + if ctx.IsLogged && ctx.User.IsAdmin { ctx.Repo.AccessMode = models.ACCESS_MODE_OWNER } else { mode, err := models.AccessLevel(ctx.User.ID, repo) @@ -86,7 +86,7 @@ func repoAssignment() macaron.Handler { // Contexter middleware already checks token for user sign in process. func reqToken() macaron.Handler { return func(ctx *context.Context) { - if !ctx.IsSigned { + if !ctx.IsLogged { ctx.Error(401) return } @@ -104,7 +104,7 @@ func reqBasicAuth() macaron.Handler { func reqAdmin() macaron.Handler { return func(ctx *context.Context) { - if !ctx.IsSigned || !ctx.User.IsAdmin { + if !ctx.IsLogged || !ctx.User.IsAdmin { ctx.Error(403) return } diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index e095954a..fdb3e7a5 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -28,7 +28,7 @@ func Search(ctx *context.APIContext) { } // Check visibility. - if ctx.IsSigned && opts.OwnerID > 0 { + if ctx.IsLogged && opts.OwnerID > 0 { if ctx.User.ID == opts.OwnerID { opts.Private = true } else { diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index d797c650..11c3b8bb 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -41,7 +41,7 @@ func Search(ctx *context.APIContext) { AvatarUrl: users[i].AvatarLink(), FullName: users[i].FullName, } - if ctx.IsSigned { + if ctx.IsLogged { results[i].Email = users[i].Email } } @@ -64,7 +64,7 @@ func GetInfo(ctx *context.APIContext) { } // Hide user e-mail when API caller isn't signed in. - if !ctx.IsSigned { + if !ctx.IsLogged { u.Email = "" } ctx.JSON(200, u.APIFormat()) diff --git a/routers/home.go b/routers/home.go index eaf33815..7d9ee27b 100644 --- a/routers/home.go +++ b/routers/home.go @@ -21,7 +21,7 @@ const ( ) func Home(ctx *context.Context) { - if ctx.IsSigned { + if ctx.IsLogged { if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { ctx.Data["Title"] = ctx.Tr("auth.active_your_account") ctx.HTML(200, user.ACTIVATE) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 61401b43..72b1a388 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -70,7 +70,7 @@ func MustAllowPulls(ctx *context.Context) { } // User can send pull request if owns a forked repository. - if ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID) { + if ctx.IsLogged && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID) { ctx.Repo.PullRequest.Allowed = true ctx.Repo.PullRequest.HeadInfo = ctx.User.Name + ":" + ctx.Repo.BranchName } @@ -115,7 +115,7 @@ func issues(ctx *context.Context, isPullList bool) { } // Must sign in to see issues about you. - if viewType != "all" && !ctx.IsSigned { + if viewType != "all" && !ctx.IsLogged { ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL) ctx.Redirect(setting.AppSubURL + "/user/login") return @@ -138,7 +138,7 @@ func issues(ctx *context.Context, isPullList bool) { } var uid int64 = -1 - if ctx.IsSigned { + if ctx.IsLogged { uid = ctx.User.ID } @@ -197,7 +197,7 @@ func issues(ctx *context.Context, isPullList bool) { // Get posters. for i := range issues { - if !ctx.IsSigned { + if !ctx.IsLogged { issues[i].IsRead = true continue } @@ -587,7 +587,7 @@ func viewIssue(ctx *context.Context, isPullList bool) { } } - if ctx.IsSigned { + if ctx.IsLogged { // Update issue-user. if err = issue.ReadBy(ctx.User.ID); err != nil { ctx.Handle(500, "ReadBy", err) @@ -652,7 +652,7 @@ func viewIssue(ctx *context.Context, isPullList bool) { ctx.Data["Participants"] = participants ctx.Data["NumParticipants"] = len(participants) ctx.Data["Issue"] = issue - ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID)) + ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsLogged && issue.IsPoster(ctx.User.ID)) ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string) ctx.HTML(200, ISSUE_VIEW) } @@ -687,7 +687,7 @@ func UpdateIssueTitle(ctx *context.Context) { return } - if !ctx.IsSigned || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter()) { + if !ctx.IsLogged || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter()) { ctx.Error(403) return } @@ -714,7 +714,7 @@ func UpdateIssueContent(ctx *context.Context) { return } - if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.IsWriter()) { + if !ctx.IsLogged || (ctx.User.ID != issue.PosterID && !ctx.Repo.IsWriter()) { ctx.Error(403) return } @@ -843,7 +843,7 @@ func NewComment(ctx *context.Context, f form.CreateComment) { var comment *models.Comment defer func() { // Check if issue admin/poster changes the status of issue. - if (ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))) && + if (ctx.Repo.IsWriter() || (ctx.IsLogged && issue.IsPoster(ctx.User.ID))) && (f.Status == "reopen" || f.Status == "close") && !(issue.IsPull && issue.PullRequest.HasMerged) { diff --git a/routers/repo/pull.go b/routers/repo/pull.go index b88500e8..15e283d1 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -153,7 +153,7 @@ func checkPullInfo(ctx *context.Context) *models.Issue { return nil } - if ctx.IsSigned { + if ctx.IsLogged { // Update issue-user. if err = issue.ReadBy(ctx.User.ID); err != nil { ctx.Handle(500, "ReadBy", err) diff --git a/routers/user/home.go b/routers/user/home.go index 745c2afa..431c196d 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -379,7 +379,7 @@ func showOrgProfile(ctx *context.Context) { count int64 err error ) - if ctx.IsSigned && !ctx.User.IsAdmin { + if ctx.IsLogged && !ctx.User.IsAdmin { repos, count, err = org.GetUserRepositories(ctx.User.ID, page, setting.UI.User.RepoPagingNum) if err != nil { ctx.Handle(500, "GetUserRepositories", err) @@ -387,7 +387,7 @@ func showOrgProfile(ctx *context.Context) { } ctx.Data["Repos"] = repos } else { - showPrivate := ctx.IsSigned && ctx.User.IsAdmin + showPrivate := ctx.IsLogged && ctx.User.IsAdmin repos, err = models.GetUserRepositories(&models.UserRepoOptions{ UserID: org.ID, Private: showPrivate, diff --git a/routers/user/profile.go b/routers/user/profile.go index baf9a941..649814f0 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -73,7 +73,7 @@ func Profile(ctx *context.Context) { ctx.Data["PageIsUserProfile"] = true ctx.Data["Owner"] = ctxUser - orgs, err := models.GetOrgsByUserID(ctxUser.ID, ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)) + orgs, err := models.GetOrgsByUserID(ctxUser.ID, ctx.IsLogged && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)) if err != nil { ctx.Handle(500, "GetOrgsByUserIDDesc", err) return @@ -95,7 +95,7 @@ func Profile(ctx *context.Context) { page = 1 } - showPrivate := ctx.IsSigned && (ctxUser.ID == ctx.User.ID || ctx.User.IsAdmin) + showPrivate := ctx.IsLogged && (ctxUser.ID == ctx.User.ID || ctx.User.IsAdmin) ctx.Data["Repos"], err = models.GetUserRepositories(&models.UserRepoOptions{ UserID: ctxUser.ID, Private: showPrivate, |