MM-14675: Eliminates implicit GroupChannel/GroupTeam associations. (#13199)

* MM-14675: Upserts GroupTeam when GroupChannel is linked.
MM-14675: Delete all associated GroupChannels when deleting a GroupTeam.
MM-14675: Using replica DB where possible.
MM-14675: Updates create method used in tests.

* MM-14675: Removes unnecessary DB retrieval of GroupSyncable record.
Этот коммит содержится в:
Martin Kraft
2019-12-18 08:54:09 -05:00
коммит произвёл GitHub
родитель 0ffe199928
Коммит 75ffd0b69e
10 изменённых файлов: 130 добавлений и 68 удалений

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

@@ -36,7 +36,7 @@ func TestChannelGroupEnable(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: channel.Id,
Type: model.GroupSyncableTypeChannel,
@@ -80,7 +80,7 @@ func TestChannelGroupDisable(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: channel.Id,
Type: model.GroupSyncableTypeChannel,
@@ -127,7 +127,7 @@ func TestChannelGroupStatus(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: channel.Id,
Type: model.GroupSyncableTypeChannel,
@@ -170,7 +170,7 @@ func TestChannelGroupList(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: channel.Id,
Type: model.GroupSyncableTypeChannel,
@@ -188,7 +188,7 @@ func TestChannelGroupList(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: channel.Id,
Type: model.GroupSyncableTypeChannel,
@@ -229,7 +229,7 @@ func TestTeamGroupEnable(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: th.BasicTeam.Id,
Type: model.GroupSyncableTypeTeam,
@@ -270,7 +270,7 @@ func TestTeamGroupDisable(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: team.Id,
Type: model.GroupSyncableTypeTeam,
@@ -314,7 +314,7 @@ func TestTeamGroupStatus(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: th.BasicTeam.Id,
Type: model.GroupSyncableTypeTeam,
@@ -354,7 +354,7 @@ func TestTeamGroupList(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: th.BasicTeam.Id,
Type: model.GroupSyncableTypeTeam,
@@ -372,7 +372,7 @@ func TestTeamGroupList(t *testing.T) {
})
require.Nil(t, err)
_, err = th.App.CreateGroupSyncable(&model.GroupSyncable{
_, err = th.App.UpsertGroupSyncable(&model.GroupSyncable{
AutoAdd: true,
SyncableId: th.BasicTeam.Id,
Type: model.GroupSyncableTypeTeam,