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>
This commit is contained in:
6543andguillep2k authored and GitHub committed 2020-02-26 03:32:22 -03:00
1 parent e5944a9521
commit 084a2b0026
8 files changed
+66 -80

No files matched your search

+7 -2
View File
@@ -190,9 +190,14 @@ func GetIssueSubscribers(ctx *context.APIContext) {
return
}
users, err := iwl.LoadWatchUsers()
var userIDs = make([]int64, 0, len(iwl))
for _, iw := range iwl {
userIDs = append(userIDs, iw.UserID)
}
users, err := models.GetUsersByIDs(userIDs)
if err != nil {
ctx.Error(http.StatusInternalServerError, "LoadWatchUsers", err)
ctx.Error(http.StatusInternalServerError, "GetUsersByIDs", err)
return
}