diff options
author | 6543 <6543@obermui.de> | 2020-02-26 07:32:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 03:32:22 -0300 |
commit | 084a2b00268ed561f59ac19b1b6660a3c58573b3 (patch) | |
tree | 5474cb8c1bd5a16251edf46cd99d54757e3ebc0c /models/repo_watch.go | |
parent | e5944a9521102c4917399a6550a0756919527944 (diff) | |
download | gitea-084a2b00268ed561f59ac19b1b6660a3c58573b3.tar.gz gitea-084a2b00268ed561f59ac19b1b6660a3c58573b3.zip |
Code Refactor of IssueWatch related things (#10401)
* refactor
* optimize
* remove Iretating function
LoadWatchUsers do not load Users into IW object and it is used only in api ... so move this logic
* remove unessesary
* Apply suggestions from code review
Thx
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* make Tests more robust
* fix rebase
* restart CI
* CI no dont hit sqlites deadlock
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'models/repo_watch.go')
-rw-r--r-- | models/repo_watch.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/models/repo_watch.go b/models/repo_watch.go index a9d56eff03..11cfa88918 100644 --- a/models/repo_watch.go +++ b/models/repo_watch.go @@ -144,8 +144,12 @@ func GetWatchers(repoID int64) ([]*Watch, error) { // but avoids joining with `user` for performance reasons // User permissions must be verified elsewhere if required func GetRepoWatchersIDs(repoID int64) ([]int64, error) { + return getRepoWatchersIDs(x, repoID) +} + +func getRepoWatchersIDs(e Engine, repoID int64) ([]int64, error) { ids := make([]int64, 0, 64) - return ids, x.Table("watch"). + return ids, e.Table("watch"). Where("watch.repo_id=?", repoID). And("watch.mode<>?", RepoWatchModeDont). Select("user_id"). |