Support rendering %app

This commit is contained in:
Fang 2019-07-28 13:06:08 +02:00
parent d0e51f4a1a
commit c91ad893c0
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -11,6 +11,8 @@ export class Message extends Component {
return this.renderLin(speech.lin.msg, speech.lin.pat);
} else if (_.has(speech, 'url')) {
return this.renderUrl(speech.url);
} else if (_.has(speech, 'app')) {
return this.renderSpeech(speech.app.sep);
} else {
return this.renderUnknown();
}
@ -87,6 +89,16 @@ export class Message extends Component {
}
}
renderAuthor() {
const msg = this.props.msg;
const ship = '~' + msg.aut;
if (_.has(msg, 'sep.app.app')) {
return `:${msg.sep.app.app} (${ship})`;
} else {
return ship;
}
}
//NOTE see also lib/chat-input's globalizeUrl
localizeUrl(url) {
if (typeof url !== 'string') { throw 'Only localize strings!'; }
@ -120,7 +132,7 @@ export class Message extends Component {
<div className="fr" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="hide-child">
<p className="v-top label-small-mono gray dib mr3">
~{props.msg.aut}
{this.renderAuthor()}
</p>
<p className="v-top label-small-mono gray dib">{timestamp}</p>
<p className="v-top label-small-mono ml2 gray dib child">