]> source.dussan.org Git - gitea.git/commitdiff
Fix missed doer (#30231) (#30343)
authorGiteabot <teabot@gitea.io>
Mon, 8 Apr 2024 23:42:45 +0000 (07:42 +0800)
committerGitHub <noreply@github.com>
Mon, 8 Apr 2024 23:42:45 +0000 (02:42 +0300)
Backport #30231 by @lunny

Fix #29879

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
routers/api/v1/repo/issue.go
routers/api/v1/repo/issue_attachment.go
routers/api/v1/repo/issue_dependency.go
routers/api/v1/repo/issue_pin.go
routers/api/v1/repo/issue_tracked_time.go
routers/web/repo/issue.go
services/actions/notifier.go
services/convert/issue.go
services/convert/issue_comment.go
services/convert/pull.go
services/webhook/notifier.go

index 6934b34b24bcbe7bc49f4904597dab9a1de71fd6..5e173abf883119ad613a776af2c12bb228fcf2b8 100644 (file)
@@ -311,7 +311,7 @@ func SearchIssues(ctx *context.APIContext) {
 
        ctx.SetLinkHeader(int(total), limit)
        ctx.SetTotalCountHeader(total)
-       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
+       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
 }
 
 // ListIssues list the issues of a repository
@@ -548,7 +548,7 @@ func ListIssues(ctx *context.APIContext) {
 
        ctx.SetLinkHeader(int(total), listOptions.PageSize)
        ctx.SetTotalCountHeader(total)
-       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
+       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
 }
 
 func getUserIDForFilter(ctx *context.APIContext, queryName string) int64 {
@@ -614,7 +614,7 @@ func GetIssue(ctx *context.APIContext) {
                ctx.NotFound()
                return
        }
-       ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue))
+       ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, ctx.Doer, issue))
 }
 
 // CreateIssue create an issue of a repository
@@ -737,7 +737,7 @@ func CreateIssue(ctx *context.APIContext) {
                ctx.Error(http.StatusInternalServerError, "GetIssueByID", err)
                return
        }
-       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, issue))
+       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, issue))
 }
 
 // EditIssue modify an issue of a repository
@@ -911,7 +911,7 @@ func EditIssue(ctx *context.APIContext) {
                ctx.InternalServerError(err)
                return
        }
-       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, issue))
+       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, issue))
 }
 
 func DeleteIssue(ctx *context.APIContext) {
index d62e23aa0226082641473ac46ff17f641f687d5f..7a5c6d554da4f00ada6d491413ad361f98b207e2 100644 (file)
@@ -107,7 +107,7 @@ func ListIssueAttachments(ctx *context.APIContext) {
                return
        }
 
-       ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue).Attachments)
+       ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, ctx.Doer, issue).Attachments)
 }
 
 // CreateIssueAttachment creates an attachment and saves the given file
index a42920d4fd333582f98a2a7b21faa85d58328a70..c40e92c01bb728af0bf2b9496daa6f5291c4cc96 100644 (file)
@@ -153,7 +153,7 @@ func GetIssueDependencies(ctx *context.APIContext) {
                blockerIssues = append(blockerIssues, &blocker.Issue)
        }
 
-       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, blockerIssues))
+       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, blockerIssues))
 }
 
 // CreateIssueDependency create a new issue dependencies
@@ -214,7 +214,7 @@ func CreateIssueDependency(ctx *context.APIContext) {
                return
        }
 
-       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, target))
+       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, target))
 }
 
 // RemoveIssueDependency remove an issue dependency
@@ -275,7 +275,7 @@ func RemoveIssueDependency(ctx *context.APIContext) {
                return
        }
 
-       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, target))
+       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, target))
 }
 
 // GetIssueBlocks list issues that are blocked by this issue
@@ -381,7 +381,7 @@ func GetIssueBlocks(ctx *context.APIContext) {
                issues = append(issues, &depMeta.Issue)
        }
 
-       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
+       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
 }
 
 // CreateIssueBlocking block the issue given in the body by the issue in path
@@ -438,7 +438,7 @@ func CreateIssueBlocking(ctx *context.APIContext) {
                return
        }
 
-       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, dependency))
+       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, dependency))
 }
 
 // RemoveIssueBlocking unblock the issue given in the body by the issue in path
