mirror of https://github.com/vector-im/riot-web
Let the tile contents specify whether it requires a sender profile or not. Fixes #250.
parent
08270b26ee
commit
7c6fb36520
|
@ -19,22 +19,22 @@ limitations under the License.
|
|||
var React = require('react');
|
||||
|
||||
var EventAsTextTileController = require('matrix-react-sdk/lib/controllers/molecules/EventAsTextTile')
|
||||
var sdk = require('matrix-react-sdk')
|
||||
var TextForEvent = require('matrix-react-sdk/lib/TextForEvent');
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'EventAsTextTile',
|
||||
mixins: [EventAsTextTileController],
|
||||
|
||||
render: function() {
|
||||
var MessageTimestamp = sdk.getComponent('atoms.MessageTimestamp');
|
||||
var MemberAvatar = sdk.getComponent('atoms.MemberAvatar');
|
||||
statics: {
|
||||
needsSenderProfile: function() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var text = TextForEvent.textForEvent(this.props.mxEvent);
|
||||
if (text == null || text.length == 0) return null;
|
||||
|
||||
var timestamp = this.props.last ? <MessageTimestamp ts={this.props.mxEvent.getTs()} /> : null;
|
||||
var avatar = this.props.mxEvent.sender ? <MemberAvatar member={this.props.mxEvent.sender} /> : null;
|
||||
return (
|
||||
<div className="mx_EventAsTextTile">
|
||||
{TextForEvent.textForEvent(this.props.mxEvent)}
|
||||
|
|
|
@ -114,7 +114,9 @@ module.exports = React.createClass({
|
|||
</div>
|
||||
);
|
||||
}
|
||||
sender = <SenderProfile mxEvent={this.props.mxEvent} aux={aux} />;
|
||||
if (EventTileType.needsSenderProfile()) {
|
||||
sender = <SenderProfile mxEvent={this.props.mxEvent} aux={aux} />;
|
||||
}
|
||||
}
|
||||
return (
|
||||
<div className={classes}>
|
||||
|
|
|
@ -28,6 +28,12 @@ module.exports = React.createClass({
|
|||
displayName: 'MessageTile',
|
||||
mixins: [MessageTileController],
|
||||
|
||||
statics: {
|
||||
needsSenderProfile: function() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var UnknownMessageTile = sdk.getComponent('molecules.UnknownMessageTile');
|
||||
|
||||
|
|
Loading…
Reference in New Issue