Update services/convert/issue.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny XiaoandCopilot authored and GitHub committed 2026-02-19 14:09:53 -08:00
1 parent 9342bc914f
commit 085b892aec
1 file changed
+16 -14
+16 -14
View File
@@ -228,22 +228,24 @@ func ToTrackedTimeList(ctx context.Context, doer *user_model.User, tl issues_mod
result := make([]*api.TrackedTime, 0, len(tl))
permCache := make(map[int64]access_model.Permission)
for _, t := range tl {
if t.Issue != nil {
if err := t.Issue.LoadRepo(ctx); err != nil {
continue
}
perm, ok := permCache[t.Issue.RepoID]
if !ok {
var err error
perm, err = access_model.GetUserRepoPermission(ctx, t.Issue.Repo, doer)
if err != nil {
continue
}
permCache[t.Issue.RepoID] = perm
}
if !perm.CanReadIssuesOrPulls(t.Issue.IsPull) {
// If the issue is not loaded, conservatively skip this entry to avoid bypassing permission checks.
if t.Issue == nil {
continue
}
if err := t.Issue.LoadRepo(ctx); err != nil {
continue
}
perm, ok := permCache[t.Issue.RepoID]
if !ok {
var err error
perm, err = access_model.GetUserRepoPermission(ctx, t.Issue.Repo, doer)
if err != nil {
continue
}
permCache[t.Issue.RepoID] = perm
}
if !perm.CanReadIssuesOrPulls(t.Issue.IsPull) {
continue
}
result = append(result, ToTrackedTime(ctx, doer, t))
}