fix: handle the attachment when the value is null (#5130)
* fix: handle the attachment when the value is null * filter properly before pass to map
This commit is contained in:
parent
48acd0669e
commit
b420b51272
|
@ -9,14 +9,17 @@ function normalizeAttachments(msg: TMsg) {
|
||||||
if (typeof msg.attachments !== typeof [] || !msg.attachments || !msg.attachments.length) {
|
if (typeof msg.attachments !== typeof [] || !msg.attachments || !msg.attachments.length) {
|
||||||
msg.attachments = [];
|
msg.attachments = [];
|
||||||
}
|
}
|
||||||
msg.attachments = msg.attachments.map(att => {
|
|
||||||
att.fields = att.fields || [];
|
msg.attachments = msg.attachments
|
||||||
if (att.ts) {
|
.filter(att => !!att)
|
||||||
att.ts = moment(att.ts).toDate();
|
.map(att => {
|
||||||
}
|
att.fields = att.fields || [];
|
||||||
att = normalizeAttachments(att as TMsg);
|
if (att.ts) {
|
||||||
return att;
|
att.ts = moment(att.ts).toDate();
|
||||||
});
|
}
|
||||||
|
att = normalizeAttachments(att as TMsg);
|
||||||
|
return att;
|
||||||
|
});
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue