Adds includeDeleted flag to get remote cluster app and store methods (#28182)

Этот коммит содержится в:
Miguel de la Cruz
2024-09-13 23:08:53 +02:00
коммит произвёл GitHub
родитель 46ca7747f8
Коммит cae456de2d
19 изменённых файлов: 78 добавлений и 57 удалений

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

@@ -57,7 +57,7 @@ func remoteClusterPing(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
rc, appErr := c.App.GetRemoteCluster(frame.RemoteId)
rc, appErr := c.App.GetRemoteCluster(frame.RemoteId, false)
if appErr != nil {
c.SetInvalidRemoteIdError(frame.RemoteId)
return
@@ -110,7 +110,7 @@ func remoteClusterAcceptMessage(c *Context, w http.ResponseWriter, r *http.Reque
return
}
rc, appErr := c.App.GetRemoteCluster(frame.RemoteId)
rc, appErr := c.App.GetRemoteCluster(frame.RemoteId, false)
if appErr != nil {
c.SetInvalidRemoteIdError(frame.RemoteId)
return
@@ -158,7 +158,7 @@ func remoteClusterConfirmInvite(c *Context, w http.ResponseWriter, r *http.Reque
return
}
rc, err := c.App.GetRemoteCluster(frame.RemoteId)
rc, err := c.App.GetRemoteCluster(frame.RemoteId, false)
if err != nil {
c.SetInvalidRemoteIdError(frame.RemoteId)
return
@@ -527,7 +527,7 @@ func generateRemoteClusterInvite(c *Context, w http.ResponseWriter, r *http.Requ
return
}
rc, appErr := c.App.GetRemoteCluster(c.Params.RemoteId)
rc, appErr := c.App.GetRemoteCluster(c.Params.RemoteId, false)
if appErr != nil {
c.Err = appErr
return
@@ -561,7 +561,7 @@ func getRemoteCluster(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
rc, err := c.App.GetRemoteCluster(c.Params.RemoteId)
rc, err := c.App.GetRemoteCluster(c.Params.RemoteId, true)
if err != nil {
c.Err = err
return
@@ -601,7 +601,7 @@ func patchRemoteCluster(c *Context, w http.ResponseWriter, r *http.Request) {
audit.AddEventParameterAuditable(auditRec, "remotecluster_patch", &patch)
defer c.LogAuditRec(auditRec)
orc, err := c.App.GetRemoteCluster(c.Params.RemoteId)
orc, err := c.App.GetRemoteCluster(c.Params.RemoteId, false)
if err != nil {
c.Err = err
return
@@ -645,7 +645,7 @@ func deleteRemoteCluster(c *Context, w http.ResponseWriter, r *http.Request) {
audit.AddEventParameter(auditRec, "remote_id", c.Params.RemoteId)
defer c.LogAuditRec(auditRec)
orc, err := c.App.GetRemoteCluster(c.Params.RemoteId)
orc, err := c.App.GetRemoteCluster(c.Params.RemoteId, false)
if err != nil {
c.Err = err
return

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

@@ -242,7 +242,7 @@ func TestCreateRemoteCluster(t *testing.T) {
require.NotZero(t, rcWithInvite.Password)
require.Len(t, rcWithInvite.Password, 16)
rc, appErr := th.App.GetRemoteCluster(rcWithInvite.RemoteCluster.RemoteId)
rc, appErr := th.App.GetRemoteCluster(rcWithInvite.RemoteCluster.RemoteId, false)
require.Nil(t, appErr)
require.Equal(t, rcWithTeamNoPassword.Name, rc.Name)
@@ -266,7 +266,7 @@ func TestCreateRemoteCluster(t *testing.T) {
// by the endpoint
require.Zero(t, rcWithInvite.Password)
rc, appErr := th.App.GetRemoteCluster(rcWithInvite.RemoteCluster.RemoteId)
rc, appErr := th.App.GetRemoteCluster(rcWithInvite.RemoteCluster.RemoteId, false)
require.Nil(t, appErr)
require.Equal(t, rcWithTeamAndPassword.Name, rc.Name)
@@ -599,7 +599,7 @@ func TestDeleteRemoteCluster(t *testing.T) {
t.Run("should correctly delete the remote cluster", func(t *testing.T) {
// ensure the remote cluster is not deleted
initialRC, appErr := th.App.GetRemoteCluster(rc.RemoteId)
initialRC, appErr := th.App.GetRemoteCluster(rc.RemoteId, false)
require.Nil(t, appErr)
require.NotEmpty(t, initialRC)
require.Zero(t, initialRC.DeleteAt)
@@ -608,7 +608,7 @@ func TestDeleteRemoteCluster(t *testing.T) {
CheckOKStatus(t, resp)
require.NoError(t, err)
deletedRC, appErr := th.App.GetRemoteCluster(rc.RemoteId)
deletedRC, appErr := th.App.GetRemoteCluster(rc.RemoteId, true)
require.Nil(t, appErr)
require.NotEmpty(t, deletedRC)
require.NotZero(t, deletedRC.DeleteAt)

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

@@ -110,7 +110,7 @@ func getSharedChannelRemotesByRemoteCluster(c *Context, w http.ResponseWriter, r
return
}
if _, appErr := c.App.GetRemoteCluster(c.Params.RemoteId); appErr != nil {
if _, appErr := c.App.GetRemoteCluster(c.Params.RemoteId, true); appErr != nil {
c.Err = appErr
return
}
@@ -154,7 +154,7 @@ func inviteRemoteClusterToChannel(c *Context, w http.ResponseWriter, r *http.Req
return
}
if rc, appErr := c.App.GetRemoteCluster(c.Params.RemoteId); appErr != nil || rc.DeleteAt != 0 {
if _, appErr := c.App.GetRemoteCluster(c.Params.RemoteId, false); appErr != nil {
c.SetInvalidRemoteIdError(c.Params.RemoteId)
return
}
@@ -201,7 +201,7 @@ func uninviteRemoteClusterToChannel(c *Context, w http.ResponseWriter, r *http.R
return
}
if rc, appErr := c.App.GetRemoteCluster(c.Params.RemoteId); appErr != nil || rc.DeleteAt != 0 {
if _, appErr := c.App.GetRemoteCluster(c.Params.RemoteId, false); appErr != nil {
c.SetInvalidRemoteIdError(c.Params.RemoteId)
return
}