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 удалений

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

@@ -39,11 +39,15 @@ func ImportLineFromChannel(channel *model.ChannelForExport) *LineImportData {
}
func ImportLineFromDirectChannel(channel *model.DirectChannelForExport) *LineImportData {
channelMembers := *channel.Members
if len(channelMembers) == 1 {
channelMembers = []string{channelMembers[0], channelMembers[0]}
}
return &LineImportData{
Type: "direct_channel",
DirectChannel: &DirectChannelImportData{
Header: &channel.Header,
Members: channel.Members,
Members: &channelMembers,
},
}
}
@@ -158,10 +162,14 @@ func ImportLineForPost(post *model.PostForExport) *LineImportData {
}
func ImportLineForDirectPost(post *model.DirectPostForExport) *LineImportData {
channelMembers := *post.ChannelMembers
if len(channelMembers) == 1 {
channelMembers = []string{channelMembers[0], channelMembers[0]}
}
return &LineImportData{
Type: "direct_post",
DirectPost: &DirectPostImportData{
ChannelMembers: post.ChannelMembers,
ChannelMembers: &channelMembers,
User: &post.User,
Message: &post.Message,
CreateAt: &post.CreateAt,