Return an error if an invite for a confirmed remote cluster is received (#28943)
Co-authored-by: Caleb Roseland <caleb@calebroseland.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
49be26ebc4
Коммит
98d341fbae
@@ -3,7 +3,14 @@
|
|||||||
|
|
||||||
package remotecluster
|
package remotecluster
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
RemoteClusterAlreadyConfirmedError = errors.New("the remote cluster has already been confirmed")
|
||||||
|
)
|
||||||
|
|
||||||
type BufferFullError struct {
|
type BufferFullError struct {
|
||||||
capacity int
|
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)
|
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.SiteURL = confirm.SiteURL
|
||||||
rc.RemoteToken = confirm.Token
|
rc.RemoteToken = confirm.Token
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user