From 0d2cb6e73150b1a9255cff1d7ddda34fb900320e Mon Sep 17 00:00:00 2001
From: Travis Ralston <travpc@gmail.com>
Date: Fri, 20 Dec 2019 14:43:06 -0700
Subject: [PATCH] Import haveTileForEvent() from the right place

---
 src/Unread.js                                  | 4 ++--
 src/components/structures/MessagePanel.js      | 4 ++--
 src/components/structures/RoomView.js          | 3 ++-
 src/components/structures/TimelinePanel.js     | 3 ++-
 src/components/views/rooms/SearchResultTile.js | 3 ++-
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/Unread.js b/src/Unread.js
index d199991dc5..f82c0899b5 100644
--- a/src/Unread.js
+++ b/src/Unread.js
@@ -17,6 +17,7 @@ limitations under the License.
 import {MatrixClientPeg} from "./MatrixClientPeg";
 import shouldHideEvent from './shouldHideEvent';
 import * as sdk from "./index";
+import {haveTileForEvent} from "./components/views/rooms/EventTile";
 
 /**
  * Returns true iff this event arriving in a room should affect the room's
@@ -38,8 +39,7 @@ export function eventTriggersUnreadCount(ev) {
     } else if (ev.getType() == 'm.room.server_acl') {
         return false;
     }
-    const EventTile = sdk.getComponent('rooms.EventTile');
-    return EventTile.haveTileForEvent(ev);
+    return haveTileForEvent(ev);
 }
 
 export function doesRoomHaveUnreadMessages(room) {
diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js
index 54b910732a..4ad75eb700 100644
--- a/src/components/structures/MessagePanel.js
+++ b/src/components/structures/MessagePanel.js
@@ -27,6 +27,7 @@ import * as sdk from '../../index';
 import {MatrixClientPeg} from '../../MatrixClientPeg';
 import SettingsStore from '../../settings/SettingsStore';
 import {_t} from "../../languageHandler";
+import {haveTileForEvent} from "../views/rooms/EventTile";
 
 const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes
 const continuedTypes = ['m.sticker', 'm.room.message'];
@@ -318,8 +319,7 @@ export default class MessagePanel extends React.Component {
             return true;
         }
 
-        const EventTile = sdk.getComponent('rooms.EventTile');
-        if (!EventTile.haveTileForEvent(mxEv)) {
+        if (!haveTileForEvent(mxEv)) {
             return false; // no tile = no show
         }
 
diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js
index 1cb9e7db5e..d3309a1f43 100644
--- a/src/components/structures/RoomView.js
+++ b/src/components/structures/RoomView.js
@@ -55,6 +55,7 @@ import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
 import WidgetUtils from '../../utils/WidgetUtils';
 import AccessibleButton from "../views/elements/AccessibleButton";
 import RightPanelStore from "../../stores/RightPanelStore";
+import {haveTileForEvent} from "../views/rooms/EventTile";
 
 const DEBUG = false;
 let debuglog = function() {};
@@ -1245,7 +1246,7 @@ export default createReactClass({
             const roomId = mxEv.getRoomId();
             const room = cli.getRoom(roomId);
 
-            if (!EventTile.haveTileForEvent(mxEv)) {
+            if (!haveTileForEvent(mxEv)) {
                 // XXX: can this ever happen? It will make the result count
                 // not match the displayed count.
                 continue;
diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js
index 54539b63fb..06be5af41c 100644
--- a/src/components/structures/TimelinePanel.js
+++ b/src/components/structures/TimelinePanel.js
@@ -35,6 +35,7 @@ import { KeyCode } from '../../Keyboard';
 import Timer from '../../utils/Timer';
 import shouldHideEvent from '../../shouldHideEvent';
 import EditorStateTransfer from '../../utils/EditorStateTransfer';
+import {haveTileForEvent} from "../views/rooms/EventTile";
 
 const PAGINATE_SIZE = 20;
 const INITIAL_SIZE = 20;
@@ -1179,7 +1180,7 @@ const TimelinePanel = createReactClass({
 
             const shouldIgnore = !!ev.status || // local echo
                 (ignoreOwn && ev.sender && ev.sender.userId == myUserId);   // own message
-            const isWithoutTile = !EventTile.haveTileForEvent(ev) || shouldHideEvent(ev);
+            const isWithoutTile = !haveTileForEvent(ev) || shouldHideEvent(ev);
 
             if (isWithoutTile || !node) {
                 // don't start counting if the event should be ignored,
diff --git a/src/components/views/rooms/SearchResultTile.js b/src/components/views/rooms/SearchResultTile.js
index bf34a56de3..57856a3a5b 100644
--- a/src/components/views/rooms/SearchResultTile.js
+++ b/src/components/views/rooms/SearchResultTile.js
@@ -19,6 +19,7 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import createReactClass from 'create-react-class';
 import * as sdk from '../../../index';
+import {haveTileForEvent} from "./EventTile";
 
 export default createReactClass({
     displayName: 'SearchResult',
@@ -54,7 +55,7 @@ export default createReactClass({
             if (!contextual) {
                 highlights = this.props.searchHighlights;
             }
-            if (EventTile.haveTileForEvent(ev)) {
+            if (haveTileForEvent(ev)) {
                 ret.push(<EventTile key={eventId+"+"+j} mxEvent={ev} contextual={contextual} highlights={highlights}
                           permalinkCreator={this.props.permalinkCreator}
                           highlightLink={this.props.resultLink}