@@ -495,7 +495,7 @@ func RemoveIssueBlocking(ctx *context.APIContext) {
                return
        }
 
-       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, dependency))
+       ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, dependency))
 }
 
 func getParamsIssue(ctx *context.APIContext) *issues_model.Issue {
index 8fcf670fd0cbee96a3a21bab1ff1ee6c5b602385..af3e06332ade1dfd51188c78c3dbaa8cb846cc2e 100644 (file)
@@ -207,7 +207,7 @@ func ListPinnedIssues(ctx *context.APIContext) {
                return
        }
 
-       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
+       ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
 }
 
 // ListPinnedPullRequests returns a list of all pinned PRs
index c6405158819db132aee1db052fbdedbeeb096def..f83855efac111a5a53f8f4d4dd30092f47cadb2b 100644 (file)
@@ -138,7 +138,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
        }
 
        ctx.SetTotalCountHeader(count)
-       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
+       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
 }
 
 // AddTime add time manual to the given issue
@@ -225,7 +225,7 @@ func AddTime(ctx *context.APIContext) {
                ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
                return
        }
-       ctx.JSON(http.StatusOK, convert.ToTrackedTime(ctx, trackedTime))
+       ctx.JSON(http.StatusOK, convert.ToTrackedTime(ctx, user, trackedTime))
 }
 
 // ResetIssueTime reset time manual to the given issue
@@ -455,7 +455,7 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
                ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
                return
        }
-       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
+       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
 }
 
 // ListTrackedTimesByRepository lists all tracked times of the repository
@@ -567,7 +567,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
        }
 
        ctx.SetTotalCountHeader(count)
-       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
+       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
 }
 
 // ListMyTrackedTimes lists all tracked times of the current user
@@ -629,5 +629,5 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
        }
 
        ctx.SetTotalCountHeader(count)
-       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
+       ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
 }
index 6c2d4a73902a7597ad2ad81efa306abbe7de68f4..e4f2e9a2bc24d8b06d0f490667c6a917778d4c01 100644 (file)
@@ -2179,7 +2179,7 @@ func GetIssueInfo(ctx *context.Context) {
                }
        }
 
-       ctx.JSON(http.StatusOK, convert.ToIssue(ctx, issue))
+       ctx.JSON(http.StatusOK, convert.ToIssue(ctx, ctx.Doer, issue))
 }
 
 // UpdateIssueTitle change issue's title
@@ -2709,7 +2709,7 @@ func SearchIssues(ctx *context.Context) {
        }
 
        ctx.SetTotalCountHeader(total)
