Fix SenderProfile

Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
This commit is contained in:
Stefan Parviainen 2017-10-17 21:32:35 +02:00
parent 8083dccfa5
commit 468a05c6f1

View file

@ -27,23 +27,22 @@ export default function SenderProfile(props) {
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender(); const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
const {msgtype} = mxEvent.getContent(); const {msgtype} = mxEvent.getContent();
// Display sender name by default if nothing else is given
const text = props.text ? props.text : '%(senderName)s';
if (msgtype === 'm.emote') { if (msgtype === 'm.emote') {
return <span />; // emote message must include the name so don't duplicate it return <span />; // emote message must include the name so don't duplicate it
} }
// Name + flair // Name + flair
const nameElem = [ const nameElem = [
<EmojiText className="mx_SenderProfile_name">{ name || '' }</EmojiText>, <EmojiText key='name' className="mx_SenderProfile_name">{ name || '' }</EmojiText>,
props.enableFlair ? props.enableFlair ?
<Flair <Flair key='flair'
userId={mxEvent.getSender()} userId={mxEvent.getSender()}
roomId={mxEvent.getRoomId()} roomId={mxEvent.getRoomId()}
showRelated={true} /> showRelated={true} />
: null, : null,
] ];
let content = '';
if(props.text) { if(props.text) {
// Replace senderName, and wrap surrounding text in spans with the right class // Replace senderName, and wrap surrounding text in spans with the right class