From: Lunny Xiao Date: Tue, 20 Aug 2019 17:42:14 +0000 (+0800) Subject: fix wrong sender when send slack webhook (#7918) (#7924) X-Git-Tag: v1.9.2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5649f0d2b33054a671875138b377a964bb17209a;p=gitea.git fix wrong sender when send slack webhook (#7918) (#7924) --- diff --git a/models/release.go b/models/release.go index f8e8c17e74..a6dfb5c20a 100644 --- a/models/release.go +++ b/models/release.go @@ -409,7 +409,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment Action: api.HookReleaseUpdated, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), - Sender: rel.Publisher.APIFormat(), + Sender: doer.APIFormat(), }); err1 != nil { log.Error("PrepareWebhooks: %v", err) } else { @@ -420,7 +420,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment } // DeleteReleaseByID deletes a release and corresponding Git tag by given ID. -func DeleteReleaseByID(id int64, u *User, delTag bool) error { +func DeleteReleaseByID(id int64, doer *User, delTag bool) error { rel, err := GetReleaseByID(id) if err != nil { return fmt.Errorf("GetReleaseByID: %v", err) @@ -459,12 +459,12 @@ func DeleteReleaseByID(id int64, u *User, delTag bool) error { return fmt.Errorf("LoadAttributes: %v", err) } - mode, _ := AccessLevel(u, rel.Repo) + mode, _ := AccessLevel(doer, rel.Repo) if err := PrepareWebhooks(rel.Repo, HookEventRelease, &api.ReleasePayload{ Action: api.HookReleaseDeleted, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), - Sender: rel.Publisher.APIFormat(), + Sender: doer.APIFormat(), }); err != nil { log.Error("PrepareWebhooks: %v", err) } else {