Return an error if an invite for a confirmed remote cluster is received (#28943)

Co-authored-by: Caleb Roseland <caleb@calebroseland.com>
Этот коммит содержится в:
Miguel de la Cruz
2024-10-25 11:30:29 +02:00
коммит произвёл GitHub
родитель 49be26ebc4
Коммит 98d341fbae
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@@ -3,7 +3,14 @@
package remotecluster
import "fmt"
import (
"errors"
"fmt"
)
var (
RemoteClusterAlreadyConfirmedError = errors.New("the remote cluster has already been confirmed")
)
type BufferFullError struct {
capacity int

Просмотреть файл

@@ -62,6 +62,10 @@ func (rcs *Service) ReceiveInviteConfirmation(confirm model.RemoteClusterInvite)
return nil, fmt.Errorf("cannot accept invite confirmation for remote %s: %w", confirm.RemoteId, err)
}
if rc.IsConfirmed() {
return nil, fmt.Errorf("cannot accept invite confirmation for remote %s: %w", confirm.RemoteId, RemoteClusterAlreadyConfirmedError)
}
rc.SiteURL = confirm.SiteURL
rc.RemoteToken = confirm.Token