Ignore no slack connector error during trust center access update
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -16,6 +16,7 @@ package probo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
"go.probo.inc/probo/pkg/mail"
|
||||
"go.probo.inc/probo/pkg/page"
|
||||
"go.probo.inc/probo/pkg/slack"
|
||||
"go.probo.inc/probo/pkg/statelesstoken"
|
||||
"go.probo.inc/probo/pkg/validator"
|
||||
)
|
||||
@@ -365,7 +367,10 @@ func (s TrustCenterAccessService) Update(
|
||||
|
||||
if shouldUpdateSlackMessage {
|
||||
if err := s.svc.SlackMessages.QueueSlackNotification(ctx, access.Email, access.TrustCenterID); err != nil {
|
||||
return nil, fmt.Errorf("cannot queue slack notification: %w", err)
|
||||
var noConnectorErr slack.ErrNoSlackConnector
|
||||
if !errors.Is(err, noConnectorErr) {
|
||||
return nil, fmt.Errorf("cannot queue slack notification: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ const (
|
||||
slackMessageDeduplicationWindow = 7 * 24 * time.Hour
|
||||
)
|
||||
|
||||
type ErrNoSlackConnector struct{}
|
||||
|
||||
func (e ErrNoSlackConnector) Error() string {
|
||||
return "no slack connector found for organization"
|
||||
}
|
||||
|
||||
type (
|
||||
SlackMessageService struct {
|
||||
svc *TenantService
|
||||
@@ -208,7 +214,7 @@ func (s *SlackMessageService) QueueSlackNotification(
|
||||
}
|
||||
|
||||
if !hasSlackConnector {
|
||||
return fmt.Errorf("no slack connector found for organization")
|
||||
return ErrNoSlackConnector{}
|
||||
}
|
||||
|
||||
documents, reports, files, err := s.loadDocumentsReportsAndFilesFromAccesses(ctx, tx, trustCenterAccess.ID)
|
||||
|
||||
Reference in New Issue
Block a user