diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index c0077bc0b..f5a8d28f2 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -415,16 +415,16 @@ module.exports = { var mxEv = new Matrix.MatrixEvent(resultList[i].result); if (resultList[i].context.events_before[0]) { var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_before[0]); - if (EventTile.supportsEventType(mxEv2.getType())) { + if (EventTile.haveTileForEvent(mxEv2)) { ret.push(
  • ); } } - if (EventTile.supportsEventType(mxEv.getType())) { + if (EventTile.haveTileForEvent(mxEv)) { ret.push(
  • ); } if (resultList[i].context.events_after[0]) { var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_after[0]); - if (EventTile.supportsEventType(mxEv2.getType())) { + if (EventTile.haveTileForEvent(mxEv2)) { ret.push(
  • ); } } @@ -435,7 +435,7 @@ module.exports = { for (var i = this.state.room.timeline.length-1; i >= 0 && count < this.state.messageCap; --i) { var mxEv = this.state.room.timeline[i]; - if (!EventTile.supportsEventType(mxEv.getType())) { + if (!EventTile.haveTileForEvent(mxEv)) { continue; } diff --git a/src/skins/vector/views/molecules/EventTile.js b/src/skins/vector/views/molecules/EventTile.js index 6c2f948ca..c5cb81951 100644 --- a/src/skins/vector/views/molecules/EventTile.js +++ b/src/skins/vector/views/molecules/EventTile.js @@ -24,6 +24,8 @@ var sdk = require('matrix-react-sdk') var EventTileController = require('matrix-react-sdk/lib/controllers/molecules/EventTile') var ContextualMenu = require('../../../../ContextualMenu'); +var TextForEvent = require('matrix-react-sdk/lib/TextForEvent'); + var eventTileTypes = { 'm.room.message': 'molecules.MessageTile', 'm.room.member' : 'molecules.EventAsTextTile', @@ -39,8 +41,13 @@ module.exports = React.createClass({ mixins: [EventTileController], statics: { - supportsEventType: function(et) { - return eventTileTypes[et] !== undefined; + haveTileForEvent: function(e) { + if (eventTileTypes[e.getType()] == undefined) return false; + if (eventTileTypes[e.getType()] == 'molecules.EventAsTextTile') { + return TextForEvent.textForEvent(e) !== ''; + } else { + return true; + } } },