Bulk import/export supports direct messages from a user to themselves (#13200)

* Test added to check support for import of messages sent to your own DM
channel

* Support for single member direct channel messages and posts

Now bulk import is able to export/import the self direct channel and
the posts inside

* Improve how the copy of channel members for DM and DM posts

* Improved the tests for the export self-channels
Этот коммит содержится в:
Mario de Frutos Dieguez
2019-12-05 15:58:38 +01:00
коммит произвёл Saturnino Abril
родитель 8cafd11162
Коммит 8347f3e1fa
4 изменённых файлов: 18 добавлений и 17 удалений

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

@@ -284,10 +284,11 @@ func TestExportDMChannelToSelf(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 0, i)
// Ensure no channels were imported
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 0, len(channels))
assert.Equal(t, 1, len(channels))
assert.Equal(t, 1, len((*channels[0].Members)))
assert.Equal(t, th1.BasicUser.Username, (*channels[0].Members)[0])
}
func TestExportGMChannel(t *testing.T) {
@@ -478,5 +479,7 @@ func TestExportDMPostWithSelf(t *testing.T) {
posts, err = th2.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
assert.Equal(t, 0, len(posts))
assert.Equal(t, 1, len(posts))
assert.Equal(t, 1, len((*posts[0].ChannelMembers)))
assert.Equal(t, th1.BasicUser.Username, (*posts[0].ChannelMembers)[0])
}