From 9edc361afc283961be02abc7b139a66e062d5ad5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 3 Jan 2020 12:29:22 -0700 Subject: [PATCH] Use new imports for js-sdk's ContentRepo Per https://github.com/matrix-org/matrix-js-sdk/pull/1134/commits/f4d1c5c006027962cd18dffb3f7c521d9e24e831 --- src/Avatar.js | 4 ++-- src/components/structures/RoomDirectory.js | 4 ++-- src/components/views/avatars/RoomAvatar.js | 4 ++-- src/components/views/rooms/RoomDetailRow.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Avatar.js b/src/Avatar.js index 6d31959718..1039ab1bb1 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -15,9 +15,9 @@ limitations under the License. */ 'use strict'; -import {ContentRepo} from 'matrix-js-sdk'; import {MatrixClientPeg} from './MatrixClientPeg'; import DMRoomMap from './utils/DMRoomMap'; +import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; export function avatarUrlForMember(member, width, height, resizeMethod) { let url = member.getAvatarUrl( @@ -38,7 +38,7 @@ export function avatarUrlForMember(member, width, height, resizeMethod) { } export function avatarUrlForUser(user, width, height, resizeMethod) { - const url = ContentRepo.getHttpUriForMxc( + const url = getHttpUriForMxc( MatrixClientPeg.get().getHomeserverUrl(), user.avatarUrl, Math.floor(width * window.devicePixelRatio), Math.floor(height * window.devicePixelRatio), diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index e06c00902b..d783c8cc3f 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -18,7 +18,6 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; -import {ContentRepo} from "matrix-js-sdk"; import {MatrixClientPeg} from "../../MatrixClientPeg"; import * as sdk from "../../index"; import dis from "../../dispatcher"; @@ -28,6 +27,7 @@ import PropTypes from 'prop-types'; import { _t } from '../../languageHandler'; import { instanceForInstanceId, protocolNameForInstanceId } from '../../utils/DirectoryUtils'; import Analytics from '../../Analytics'; +import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; const MAX_NAME_LENGTH = 80; const MAX_TOPIC_LENGTH = 160; @@ -463,7 +463,7 @@ export default createReactClass({ topic = `${topic.substring(0, MAX_TOPIC_LENGTH)}...`; } topic = linkifyAndSanitizeHtml(topic); - const avatarUrl = ContentRepo.getHttpUriForMxc( + const avatarUrl = getHttpUriForMxc( MatrixClientPeg.get().getHomeserverUrl(), room.avatar_url, 32, 32, "crop", ); diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index 3b51fae4b3..c79e1827da 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -16,11 +16,11 @@ limitations under the License. import React from "react"; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import {ContentRepo} from "matrix-js-sdk"; import {MatrixClientPeg} from "../../../MatrixClientPeg"; import Modal from '../../../Modal'; import * as sdk from "../../../index"; import * as Avatar from '../../../Avatar'; +import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; export default createReactClass({ displayName: 'RoomAvatar', @@ -82,7 +82,7 @@ export default createReactClass({ getImageUrls: function(props) { return [ - ContentRepo.getHttpUriForMxc( + getHttpUriForMxc( MatrixClientPeg.get().getHomeserverUrl(), props.oobData.avatarUrl, Math.floor(props.width * window.devicePixelRatio), diff --git a/src/components/views/rooms/RoomDetailRow.js b/src/components/views/rooms/RoomDetailRow.js index 66ec733061..2210406c18 100644 --- a/src/components/views/rooms/RoomDetailRow.js +++ b/src/components/views/rooms/RoomDetailRow.js @@ -18,10 +18,10 @@ import * as sdk from '../../../index'; import React, {createRef} from 'react'; import { _t } from '../../../languageHandler'; import { linkifyElement } from '../../../HtmlUtils'; -import { ContentRepo } from 'matrix-js-sdk'; import {MatrixClientPeg} from '../../../MatrixClientPeg'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; +import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; export function getDisplayAliasForRoom(room) { return room.canonicalAlias || (room.aliases ? room.aliases[0] : ""); @@ -101,7 +101,7 @@ export default createReactClass({