1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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:
6543
2020-02-26 07:32:22 +01:00
committed by GitHub
parent e5944a9521
commit 084a2b0026
8 changed files with 66 additions and 80 deletions

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
}