summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-02-26 07:32:22 +0100
committerGitHub <noreply@github.com>2020-02-26 03:32:22 -0300
commit084a2b00268ed561f59ac19b1b6660a3c58573b3 (patch)
tree5474cb8c1bd5a16251edf46cd99d54757e3ebc0c /routers
parente5944a9521102c4917399a6550a0756919527944 (diff)
downloadgitea-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 'routers')
-rw-r--r--routers/api/v1/repo/issue_subscription.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/api/v1/repo/issue_subscription.go b/routers/api/v1/repo/issue_subscription.go
index 274da966fd..0406edd207 100644
--- a/routers/api/v1/repo/issue_subscription.go
+++ b/routers/api/v1/repo/issue_subscription.go
@@ -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
}