Move early parts of matrix.to bits into its own class

This commit is contained in:
Travis Ralston 2019-09-30 12:37:13 -06:00
parent 64aa6695f5
commit f9d5e89017
4 changed files with 44 additions and 11 deletions

View file

@ -30,9 +30,9 @@ import { _t } from '../../../languageHandler';
import * as ContextualMenu from '../../structures/ContextualMenu';
import SettingsStore from "../../../settings/SettingsStore";
import ReplyThread from "../elements/ReplyThread";
import {host as matrixtoHost} from '../../../utils/permalinks/RoomPermalinkCreator';
import {pillifyLinks} from '../../../utils/pillify';
import {IntegrationManagers} from "../../../integrations/IntegrationManagers";
import {RoomPermalinkCreator} from "../../../utils/permalinks/RoomPermalinkCreator";
module.exports = createReactClass({
displayName: 'TextualBody',
@ -251,7 +251,10 @@ module.exports = createReactClass({
// never preview matrix.to links (if anything we should give a smart
// preview of the room/user they point to: nobody needs to be reminded
// what the matrix.to site looks like).
if (host === matrixtoHost) return false;
if (this.props.mxEvent && this.props.mxEvent.getRoom()) {
const permalinks = new RoomPermalinkCreator(this.props.mxEvent.getRoom());
if (permalinks.isPermalinkHost(host)) return false;
}
if (node.textContent.toLowerCase().trim().startsWith(host.toLowerCase())) {
// it's a "foo.pl" style link