MM-33903 rename slash commands & permission (#17494)

- rename slash commands
    - "remote" -> "secure-connection"
    - "share" -> "share-channel"
- change status icons to text (translated)
- remove channel invite "Description" field
- rename permission "manage_remote_clusters" -> "manage_secure_connections"
Этот коммит содержится в:
Doug Lauder
2021-04-30 14:59:29 -04:00
коммит произвёл GitHub
родитель a7e6eef836
Коммит e2b9cb98aa
20 изменённых файлов: 243 добавлений и 331 удалений

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

@@ -38,7 +38,6 @@ func newSqlSharedChannelStore(sqlStore *SqlStore) store.SharedChannelStore {
tableSharedChannelRemotes := db.AddTableWithName(model.SharedChannelRemote{}, "SharedChannelRemotes").SetKeys(false, "Id", "ChannelId")
tableSharedChannelRemotes.ColMap("Id").SetMaxSize(26)
tableSharedChannelRemotes.ColMap("ChannelId").SetMaxSize(26)
tableSharedChannelRemotes.ColMap("Description").SetMaxSize(64)
tableSharedChannelRemotes.ColMap("CreatorId").SetMaxSize(26)
tableSharedChannelRemotes.ColMap("RemoteId").SetMaxSize(26)
tableSharedChannelRemotes.SetUniqueTogether("ChannelId", "RemoteId")
@@ -524,7 +523,7 @@ func (s SqlSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.Shar
var status []*model.SharedChannelRemoteStatus
query := s.getQueryBuilder().
Select("scr.ChannelId, rc.DisplayName, rc.SiteURL, rc.LastPingAt, scr.NextSyncAt, scr.Description, sc.ReadOnly, scr.IsInviteAccepted").
Select("scr.ChannelId, rc.DisplayName, rc.SiteURL, rc.LastPingAt, scr.NextSyncAt, sc.ReadOnly, scr.IsInviteAccepted").
From("SharedChannelRemotes scr, RemoteClusters rc, SharedChannels sc").
Where("scr.RemoteId = rc.RemoteId").
Where("scr.ChannelId = sc.ChannelId").

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

@@ -253,11 +253,11 @@ func testRemoteClusterGetAllInChannel(t *testing.T, ss store.Store) {
// Create some shared channel remotes
scrData := []*model.SharedChannelRemote{
{ChannelId: channel1.Id, Description: "AAA Inc Share", RemoteId: rcData[0].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel1.Id, Description: "BBB Inc Share", RemoteId: rcData[1].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, Description: "CCC Inc Share", RemoteId: rcData[2].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, Description: "DDD Inc Share", RemoteId: rcData[3].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, Description: "EEE Inc Share", RemoteId: rcData[4].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel1.Id, RemoteId: rcData[0].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel1.Id, RemoteId: rcData[1].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, RemoteId: rcData[2].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, RemoteId: rcData[3].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, RemoteId: rcData[4].RemoteId, CreatorId: model.NewId()},
}
for _, item := range scrData {
_, err := ss.SharedChannel().SaveRemote(item)
@@ -360,11 +360,11 @@ func testRemoteClusterGetAllNotInChannel(t *testing.T, ss store.Store) {
// Create some shared channel remotes
scrData := []*model.SharedChannelRemote{
{ChannelId: channel1.Id, Description: "AAA Inc Share", RemoteId: rcData[0].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel1.Id, Description: "BBB Inc Share", RemoteId: rcData[1].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, Description: "CCC Inc Share", RemoteId: rcData[2].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, Description: "DDD Inc Share", RemoteId: rcData[3].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel3.Id, Description: "EEE Inc Share", RemoteId: rcData[4].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel1.Id, RemoteId: rcData[0].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel1.Id, RemoteId: rcData[1].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, RemoteId: rcData[2].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel2.Id, RemoteId: rcData[3].RemoteId, CreatorId: model.NewId()},
{ChannelId: channel3.Id, RemoteId: rcData[4].RemoteId, CreatorId: model.NewId()},
}
for _, item := range scrData {
_, err := ss.SharedChannel().SaveRemote(item)

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

@@ -349,10 +349,9 @@ func testDeleteSharedChannel(t *testing.T, ss store.Store) {
// add some remotes
for i := 0; i < 10; i++ {
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "remote_" + strconv.Itoa(i),
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
_, err := ss.SharedChannel().SaveRemote(remote)
require.NoError(t, err, "couldn't add remote", err)
@@ -391,10 +390,9 @@ func testSaveSharedChannelRemote(t *testing.T, ss store.Store) {
require.NoError(t, err)
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
remoteSaved, err := ss.SharedChannel().SaveRemote(remote)
@@ -406,10 +404,9 @@ func testSaveSharedChannelRemote(t *testing.T, ss store.Store) {
t.Run("Save invalid shared channel remote", func(t *testing.T) {
remote := &model.SharedChannelRemote{
ChannelId: "",
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: "",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
_, err := ss.SharedChannel().SaveRemote(remote)
@@ -418,10 +415,9 @@ func testSaveSharedChannelRemote(t *testing.T, ss store.Store) {
t.Run("Save shared channel remote with invalid channel id", func(t *testing.T) {
remote := &model.SharedChannelRemote{
ChannelId: model.NewId(),
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: model.NewId(),
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
_, err := ss.SharedChannel().SaveRemote(remote)
@@ -435,10 +431,9 @@ func testUpdateSharedChannelRemote(t *testing.T, ss store.Store) {
require.NoError(t, err)
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "test_remote_update",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
remoteSaved, err := ss.SharedChannel().SaveRemote(remote)
@@ -446,22 +441,19 @@ func testUpdateSharedChannelRemote(t *testing.T, ss store.Store) {
remoteSaved.IsInviteAccepted = true
remoteSaved.IsInviteConfirmed = true
remoteSaved.Description = "new_desc"
remoteUpdated, err := ss.SharedChannel().UpdateRemote(remoteSaved)
require.NoError(t, err, "couldn't update shared channel remote", err)
require.Equal(t, true, remoteUpdated.IsInviteAccepted)
require.Equal(t, true, remoteUpdated.IsInviteConfirmed)
require.Equal(t, "new_desc", remoteUpdated.Description)
})
t.Run("Update invalid shared channel remote", func(t *testing.T) {
remote := &model.SharedChannelRemote{
ChannelId: "",
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: "",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
_, err := ss.SharedChannel().UpdateRemote(remote)
@@ -470,10 +462,9 @@ func testUpdateSharedChannelRemote(t *testing.T, ss store.Store) {
t.Run("Update shared channel remote with invalid channel id", func(t *testing.T) {
remote := &model.SharedChannelRemote{
ChannelId: model.NewId(),
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: model.NewId(),
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
_, err := ss.SharedChannel().UpdateRemote(remote)
@@ -486,10 +477,9 @@ func testGetSharedChannelRemote(t *testing.T, ss store.Store) {
require.NoError(t, err)
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
remoteSaved, err := ss.SharedChannel().SaveRemote(remote)
@@ -501,7 +491,6 @@ func testGetSharedChannelRemote(t *testing.T, ss store.Store) {
require.Equal(t, remoteSaved.Id, r.Id)
require.Equal(t, remoteSaved.ChannelId, r.ChannelId)
require.Equal(t, remoteSaved.Description, r.Description)
require.Equal(t, remoteSaved.CreatorId, r.CreatorId)
require.Equal(t, remoteSaved.RemoteId, r.RemoteId)
})
@@ -518,10 +507,9 @@ func testGetSharedChannelRemoteByIds(t *testing.T, ss store.Store) {
require.NoError(t, err)
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "test_remote_by_ids",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
remoteSaved, err := ss.SharedChannel().SaveRemote(remote)
@@ -533,7 +521,6 @@ func testGetSharedChannelRemoteByIds(t *testing.T, ss store.Store) {
require.Equal(t, remoteSaved.Id, r.Id)
require.Equal(t, remoteSaved.ChannelId, r.ChannelId)
require.Equal(t, remoteSaved.Description, r.Description)
require.Equal(t, remoteSaved.CreatorId, r.CreatorId)
require.Equal(t, remoteSaved.RemoteId, r.RemoteId)
})
@@ -553,12 +540,12 @@ func testGetSharedChannelRemotes(t *testing.T, ss store.Store) {
remoteId := model.NewId()
data := []model.SharedChannelRemote{
{ChannelId: channel.Id, CreatorId: creator, Description: "r1", RemoteId: model.NewId(), IsInviteConfirmed: true},
{ChannelId: channel.Id, CreatorId: creator, Description: "r2", RemoteId: model.NewId(), IsInviteConfirmed: true},
{ChannelId: channel.Id, CreatorId: creator, Description: "r3", RemoteId: model.NewId(), IsInviteConfirmed: true},
{CreatorId: creator, Description: "r4", RemoteId: remoteId, IsInviteConfirmed: true},
{CreatorId: creator, Description: "r5", RemoteId: remoteId, IsInviteConfirmed: true},
{CreatorId: creator, Description: "r6", RemoteId: remoteId},
{ChannelId: channel.Id, CreatorId: creator, RemoteId: model.NewId(), IsInviteConfirmed: true},
{ChannelId: channel.Id, CreatorId: creator, RemoteId: model.NewId(), IsInviteConfirmed: true},
{ChannelId: channel.Id, CreatorId: creator, RemoteId: model.NewId(), IsInviteConfirmed: true},
{CreatorId: creator, RemoteId: remoteId, IsInviteConfirmed: true},
{CreatorId: creator, RemoteId: remoteId, IsInviteConfirmed: true},
{CreatorId: creator, RemoteId: remoteId},
}
for i, r := range data {
@@ -579,7 +566,7 @@ func testGetSharedChannelRemotes(t *testing.T, ss store.Store) {
require.NoError(t, err, "should not error", err)
require.Len(t, remotes, 3)
for _, r := range remotes {
require.Contains(t, []string{"r1", "r2", "r3"}, r.Description)
require.Equal(t, channel.Id, r.ChannelId)
}
})
@@ -600,7 +587,8 @@ func testGetSharedChannelRemotes(t *testing.T, ss store.Store) {
require.NoError(t, err, "should not error", err)
require.Len(t, remotes, 2) // only confirmed invitations
for _, r := range remotes {
require.Contains(t, []string{"r4", "r5"}, r.Description)
require.Equal(t, remoteId, r.RemoteId)
require.True(t, r.IsInviteConfirmed)
}
})
@@ -620,9 +608,9 @@ func testGetSharedChannelRemotes(t *testing.T, ss store.Store) {
}
remotes, err := ss.SharedChannel().GetRemotes(opts)
require.NoError(t, err, "should not error", err)
require.Len(t, remotes, 3) // only confirmed invitations
require.Len(t, remotes, 3)
for _, r := range remotes {
require.Contains(t, []string{"r4", "r5", "r6"}, r.Description)
require.Equal(t, remoteId, r.RemoteId)
}
})
}
@@ -636,8 +624,8 @@ func testHasRemote(t *testing.T, ss store.Store) {
creator := model.NewId()
data := []model.SharedChannelRemote{
{ChannelId: channel.Id, CreatorId: creator, Description: "r1", RemoteId: remote1},
{ChannelId: channel.Id, CreatorId: creator, Description: "r2", RemoteId: remote2},
{ChannelId: channel.Id, CreatorId: creator, RemoteId: remote1},
{ChannelId: channel.Id, CreatorId: creator, RemoteId: remote2},
}
for _, r := range data {
@@ -731,10 +719,9 @@ func testUpdateSharedChannelRemoteNextSyncAt(t *testing.T, ss store.Store) {
require.NoError(t, err)
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
remoteSaved, err := ss.SharedChannel().SaveRemote(remote)
@@ -762,10 +749,9 @@ func testDeleteSharedChannelRemote(t *testing.T, ss store.Store) {
require.NoError(t, err)
remote := &model.SharedChannelRemote{
ChannelId: channel.Id,
Description: "test_remote",
CreatorId: model.NewId(),
RemoteId: model.NewId(),
ChannelId: channel.Id,
CreatorId: model.NewId(),
RemoteId: model.NewId(),
}
remoteSaved, err := ss.SharedChannel().SaveRemote(remote)