Merge pull request #11276 from mmpei/offical-webhook-slack-fix

fix webhook slack test error
This commit is contained in:
Wenkai Yin(尹文开) 2020-04-03 10:37:21 +08:00 committed by GitHub
commit 2783fd0950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import (
commonhttp "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/notifier/model"
)
// DefaultManager ...
@ -94,7 +95,7 @@ func (m *DefaultManager) Delete(policyID int64) error {
func (m *DefaultManager) Test(policy *models.NotificationPolicy) error {
for _, target := range policy.Targets {
switch target.Type {
case "http":
case model.NotifyTypeHTTP, model.NotifyTypeSlack:
return m.policyHTTPTest(target.Address, target.SkipCertVerify)
default:
return fmt.Errorf("invalid policy target type: %s", target.Type)