diff options
author | techknowlogick <techknowlogick@gitea.io> | 2023-03-14 03:45:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 03:45:21 -0400 |
commit | 03591f0f95823a0b1dcca969d2a3ed505c7e6d73 (patch) | |
tree | 0117b3cf1f27b4f0f7a0346fcf724fa3af0e3f8f /models | |
parent | aac07d010f261c00fb3bd9644c71dc108c668c11 (diff) | |
download | gitea-03591f0f95823a0b1dcca969d2a3ed505c7e6d73.tar.gz gitea-03591f0f95823a0b1dcca969d2a3ed505c7e6d73.zip |
add user rename endpoint to admin api (#22789)
this is a simple endpoint that adds the ability to rename users to the
admin API.
Note: this is not in a mergeable state. It would be better if this was
handled by a PATCH/POST to the /api/v1/admin/users/{username} endpoint
and the username is modified.
---------
Co-authored-by: Jason Song <i@wolfogre.com>
Diffstat (limited to 'models')
-rw-r--r-- | models/issues/pull.go | 4 | ||||
-rw-r--r-- | models/user/user.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/models/issues/pull.go b/models/issues/pull.go index 6a1dc31556..a15ebec0b5 100644 --- a/models/issues/pull.go +++ b/models/issues/pull.go @@ -660,10 +660,10 @@ func GetPullRequestByIssueID(ctx context.Context, issueID int64) (*PullRequest, // GetAllUnmergedAgitPullRequestByPoster get all unmerged agit flow pull request // By poster id. -func GetAllUnmergedAgitPullRequestByPoster(uid int64) ([]*PullRequest, error) { +func GetAllUnmergedAgitPullRequestByPoster(ctx context.Context, uid int64) ([]*PullRequest, error) { pulls := make([]*PullRequest, 0, 10) - err := db.GetEngine(db.DefaultContext). + err := db.GetEngine(ctx). Where("has_merged=? AND flow = ? AND issue.is_closed=? AND issue.poster_id=?", false, PullRequestFlowAGit, false, uid). Join("INNER", "issue", "issue.id=pull_request.issue_id"). diff --git a/models/user/user.go b/models/user/user.go index 454779b9ea..82c2d3b6cd 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -742,13 +742,13 @@ func VerifyUserActiveCode(code string) (user *User) { } // ChangeUserName changes all corresponding setting from old user name to new one. -func ChangeUserName(u *User, newUserName string) (err error) { +func ChangeUserName(ctx context.Context, u *User, newUserName string) (err error) { oldUserName := u.Name if err = IsUsableUsername(newUserName); err != nil { return err } - ctx, committer, err := db.TxContext(db.DefaultContext) + ctx, committer, err := db.TxContext(ctx) if err != nil { return err } |