]> source.dussan.org Git - gitea.git/commitdiff
fix wrong sender when send slack webhook (#7918) (#7924)
authorLunny Xiao <xiaolunwen@gmail.com>
Tue, 20 Aug 2019 17:42:14 +0000 (01:42 +0800)
committertechknowlogick <techknowlogick@gitea.io>
Tue, 20 Aug 2019 17:42:14 +0000 (13:42 -0400)
models/release.go

index f8e8c17e74cf43f90e0bf19c5c7bd6152e39d439..a6dfb5c20a049ede67e0b7e73cc078923b8b619a 100644 (file)
@@ -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 {