Skip to content

Commit

Permalink
fix wrong sender when send slack webhook (go-gitea#7918)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Aug 20, 2019
1 parent 7dd726f commit 6edc7df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions models/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6edc7df

Please sign in to comment.