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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
@@ -26,6 +27,7 @@ import (
|
|||||||
"go.probo.inc/probo/pkg/gid"
|
"go.probo.inc/probo/pkg/gid"
|
||||||
"go.probo.inc/probo/pkg/mail"
|
"go.probo.inc/probo/pkg/mail"
|
||||||
"go.probo.inc/probo/pkg/page"
|
"go.probo.inc/probo/pkg/page"
|
||||||
|
"go.probo.inc/probo/pkg/slack"
|
||||||
"go.probo.inc/probo/pkg/statelesstoken"
|
"go.probo.inc/probo/pkg/statelesstoken"
|
||||||
"go.probo.inc/probo/pkg/validator"
|
"go.probo.inc/probo/pkg/validator"
|
||||||
)
|
)
|
||||||
@@ -365,7 +367,10 @@ func (s TrustCenterAccessService) Update(
|
|||||||
|
|
||||||
if shouldUpdateSlackMessage {
|
if shouldUpdateSlackMessage {
|
||||||
if err := s.svc.SlackMessages.QueueSlackNotification(ctx, access.Email, access.TrustCenterID); err != nil {
|
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
|
slackMessageDeduplicationWindow = 7 * 24 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ErrNoSlackConnector struct{}
|
||||||
|
|
||||||
|
func (e ErrNoSlackConnector) Error() string {
|
||||||
|
return "no slack connector found for organization"
|
||||||
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
SlackMessageService struct {
|
SlackMessageService struct {
|
||||||
svc *TenantService
|
svc *TenantService
|
||||||
@@ -208,7 +214,7 @@ func (s *SlackMessageService) QueueSlackNotification(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !hasSlackConnector {
|
if !hasSlackConnector {
|
||||||
return fmt.Errorf("no slack connector found for organization")
|
return ErrNoSlackConnector{}
|
||||||
}
|
}
|
||||||
|
|
||||||
documents, reports, files, err := s.loadDocumentsReportsAndFilesFromAccesses(ctx, tx, trustCenterAccess.ID)
|
documents, reports, files, err := s.loadDocumentsReportsAndFilesFromAccesses(ctx, tx, trustCenterAccess.ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user