From 7c6fb36520d2d875928ebc1e793bad40f5115a75 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 23 Oct 2015 09:24:25 +0100 Subject: [PATCH] Let the tile contents specify whether it requires a sender profile or not. Fixes #250. --- src/skins/vector/views/molecules/EventAsTextTile.js | 12 ++++++------ src/skins/vector/views/molecules/EventTile.js | 4 +++- src/skins/vector/views/molecules/MessageTile.js | 6 ++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/skins/vector/views/molecules/EventAsTextTile.js b/src/skins/vector/views/molecules/EventAsTextTile.js index 445303e4..fe79dd3a 100644 --- a/src/skins/vector/views/molecules/EventAsTextTile.js +++ b/src/skins/vector/views/molecules/EventAsTextTile.js @@ -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 ? : null; - var avatar = this.props.mxEvent.sender ? : null; return (
{TextForEvent.textForEvent(this.props.mxEvent)} diff --git a/src/skins/vector/views/molecules/EventTile.js b/src/skins/vector/views/molecules/EventTile.js index 534af3c7..1b1642bd 100644 --- a/src/skins/vector/views/molecules/EventTile.js +++ b/src/skins/vector/views/molecules/EventTile.js @@ -114,7 +114,9 @@ module.exports = React.createClass({
); } - sender = ; + if (EventTileType.needsSenderProfile()) { + sender = ; + } } return (
diff --git a/src/skins/vector/views/molecules/MessageTile.js b/src/skins/vector/views/molecules/MessageTile.js index 5e835050..44f5b635 100644 --- a/src/skins/vector/views/molecules/MessageTile.js +++ b/src/skins/vector/views/molecules/MessageTile.js @@ -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');