Skip to content

Commit 1e4e256

Browse files
remove empty fields when building message object
1 parent 88fb1e5 commit 1e4e256

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/mean-mails-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/meteor': patch
3+
---
4+
5+
Fixes Slack messages being incorrectly saved on import

apps/meteor/app/importer/server/classes/converters/MessageConverter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { IImportMessageRecord, IMessage as IDBMessage, IImportMessage, IImportMessageReaction } from '@rocket.chat/core-typings';
22
import { Rooms } from '@rocket.chat/models';
3+
import { removeEmpty } from '@rocket.chat/tools';
34
import limax from 'limax';
45

56
import type { UserIdentification, MentionedChannel } from './ConverterCache';
@@ -84,7 +85,7 @@ export class MessageConverter extends RecordConverter<IImportMessageRecord> {
8485
const mentions = data.mentions && (await this.convertMessageMentions(data));
8586
const channels = data.channels && (await this.convertMessageChannels(data));
8687

87-
return {
88+
return removeEmpty({
8889
rid,
8990
u: {
9091
_id: creator._id,
@@ -110,7 +111,7 @@ export class MessageConverter extends RecordConverter<IImportMessageRecord> {
110111
alias: data.alias,
111112
...(data._id ? { _id: data._id } : {}),
112113
...(data.reactions ? { reactions: await this.convertMessageReactions(data.reactions) } : {}),
113-
};
114+
});
114115
}
115116

116117
protected async convertMessageChannels(message: IImportMessage): Promise<MentionedChannel[] | undefined> {

0 commit comments

Comments
 (0)