diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2020-02-13 00:19:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-12 23:19:35 +0000 |
commit | 9ff4e1d2d9636ea8aa328427f1d31c962221263e (patch) | |
tree | b0df096e3885a6f05c26959f784cca0ce6a9763c /models/user.go | |
parent | 908f8952be3ba7a4e4c32b0fd0dab5eb08ca8dd4 (diff) | |
download | gitea-9ff4e1d2d9636ea8aa328427f1d31c962221263e.tar.gz gitea-9ff4e1d2d9636ea8aa328427f1d31c962221263e.zip |
Add API branch protection endpoint (#9311)
* add API branch protection endpoint
* lint
* Change to use team names instead of ids.
* Status codes.
* fix
* Fix
* Add new branch protection options (BlockOnRejectedReviews, DismissStaleApprovals, RequireSignedCommits)
* Do xorm query directly
* fix xorm GetUserNamesByIDs
* Add some tests
* Improved GetTeamNamesByID
* http status created for CreateBranchProtection
* Correct status code in integration test
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go index 220a9f9a9a..0e493dbef7 100644 --- a/models/user.go +++ b/models/user.go @@ -1386,6 +1386,17 @@ func GetMaileableUsersByIDs(ids []int64) ([]*User, error) { Find(&ous) } +// GetUserNamesByIDs returns usernames for all resolved users from a list of Ids. +func GetUserNamesByIDs(ids []int64) ([]string, error) { + unames := make([]string, 0, len(ids)) + err := x.In("id", ids). + Table("user"). + Asc("name"). + Cols("name"). + Find(&unames) + return unames, err +} + // GetUsersByIDs returns all resolved users from a list of Ids. func GetUsersByIDs(ids []int64) ([]*User, error) { ous := make([]*User, 0, len(ids)) |