diff --git a/src/components/views/messages/SenderProfile.js b/src/components/views/messages/SenderProfile.js
index f6940cd4b3..afdb97272f 100644
--- a/src/components/views/messages/SenderProfile.js
+++ b/src/components/views/messages/SenderProfile.js
@@ -27,30 +27,29 @@ export default function SenderProfile(props) {
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
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') {
return ; // emote message must include the name so don't duplicate it
}
// Name + flair
const nameElem = [
- { name || '' },
+ { name || '' },
props.enableFlair ?
-
: null,
- ]
+ ];
+
+ let content = '';
if(props.text) {
// Replace senderName, and wrap surrounding text in spans with the right class
content = _tJsx(props.text, /^(.*)\%\(senderName\)s(.*)$/m, (p1, p2) => [
- p1 ? {p1} : null,
+ p1 ? { p1 } : null,
nameElem,
- p2 ? {p2} : null,
+ p2 ? { p2 } : null,
]);
} else {
content = nameElem;