Import haveTileForEvent() from the right place

This commit is contained in:
Travis Ralston 2019-12-20 14:43:06 -07:00
parent 2461993ad1
commit 0d2cb6e731
5 changed files with 10 additions and 7 deletions

View file

@ -17,6 +17,7 @@ limitations under the License.
import {MatrixClientPeg} from "./MatrixClientPeg"; import {MatrixClientPeg} from "./MatrixClientPeg";
import shouldHideEvent from './shouldHideEvent'; import shouldHideEvent from './shouldHideEvent';
import * as sdk from "./index"; 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 * 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') { } else if (ev.getType() == 'm.room.server_acl') {
return false; return false;
} }
const EventTile = sdk.getComponent('rooms.EventTile'); return haveTileForEvent(ev);
return EventTile.haveTileForEvent(ev);
} }
export function doesRoomHaveUnreadMessages(room) { export function doesRoomHaveUnreadMessages(room) {

View file

@ -27,6 +27,7 @@ import * as sdk from '../../index';
import {MatrixClientPeg} from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import SettingsStore from '../../settings/SettingsStore'; import SettingsStore from '../../settings/SettingsStore';
import {_t} from "../../languageHandler"; import {_t} from "../../languageHandler";
import {haveTileForEvent} from "../views/rooms/EventTile";
const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes
const continuedTypes = ['m.sticker', 'm.room.message']; const continuedTypes = ['m.sticker', 'm.room.message'];
@ -318,8 +319,7 @@ export default class MessagePanel extends React.Component {
return true; return true;
} }
const EventTile = sdk.getComponent('rooms.EventTile'); if (!haveTileForEvent(mxEv)) {
if (!EventTile.haveTileForEvent(mxEv)) {
return false; // no tile = no show return false; // no tile = no show
} }

View file

@ -55,6 +55,7 @@ import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
import WidgetUtils from '../../utils/WidgetUtils'; import WidgetUtils from '../../utils/WidgetUtils';
import AccessibleButton from "../views/elements/AccessibleButton"; import AccessibleButton from "../views/elements/AccessibleButton";
import RightPanelStore from "../../stores/RightPanelStore"; import RightPanelStore from "../../stores/RightPanelStore";
import {haveTileForEvent} from "../views/rooms/EventTile";
const DEBUG = false; const DEBUG = false;
let debuglog = function() {}; let debuglog = function() {};
@ -1245,7 +1246,7 @@ export default createReactClass({
const roomId = mxEv.getRoomId(); const roomId = mxEv.getRoomId();
const room = cli.getRoom(roomId); const room = cli.getRoom(roomId);
if (!EventTile.haveTileForEvent(mxEv)) { if (!haveTileForEvent(mxEv)) {
// XXX: can this ever happen? It will make the result count // XXX: can this ever happen? It will make the result count
// not match the displayed count. // not match the displayed count.
continue; continue;

View file

@ -35,6 +35,7 @@ import { KeyCode } from '../../Keyboard';
import Timer from '../../utils/Timer'; import Timer from '../../utils/Timer';
import shouldHideEvent from '../../shouldHideEvent'; import shouldHideEvent from '../../shouldHideEvent';
import EditorStateTransfer from '../../utils/EditorStateTransfer'; import EditorStateTransfer from '../../utils/EditorStateTransfer';
import {haveTileForEvent} from "../views/rooms/EventTile";
const PAGINATE_SIZE = 20; const PAGINATE_SIZE = 20;
const INITIAL_SIZE = 20; const INITIAL_SIZE = 20;
@ -1179,7 +1180,7 @@ const TimelinePanel = createReactClass({
const shouldIgnore = !!ev.status || // local echo const shouldIgnore = !!ev.status || // local echo
(ignoreOwn && ev.sender && ev.sender.userId == myUserId); // own message (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) { if (isWithoutTile || !node) {
// don't start counting if the event should be ignored, // don't start counting if the event should be ignored,

View file

@ -19,6 +19,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import * as sdk from '../../../index'; import * as sdk from '../../../index';
import {haveTileForEvent} from "./EventTile";
export default createReactClass({ export default createReactClass({
displayName: 'SearchResult', displayName: 'SearchResult',
@ -54,7 +55,7 @@ export default createReactClass({
if (!contextual) { if (!contextual) {
highlights = this.props.searchHighlights; highlights = this.props.searchHighlights;
} }
if (EventTile.haveTileForEvent(ev)) { if (haveTileForEvent(ev)) {
ret.push(<EventTile key={eventId+"+"+j} mxEvent={ev} contextual={contextual} highlights={highlights} ret.push(<EventTile key={eventId+"+"+j} mxEvent={ev} contextual={contextual} highlights={highlights}
permalinkCreator={this.props.permalinkCreator} permalinkCreator={this.props.permalinkCreator}
highlightLink={this.props.resultLink} highlightLink={this.props.resultLink}