-       ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, issues))
+       ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, ctx.Doer, issues))
 }
 
 func getUserIDForFilter(ctx *context.Context, queryName string) int64 {
@@ -2879,7 +2879,7 @@ func ListIssues(ctx *context.Context) {
        }
 
        ctx.SetTotalCountHeader(total)
-       ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, issues))
+       ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, ctx.Doer, issues))
 }
 
 func BatchDeleteIssues(ctx *context.Context) {
index eec5f814da22daa1234557c365b3754572d6bd06..6551da39e7268d3809b7d6a9dc2bbe5cd07d3b3f 100644 (file)
@@ -49,7 +49,7 @@ func (n *actionsNotifier) NewIssue(ctx context.Context, issue *issues_model.Issu
        newNotifyInputFromIssue(issue, webhook_module.HookEventIssues).WithPayload(&api.IssuePayload{
                Action:     api.HookIssueOpened,
                Index:      issue.Index,
-               Issue:      convert.ToAPIIssue(ctx, issue),
+               Issue:      convert.ToAPIIssue(ctx, issue.Poster, issue),
                Repository: convert.ToRepo(ctx, issue.Repo, permission),
                Sender:     convert.ToUser(ctx, issue.Poster, nil),
        }).Notify(withMethod(ctx, "NewIssue"))
@@ -89,7 +89,7 @@ func (n *actionsNotifier) IssueChangeContent(ctx context.Context, doer *user_mod
                WithPayload(&api.IssuePayload{
                        Action:     api.HookIssueEdited,
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                }).
@@ -127,7 +127,7 @@ func (n *actionsNotifier) IssueChangeStatus(ctx context.Context, doer *user_mode
        }
        apiIssue := &api.IssuePayload{
                Index:      issue.Index,
-               Issue:      convert.ToAPIIssue(ctx, issue),
+               Issue:      convert.ToAPIIssue(ctx, doer, issue),
                Repository: convert.ToRepo(ctx, issue.Repo, permission),
                Sender:     convert.ToUser(ctx, doer, nil),
        }
@@ -229,7 +229,7 @@ func notifyIssueChange(ctx context.Context, doer *user_model.User, issue *issues
                WithPayload(&api.IssuePayload{
                        Action:     action,
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                }).
@@ -293,7 +293,7 @@ func notifyIssueCommentChange(ctx context.Context, doer *user_model.User, commen
 
        payload := &api.IssueCommentPayload{
                Action:     action,
-               Issue:      convert.ToAPIIssue(ctx, comment.Issue),
+               Issue:      convert.ToAPIIssue(ctx, doer, comment.Issue),
                Comment:    convert.ToAPIComment(ctx, comment.Issue.Repo, comment),
                Repository: convert.ToRepo(ctx, comment.Issue.Repo, permission),
                Sender:     convert.ToUser(ctx, doer, nil),
index c6e06180c838600c4c72552ac729bface54cfbf0..54b00cd88ea391b2ad01e8242c49549a7c8e3ba7 100644 (file)
@@ -18,19 +18,19 @@ import (
        api "code.gitea.io/gitea/modules/structs"
 )
 
-func ToIssue(ctx context.Context, issue *issues_model.Issue) *api.Issue {
-       return toIssue(ctx, issue, WebAssetDownloadURL)
+func ToIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) *api.Issue {
+       return toIssue(ctx, doer, issue, WebAssetDownloadURL)
 }
 
 // ToAPIIssue converts an Issue to API format
 // it assumes some fields assigned with values:
 // Required - Poster, Labels,
 // Optional - Milestone, Assignee, PullRequest
-func ToAPIIssue(ctx context.Context, issue *issues_model.Issue) *api.Issue {
-       return toIssue(ctx, issue, APIAssetDownloadURL)
+func ToAPIIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) *api.Issue {
+       return toIssue(ctx, doer, issue, APIAssetDownloadURL)
 }
 
-func toIssue(ctx context.Context, issue *issues_model.Issue, getDownloadURL func(repo *repo_model.Repository, attach *repo_model.Attachment) string) *api.Issue {
+func toIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, getDownloadURL func(repo *repo_model.Repository, attach *repo_model.Attachment) string) *api.Issue {
        if err := issue.LoadLabels(ctx); err != nil {
                return &api.Issue{}
        }
@@ -44,7 +44,7 @@ func toIssue(ctx context.Context, issue *issues_model.Issue, getDownloadURL func
        apiIssue := &api.Issue{
                ID:          issue.ID,
                Index:       issue.Index,
-               Poster:      ToUser(ctx, issue.Poster, nil),
+               Poster:      ToUser(ctx, issue.Poster, doer),
                Title:       issue.Title,
                Body:        issue.Content,
                Attachments: toAttachments(issue.Repo, issue.Attachments, getDownloadURL),
@@ -114,25 +114,25 @@ func toIssue(ctx context.Context, issue *issues_model.Issue, getDownloadURL func
 }
 
 // ToIssueList converts an IssueList to API format
-func ToIssueList(ctx context.Context, il issues_model.IssueList) []*api.Issue {
+func ToIssueList(ctx context.Context, doer *user_model.User, il issues_model.IssueList) []*api.Issue {
        result := make([]*api.Issue, len(il))
        for i := range il {
-               result[i] = ToIssue(ctx, il[i])
+               result[i] = ToIssue(ctx, doer, il[i])
        }
        return result
 }
 
 // ToAPIIssueList converts an IssueList to API format
-func ToAPIIssueList(ctx context.Context, il issues_model.IssueList) []*api.Issue {
+func ToAPIIssueList(ctx context.Context, doer *user_model.User, il issues_model.IssueList) []*api.Issue {
        result := make([]*api.Issue, len(il))
        for i := range il {
-               result[i] = ToAPIIssue(ctx, il[i])
+               result[i] = ToAPIIssue(ctx, doer, il[i])
        }
        return result
 }
 
 // ToTrackedTime converts TrackedTime to API format
-func ToTrackedTime(ctx context.Context, t *issues_model.TrackedTime) (apiT *api.TrackedTime) {
+func ToTrackedTime(ctx context.Context, doer *user_model.User, t *issues_model.TrackedTime) (apiT *api.TrackedTime) {
        apiT = &api.TrackedTime{
                ID:      t.ID,
                IssueID: t.IssueID,
@@ -141,7 +141,7 @@ func ToTrackedTime(ctx context.Context, t *issues_model.TrackedTime) (apiT *api.
                Created: t.Created,
        }
        if t.Issue != nil {
-               apiT.Issue = ToAPIIssue(ctx, t.Issue)
+               apiT.Issue = ToAPIIssue(ctx, doer, t.Issue)
        }
        if t.User != nil {
                apiT.UserName = t.User.Name
@@ -192,10 +192,10 @@ func ToStopWatches(ctx context.Context, sws []*issues_model.Stopwatch) (api.Stop
 }
 
 // ToTrackedTimeList converts TrackedTimeList to API format
-func ToTrackedTimeList(ctx context.Context, tl issues_model.TrackedTimeList) api.TrackedTimeList {
+func ToTrackedTimeList(ctx context.Context, doer *user_model.User, tl issues_model.TrackedTimeList) api.TrackedTimeList {
        result := make([]*api.TrackedTime, 0, len(tl))
        for _, t := range tl {
-               result = append(result, ToTrackedTime(ctx, t))
+               result = append(result, ToTrackedTime(ctx, doer, t))
        }
        return result
 }
index b034a508971908d512f881ffa3e0994ef3851073..9ffaf1e84c763c8e8ead208d1ea35e24eea993c4 100644 (file)
@@ -120,7 +120,7 @@ func ToTimelineComment(ctx context.Context, repo *repo_model.Repository, c *issu
                        return nil
                }
 
-               comment.TrackedTime = ToTrackedTime(ctx, c.Time)
+               comment.TrackedTime = ToTrackedTime(ctx, doer, c.Time)
        }
 
        if c.RefIssueID != 0 {
@@ -129,7 +129,7 @@ func ToTimelineComment(ctx context.Context, repo *repo_model.Repository, c *issu
                        log.Error("GetIssueByID(%d): %v", c.RefIssueID, err)
                        return nil
                }
-               comment.RefIssue = ToAPIIssue(ctx, issue)
+               comment.RefIssue = ToAPIIssue(ctx, doer, issue)
        }
 
        if c.RefCommentID != 0 {
@@ -180,7 +180,7 @@ func ToTimelineComment(ctx context.Context, repo *repo_model.Repository, c *issu
        }
 
        if c.DependentIssue != nil {
-               comment.DependentIssue = ToAPIIssue(ctx, c.DependentIssue)
+               comment.DependentIssue = ToAPIIssue(ctx, doer, c.DependentIssue)
        }
 
        return comment
index 6d98121ed54c48ebd21f004838c8a36c86ea6f8c..775bf3806d3fe1926f72e340a963cdd11272ebaa 100644 (file)
@@ -33,7 +33,7 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
                return nil
        }
 
-       apiIssue := ToAPIIssue(ctx, pr.Issue)
+       apiIssue := ToAPIIssue(ctx, doer, pr.Issue)
        if err := pr.LoadBaseRepo(ctx); err != nil {
                log.Error("GetRepositoryById[%d]: %v", pr.ID, err)
                return nil
index 1ab14fd6a7e322e3c362daff0c1c090ac885396a..587caf62ff3051e5bb13f8c28b48cd64c21ddc1b 100644 (file)
@@ -67,7 +67,7 @@ func (m *webhookNotifier) IssueClearLabels(ctx context.Context, doer *user_model
                err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventIssueLabel, &api.IssuePayload{
                        Action:     api.HookIssueLabelCleared,
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                })
@@ -168,7 +168,7 @@ func (m *webhookNotifier) IssueChangeAssignee(ctx context.Context, doer *user_mo
                permission, _ := access_model.GetUserRepoPermission(ctx, issue.Repo, doer)
                apiIssue := &api.IssuePayload{
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                }
@@ -214,7 +214,7 @@ func (m *webhookNotifier) IssueChangeTitle(ctx context.Context, doer *user_model
                                        From: oldTitle,
                                },
                        },
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                })
@@ -250,7 +250,7 @@ func (m *webhookNotifier) IssueChangeStatus(ctx context.Context, doer *user_mode
        } else {
                apiIssue := &api.IssuePayload{
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                        CommitID:   commitID,
@@ -281,7 +281,7 @@ func (m *webhookNotifier) NewIssue(ctx context.Context, issue *issues_model.Issu
        if err := PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventIssues, &api.IssuePayload{
                Action:     api.HookIssueOpened,
                Index:      issue.Index,
-               Issue:      convert.ToAPIIssue(ctx, issue),
+               Issue:      convert.ToAPIIssue(ctx, issue.Poster, issue),
                Repository: convert.ToRepo(ctx, issue.Repo, permission),
                Sender:     convert.ToUser(ctx, issue.Poster, nil),
        }); err != nil {
@@ -349,7 +349,7 @@ func (m *webhookNotifier) IssueChangeContent(ctx context.Context, doer *user_mod
                                        From: oldContent,
                                },
                        },
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                })
@@ -384,7 +384,7 @@ func (m *webhookNotifier) UpdateComment(ctx context.Context, doer *user_model.Us
        permission, _ := access_model.GetUserRepoPermission(ctx, c.Issue.Repo, doer)
        if err := PrepareWebhooks(ctx, EventSource{Repository: c.Issue.Repo}, eventType, &api.IssueCommentPayload{
                Action:  api.HookIssueCommentEdited,
-               Issue:   convert.ToAPIIssue(ctx, c.Issue),
+               Issue:   convert.ToAPIIssue(ctx, doer, c.Issue),
                Comment: convert.ToAPIComment(ctx, c.Issue.Repo, c),
                Changes: &api.ChangesPayload{
                        Body: &api.ChangesFromPayload{
@@ -412,7 +412,7 @@ func (m *webhookNotifier) CreateIssueComment(ctx context.Context, doer *user_mod
        permission, _ := access_model.GetUserRepoPermission(ctx, repo, doer)
        if err := PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, eventType, &api.IssueCommentPayload{
                Action:     api.HookIssueCommentCreated,
-               Issue:      convert.ToAPIIssue(ctx, issue),
+               Issue:      convert.ToAPIIssue(ctx, doer, issue),
                Comment:    convert.ToAPIComment(ctx, repo, comment),
                Repository: convert.ToRepo(ctx, repo, permission),
                Sender:     convert.ToUser(ctx, doer, nil),
@@ -449,7 +449,7 @@ func (m *webhookNotifier) DeleteComment(ctx context.Context, doer *user_model.Us
        permission, _ := access_model.GetUserRepoPermission(ctx, comment.Issue.Repo, doer)
        if err := PrepareWebhooks(ctx, EventSource{Repository: comment.Issue.Repo}, eventType, &api.IssueCommentPayload{
                Action:     api.HookIssueCommentDeleted,
-               Issue:      convert.ToAPIIssue(ctx, comment.Issue),
+               Issue:      convert.ToAPIIssue(ctx, doer, comment.Issue),
                Comment:    convert.ToAPIComment(ctx, comment.Issue.Repo, comment),
                Repository: convert.ToRepo(ctx, comment.Issue.Repo, permission),
                Sender:     convert.ToUser(ctx, doer, nil),
@@ -533,7 +533,7 @@ func (m *webhookNotifier) IssueChangeLabels(ctx context.Context, doer *user_mode
                err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventIssueLabel, &api.IssuePayload{
                        Action:     api.HookIssueLabelUpdated,
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                })
@@ -575,7 +575,7 @@ func (m *webhookNotifier) IssueChangeMilestone(ctx context.Context, doer *user_m
                err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventIssueMilestone, &api.IssuePayload{
                        Action:     hookAction,
                        Index:      issue.Index,
-                       Issue:      convert.ToAPIIssue(ctx, issue),
+                       Issue:      convert.ToAPIIssue(ctx, doer, issue),
                        Repository: convert.ToRepo(ctx, issue.Repo, permission),
                        Sender:     convert.ToUser(ctx, doer, nil),
                })