forked from forgejo/forgejo
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:
parent
e5944a9521
commit
084a2b0026
8 changed files with 66 additions and 80 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue