make more generic
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
846c14062a
commit
20caea47f8
|
@ -62,18 +62,24 @@ module.exports = React.createClass({
|
||||||
'm.audio': sdk.getComponent('messages.MAudioBody'),
|
'm.audio': sdk.getComponent('messages.MAudioBody'),
|
||||||
'm.video': sdk.getComponent('messages.MVideoBody'),
|
'm.video': sdk.getComponent('messages.MVideoBody'),
|
||||||
};
|
};
|
||||||
|
const evTypes = {
|
||||||
|
'm.sticker': sdk.getComponent('messages.MStickerBody'),
|
||||||
|
};
|
||||||
|
|
||||||
const content = this.props.mxEvent.getContent();
|
const content = this.props.mxEvent.getContent();
|
||||||
|
const type = this.props.mxEvent.getType();
|
||||||
const msgtype = content.msgtype;
|
const msgtype = content.msgtype;
|
||||||
let BodyType = UnknownBody;
|
let BodyType = UnknownBody;
|
||||||
if (msgtype && bodyTypes[msgtype]) {
|
if (!this.props.mxEvent.isRedacted()) {
|
||||||
BodyType = bodyTypes[msgtype];
|
// only resolve BodyType if event is not redacted
|
||||||
} else if (this.props.mxEvent.getType() === 'm.sticker') {
|
if (msgtype && bodyTypes[msgtype]) {
|
||||||
// if sticker is redacted, show UnknownBody otherwise it'll fall through to elif
|
BodyType = bodyTypes[msgtype];
|
||||||
BodyType = this.props.mxEvent.isRedacted() ? UnknownBody : sdk.getComponent('messages.MStickerBody');
|
} else if (type && evTypes[type]) {
|
||||||
} else if (content.url) {
|
BodyType = evTypes[type];
|
||||||
// Fallback to MFileBody if there's a content URL
|
} else if (content.url) {
|
||||||
BodyType = bodyTypes['m.file'];
|
// Fallback to MFileBody if there's a content URL
|
||||||
|
BodyType = bodyTypes['m.file'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return <BodyType
|
return <BodyType
|
||||||
|
|
Loading…
Reference in New Issue