diff options
Diffstat (limited to 'routers/web/admin')
-rw-r--r-- | routers/web/admin/admin.go | 2 | ||||
-rw-r--r-- | routers/web/admin/auths.go | 6 | ||||
-rw-r--r-- | routers/web/admin/emails.go | 2 | ||||
-rw-r--r-- | routers/web/admin/notice.go | 2 | ||||
-rw-r--r-- | routers/web/admin/orgs.go | 2 | ||||
-rw-r--r-- | routers/web/admin/repos.go | 6 | ||||
-rw-r--r-- | routers/web/admin/users.go | 10 | ||||
-rw-r--r-- | routers/web/admin/users_test.go | 10 |
8 files changed, 20 insertions, 20 deletions
diff --git a/routers/web/admin/admin.go b/routers/web/admin/admin.go index fac3ef9622..63bc7de7d7 100644 --- a/routers/web/admin/admin.go +++ b/routers/web/admin/admin.go @@ -149,7 +149,7 @@ func DashboardPost(ctx *context.Context) { if form.Op != "" { task := cron.GetTask(form.Op) if task != nil { - go task.RunWithUser(ctx.User, nil) + go task.RunWithUser(ctx.Doer, nil) ctx.Flash.Success(ctx.Tr("admin.dashboard.task.started", ctx.Tr("admin.dashboard."+form.Op))) } else { ctx.Flash.Error(ctx.Tr("admin.dashboard.task.unknown", form.Op)) diff --git a/routers/web/admin/auths.go b/routers/web/admin/auths.go index 4c77a169ae..1d72a88aa1 100644 --- a/routers/web/admin/auths.go +++ b/routers/web/admin/auths.go @@ -310,7 +310,7 @@ func NewAuthSourcePost(ctx *context.Context) { return } - log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.Name) + log.Trace("Authentication created by admin(%s): %s", ctx.Doer.Name, form.Name) ctx.Flash.Success(ctx.Tr("admin.auths.new_success", form.Name)) ctx.Redirect(setting.AppSubURL + "/admin/auths") @@ -413,7 +413,7 @@ func EditAuthSourcePost(ctx *context.Context) { } return } - log.Trace("Authentication changed by admin(%s): %d", ctx.User.Name, source.ID) + log.Trace("Authentication changed by admin(%s): %d", ctx.Doer.Name, source.ID) ctx.Flash.Success(ctx.Tr("admin.auths.update_success")) ctx.Redirect(setting.AppSubURL + "/admin/auths/" + strconv.FormatInt(form.ID, 10)) @@ -438,7 +438,7 @@ func DeleteAuthSource(ctx *context.Context) { }) return } - log.Trace("Authentication deleted by admin(%s): %d", ctx.User.Name, source.ID) + log.Trace("Authentication deleted by admin(%s): %d", ctx.Doer.Name, source.ID) ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success")) ctx.JSON(http.StatusOK, map[string]interface{}{ diff --git a/routers/web/admin/emails.go b/routers/web/admin/emails.go index b94f9d72c4..9482ae0123 100644 --- a/routers/web/admin/emails.go +++ b/routers/web/admin/emails.go @@ -87,7 +87,7 @@ func Emails(ctx *context.Context) { emails[i].SearchEmailResult = *baseEmails[i] // Don't let the admin deactivate its own primary email address // We already know the user is admin - emails[i].CanChange = ctx.User.ID != emails[i].UID || !emails[i].IsPrimary + emails[i].CanChange = ctx.Doer.ID != emails[i].UID || !emails[i].IsPrimary } } ctx.Data["Keyword"] = opts.Keyword diff --git a/routers/web/admin/notice.go b/routers/web/admin/notice.go index 3613f428ed..147e03ba03 100644 --- a/routers/web/admin/notice.go +++ b/routers/web/admin/notice.go @@ -73,7 +73,7 @@ func EmptyNotices(ctx *context.Context) { return } - log.Trace("System notices deleted by admin (%s): [start: %d]", ctx.User.Name, 0) + log.Trace("System notices deleted by admin (%s): [start: %d]", ctx.Doer.Name, 0) ctx.Flash.Success(ctx.Tr("admin.notices.delete_success")) ctx.Redirect(setting.AppSubURL + "/admin/notices") } diff --git a/routers/web/admin/orgs.go b/routers/web/admin/orgs.go index 3d440d83cb..6081ab9b1c 100644 --- a/routers/web/admin/orgs.go +++ b/routers/web/admin/orgs.go @@ -26,7 +26,7 @@ func Organizations(ctx *context.Context) { ctx.Data["PageIsAdminOrganizations"] = true explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{ - Actor: ctx.User, + Actor: ctx.Doer, Type: user_model.UserTypeOrganization, ListOptions: db.ListOptions{ PageSize: setting.UI.Admin.OrgPagingNum, diff --git a/routers/web/admin/repos.go b/routers/web/admin/repos.go index c4290fc22b..fb7be12c35 100644 --- a/routers/web/admin/repos.go +++ b/routers/web/admin/repos.go @@ -52,7 +52,7 @@ func DeleteRepo(ctx *context.Context) { ctx.Repo.GitRepo.Close() } - if err := repo_service.DeleteRepository(ctx, ctx.User, repo, true); err != nil { + if err := repo_service.DeleteRepository(ctx, ctx.Doer, repo, true); err != nil { ctx.ServerError("DeleteRepository", err) return } @@ -148,7 +148,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) { if has || !isDir { // Fallthrough to failure mode } else if action == "adopt" { - if _, err := repo_service.AdoptRepository(ctx.User, ctxUser, models.CreateRepoOptions{ + if _, err := repo_service.AdoptRepository(ctx.Doer, ctxUser, models.CreateRepoOptions{ Name: dirSplit[1], IsPrivate: true, }); err != nil { @@ -157,7 +157,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) { } ctx.Flash.Success(ctx.Tr("repo.adopt_preexisting_success", dir)) } else if action == "delete" { - if err := repo_service.DeleteUnadoptedRepository(ctx.User, ctxUser, dirSplit[1]); err != nil { + if err := repo_service.DeleteUnadoptedRepository(ctx.Doer, ctxUser, dirSplit[1]); err != nil { ctx.ServerError("repository.AdoptRepository", err) return } diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index a7d7d62d9a..454e4ce07e 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -63,7 +63,7 @@ func Users(ctx *context.Context) { } explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{ - Actor: ctx.User, + Actor: ctx.Doer, Type: user_model.UserTypeIndividual, ListOptions: db.ListOptions{ PageSize: setting.UI.Admin.UserPagingNum, @@ -191,7 +191,7 @@ func NewUserPost(ctx *context.Context) { } return } - log.Trace("Account created by admin (%s): %s", ctx.User.Name, u.Name) + log.Trace("Account created by admin (%s): %s", ctx.Doer.Name, u.Name) // Send email notification. if form.SendNotify { @@ -379,7 +379,7 @@ func EditUserPost(ctx *context.Context) { u.Visibility = form.Visibility // skip self Prohibit Login - if ctx.User.ID == u.ID { + if ctx.Doer.ID == u.ID { u.ProhibitLogin = false } else { u.ProhibitLogin = form.ProhibitLogin @@ -398,7 +398,7 @@ func EditUserPost(ctx *context.Context) { } return } - log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name) + log.Trace("Account profile updated by admin (%s): %s", ctx.Doer.Name, u.Name) ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success")) ctx.Redirect(setting.AppSubURL + "/admin/users/" + url.PathEscape(ctx.Params(":userid"))) @@ -429,7 +429,7 @@ func DeleteUser(ctx *context.Context) { } return } - log.Trace("Account deleted by admin (%s): %s", ctx.User.Name, u.Name) + log.Trace("Account deleted by admin (%s): %s", ctx.Doer.Name, u.Name) ctx.Flash.Success(ctx.Tr("admin.users.deletion_success")) ctx.JSON(http.StatusOK, map[string]interface{}{ diff --git a/routers/web/admin/users_test.go b/routers/web/admin/users_test.go index 46133688a5..9de548685c 100644 --- a/routers/web/admin/users_test.go +++ b/routers/web/admin/users_test.go @@ -27,7 +27,7 @@ func TestNewUserPost_MustChangePassword(t *testing.T) { ID: 2, }).(*user_model.User) - ctx.User = u + ctx.Doer = u username := "gitea" email := "gitea@gitea.io" @@ -64,7 +64,7 @@ func TestNewUserPost_MustChangePasswordFalse(t *testing.T) { ID: 2, }).(*user_model.User) - ctx.User = u + ctx.Doer = u username := "gitea" email := "gitea@gitea.io" @@ -101,7 +101,7 @@ func TestNewUserPost_InvalidEmail(t *testing.T) { ID: 2, }).(*user_model.User) - ctx.User = u + ctx.Doer = u username := "gitea" email := "gitea@gitea.io\r\n" @@ -131,7 +131,7 @@ func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) { ID: 2, }).(*user_model.User) - ctx.User = u + ctx.Doer = u username := "gitea" email := "gitea@gitea.io" @@ -169,7 +169,7 @@ func TestNewUserPost_VisibilityPrivate(t *testing.T) { ID: 2, }).(*user_model.User) - ctx.User = u + ctx.Doer = u username := "gitea" email := "gitea@gitea.io" |