From 0b0fe92b1767771b1666c0c4e6fdd5a58b534be0 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 17 Dec 2019 12:51:09 -0700 Subject: [PATCH 01/15] Convert resizer to ES6 --- src/resizer/index.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/resizer/index.js b/src/resizer/index.js index bc4c8f388c5..7c4b2bd493c 100644 --- a/src/resizer/index.js +++ b/src/resizer/index.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,14 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import FixedDistributor from "./distributors/fixed"; -import CollapseDistributor from "./distributors/collapse"; -import RoomSubListDistributor from "./distributors/roomsublist"; -import Resizer from "./resizer"; - -module.exports = { - Resizer, - FixedDistributor, - CollapseDistributor, - RoomSubListDistributor, -}; +export FixedDistributor from "./distributors/fixed"; +export CollapseDistributor from "./distributors/collapse"; +export RoomSubListDistributor from "./distributors/roomsublist"; +export Resizer from "./resizer"; From 344dac4fb984f42e9881f5d6267e1448fe3e319e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 19 Dec 2019 17:45:24 -0700 Subject: [PATCH 02/15] Convert CommonJS exports to ES6-compatible exports We use `export default` begrudgingly here. Ideally we'd use just `export`, though this entire SDK expects things to be exported as a default. Instead of breaking everything, we'll sacrifice our export pattern for a smaller diff - a later commit can always do the default export -> regular export conversion. --- src/Analytics.js | 2 +- src/Avatar.js | 194 +++++++++--------- src/CallHandler.js | 2 +- src/Entities.js | 61 +++--- src/ImageUtils.js | 71 +++---- src/Notifier.js | 2 +- src/PasswordReset.js | 3 +- src/PlatformPeg.js | 2 +- src/Presence.js | 3 +- src/RoomListSorter.js | 6 +- src/ScalarMessaging.js | 49 +++-- src/Skinner.js | 2 +- src/TextForEvent.js | 12 +- src/Unread.js | 130 ++++++------ src/WhoIsTyping.js | 108 +++++----- .../views/dialogs/EncryptedEventDialog.js | 2 +- .../structures/CompatibilityPage.js | 3 +- src/components/structures/FilePanel.js | 3 +- src/components/structures/LeftPanel.js | 2 +- .../structures/NotificationPanel.js | 3 +- src/components/structures/RoomDirectory.js | 2 +- src/components/structures/RoomStatusBar.js | 3 +- src/components/structures/RoomView.js | 2 +- src/components/structures/ScrollPanel.js | 2 +- src/components/structures/SearchBox.js | 2 +- src/components/structures/TimelinePanel.js | 2 +- src/components/structures/UploadBar.js | 3 +- src/components/structures/ViewSource.js | 3 +- .../structures/auth/ForgotPassword.js | 2 +- src/components/structures/auth/Login.js | 2 +- .../structures/auth/PostRegistration.js | 2 +- .../structures/auth/Registration.js | 2 +- src/components/views/auth/AuthFooter.js | 3 +- src/components/views/auth/AuthHeader.js | 2 +- src/components/views/auth/CaptchaForm.js | 2 +- .../views/auth/CustomServerDialog.js | 2 +- src/components/views/auth/RegistrationForm.js | 2 +- src/components/views/avatars/BaseAvatar.js | 3 +- src/components/views/avatars/MemberAvatar.js | 3 +- src/components/views/avatars/RoomAvatar.js | 2 +- .../views/context_menus/MessageContextMenu.js | 2 +- .../context_menus/RoomTileContextMenu.js | 2 +- .../views/create_room/CreateRoomButton.js | 3 +- src/components/views/create_room/Presets.js | 3 +- src/components/views/create_room/RoomAlias.js | 3 +- .../views/dialogs/AddressPickerDialog.js | 2 +- .../views/elements/DialogButtons.js | 3 +- src/components/views/elements/EditableText.js | 2 +- .../views/elements/InlineSpinner.js | 2 +- .../views/elements/MemberEventListSummary.js | 2 +- .../views/elements/MessageSpinner.js | 2 +- .../views/elements/PersistentApp.js | 3 +- .../views/elements/PowerSelector.js | 2 +- src/components/views/elements/ProgressBar.js | 3 +- src/components/views/elements/SettingsFlag.js | 3 +- src/components/views/elements/Spinner.js | 3 +- src/components/views/elements/TintableSvg.js | 3 +- src/components/views/elements/Tooltip.js | 3 +- .../views/elements/TooltipButton.js | 2 +- .../views/elements/TruncatedList.js | 2 +- src/components/views/elements/UserSelector.js | 3 +- src/components/views/globals/MatrixToolbar.js | 2 +- .../views/groups/GroupMemberInfo.js | 3 +- src/components/views/groups/GroupRoomInfo.js | 3 +- src/components/views/messages/MFileBody.js | 2 +- src/components/views/messages/MVideoBody.js | 3 +- src/components/views/messages/MessageEvent.js | 2 +- .../views/messages/RoomAvatarEvent.js | 3 +- src/components/views/messages/RoomCreate.js | 3 +- src/components/views/messages/TextualBody.js | 2 +- src/components/views/messages/TextualEvent.js | 3 +- src/components/views/messages/UnknownBody.js | 2 +- .../views/room_settings/ColorSettings.js | 2 +- .../views/room_settings/UrlPreviewSettings.js | 5 +- src/components/views/rooms/AppsDrawer.js | 2 +- src/components/views/rooms/AuxPanel.js | 2 +- src/components/views/rooms/EventTile.js | 2 +- src/components/views/rooms/ForwardMessage.js | 2 +- .../views/rooms/LinkPreviewWidget.js | 3 +- src/components/views/rooms/MemberInfo.js | 2 +- src/components/views/rooms/MemberList.js | 2 +- src/components/views/rooms/MemberTile.js | 3 +- src/components/views/rooms/PinnedEventTile.js | 2 +- .../views/rooms/PinnedEventsPanel.js | 3 +- src/components/views/rooms/PresenceLabel.js | 2 +- .../views/rooms/ReadReceiptMarker.js | 3 +- src/components/views/rooms/RoomDropTarget.js | 3 +- src/components/views/rooms/RoomHeader.js | 3 +- src/components/views/rooms/RoomList.js | 2 +- src/components/views/rooms/RoomNameEditor.js | 2 +- src/components/views/rooms/RoomPreviewBar.js | 2 +- src/components/views/rooms/RoomTile.js | 2 +- src/components/views/rooms/RoomTopicEditor.js | 2 +- .../views/rooms/RoomUpgradeWarningBar.js | 2 +- src/components/views/rooms/SearchBar.js | 2 +- .../views/rooms/SearchResultTile.js | 3 +- .../views/rooms/SearchableEntityList.js | 3 +- .../views/rooms/TopUnreadMessagesBar.js | 2 +- src/components/views/rooms/UserTile.js | 3 +- src/components/views/rooms/WhoIsTypingTile.js | 2 +- src/components/views/settings/ChangeAvatar.js | 2 +- .../views/settings/ChangeDisplayName.js | 3 +- .../views/settings/ChangePassword.js | 2 +- .../settings/EnableNotificationsButton.js | 2 +- .../views/settings/Notifications.js | 2 +- src/components/views/voip/CallPreview.js | 3 +- src/components/views/voip/CallView.js | 3 +- src/components/views/voip/IncomingCallBox.js | 3 +- src/components/views/voip/VideoFeed.js | 3 +- src/components/views/voip/VideoView.js | 3 +- src/createRoom.js | 4 +- src/dispatcher.js | 2 +- src/email.js | 8 +- src/extend.js | 4 +- src/indexing/EventIndexPeg.js | 2 +- src/notifications/ContentRules.js | 15 +- src/notifications/NotificationUtils.js | 13 +- src/notifications/PushRuleVectorState.js | 55 +++-- src/notifications/StandardActions.js | 21 +- .../VectorPushRulesDefinitions.js | 14 +- src/notifications/index.js | 11 +- src/rageshake/rageshake.js | 136 ++++++------ src/rageshake/submit-rageshake.js | 2 +- src/stores/GroupStore.js | 2 +- src/stores/LifecycleStore.js | 3 +- src/stores/MessageComposerStore.js | 3 +- src/stores/RoomViewStore.js | 3 +- src/stores/SessionStore.js | 3 +- src/stores/WidgetEchoStore.js | 3 +- test/components/stub-component.js | 2 +- test/end-to-end-tests/src/logbuffer.js | 3 +- test/end-to-end-tests/src/logger.js | 3 +- test/end-to-end-tests/src/rest/creator.js | 3 +- test/end-to-end-tests/src/rest/multi.js | 3 +- test/end-to-end-tests/src/rest/room.js | 3 +- test/end-to-end-tests/src/rest/session.js | 2 +- .../src/scenarios/directory.js | 3 +- .../src/scenarios/e2e-encryption.js | 3 +- .../src/scenarios/lazy-loading.js | 3 +- test/end-to-end-tests/src/session.js | 3 +- .../src/usecases/accept-invite.js | 3 +- .../src/usecases/create-room.js | 7 +- test/end-to-end-tests/src/usecases/dialog.js | 13 +- test/end-to-end-tests/src/usecases/invite.js | 3 +- test/end-to-end-tests/src/usecases/join.js | 3 +- .../src/usecases/room-settings.js | 3 +- test/end-to-end-tests/src/usecases/signup.js | 3 +- 147 files changed, 640 insertions(+), 611 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index 3e208ad6bdf..3d28a236b06 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -306,4 +306,4 @@ class Analytics { if (!global.mxAnalytics) { global.mxAnalytics = new Analytics(); } -module.exports = global.mxAnalytics; +export default global.mxAnalytics; diff --git a/src/Avatar.js b/src/Avatar.js index 17860698cb8..3377849eca5 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -19,116 +19,114 @@ import {ContentRepo} from 'matrix-js-sdk'; import MatrixClientPeg from './MatrixClientPeg'; import DMRoomMap from './utils/DMRoomMap'; -module.exports = { - avatarUrlForMember: function(member, width, height, resizeMethod) { - let url = member.getAvatarUrl( - MatrixClientPeg.get().getHomeserverUrl(), - Math.floor(width * window.devicePixelRatio), - Math.floor(height * window.devicePixelRatio), - resizeMethod, - false, - false, - ); - if (!url) { - // member can be null here currently since on invites, the JS SDK - // does not have enough info to build a RoomMember object for - // the inviter. - url = this.defaultAvatarUrlForString(member ? member.userId : ''); - } - return url; - }, +export function avatarUrlForMember(member, width, height, resizeMethod) { + let url = member.getAvatarUrl( + MatrixClientPeg.get().getHomeserverUrl(), + Math.floor(width * window.devicePixelRatio), + Math.floor(height * window.devicePixelRatio), + resizeMethod, + false, + false, + ); + if (!url) { + // member can be null here currently since on invites, the JS SDK + // does not have enough info to build a RoomMember object for + // the inviter. + url = this.defaultAvatarUrlForString(member ? member.userId : ''); + } + return url; +} - avatarUrlForUser: function(user, width, height, resizeMethod) { - const url = ContentRepo.getHttpUriForMxc( - MatrixClientPeg.get().getHomeserverUrl(), user.avatarUrl, - Math.floor(width * window.devicePixelRatio), - Math.floor(height * window.devicePixelRatio), - resizeMethod, - ); - if (!url || url.length === 0) { - return null; - } - return url; - }, +export function avatarUrlForUser(user, width, height, resizeMethod) { + const url = ContentRepo.getHttpUriForMxc( + MatrixClientPeg.get().getHomeserverUrl(), user.avatarUrl, + Math.floor(width * window.devicePixelRatio), + Math.floor(height * window.devicePixelRatio), + resizeMethod, + ); + if (!url || url.length === 0) { + return null; + } + return url; +} - defaultAvatarUrlForString: function(s) { - const images = ['03b381', '368bd6', 'ac3ba8']; - let total = 0; - for (let i = 0; i < s.length; ++i) { - total += s.charCodeAt(i); - } - return require('../res/img/' + images[total % images.length] + '.png'); - }, +export function defaultAvatarUrlForString(s) { + const images = ['03b381', '368bd6', 'ac3ba8']; + let total = 0; + for (let i = 0; i < s.length; ++i) { + total += s.charCodeAt(i); + } + return require('../res/img/' + images[total % images.length] + '.png'); +} - /** - * returns the first (non-sigil) character of 'name', - * converted to uppercase - * @param {string} name - * @return {string} the first letter - */ - getInitialLetter(name) { - if (!name) { - // XXX: We should find out what causes the name to sometimes be falsy. - console.trace("`name` argument to `getInitialLetter` not supplied"); - return undefined; - } - if (name.length < 1) { - return undefined; - } +/** + * returns the first (non-sigil) character of 'name', + * converted to uppercase + * @param {string} name + * @return {string} the first letter + */ +export function getInitialLetter(name) { + if (!name) { + // XXX: We should find out what causes the name to sometimes be falsy. + console.trace("`name` argument to `getInitialLetter` not supplied"); + return undefined; + } + if (name.length < 1) { + return undefined; + } - let idx = 0; - const initial = name[0]; - if ((initial === '@' || initial === '#' || initial === '+') && name[1]) { - idx++; - } + let idx = 0; + const initial = name[0]; + if ((initial === '@' || initial === '#' || initial === '+') && name[1]) { + idx++; + } - // string.codePointAt(0) would do this, but that isn't supported by - // some browsers (notably PhantomJS). - let chars = 1; - const first = name.charCodeAt(idx); + // string.codePointAt(0) would do this, but that isn't supported by + // some browsers (notably PhantomJS). + let chars = 1; + const first = name.charCodeAt(idx); - // check if it’s the start of a surrogate pair - if (first >= 0xD800 && first <= 0xDBFF && name[idx+1]) { - const second = name.charCodeAt(idx+1); - if (second >= 0xDC00 && second <= 0xDFFF) { - chars++; - } + // check if it’s the start of a surrogate pair + if (first >= 0xD800 && first <= 0xDBFF && name[idx+1]) { + const second = name.charCodeAt(idx+1); + if (second >= 0xDC00 && second <= 0xDFFF) { + chars++; } + } + + const firstChar = name.substring(idx, idx+chars); + return firstChar.toUpperCase(); +} - const firstChar = name.substring(idx, idx+chars); - return firstChar.toUpperCase(); - }, +export function avatarUrlForRoom(room, width, height, resizeMethod) { + const explicitRoomAvatar = room.getAvatarUrl( + MatrixClientPeg.get().getHomeserverUrl(), + width, + height, + resizeMethod, + false, + ); + if (explicitRoomAvatar) { + return explicitRoomAvatar; + } - avatarUrlForRoom(room, width, height, resizeMethod) { - const explicitRoomAvatar = room.getAvatarUrl( + let otherMember = null; + const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId); + if (otherUserId) { + otherMember = room.getMember(otherUserId); + } else { + // if the room is not marked as a 1:1, but only has max 2 members + // then still try to show any avatar (pref. other member) + otherMember = room.getAvatarFallbackMember(); + } + if (otherMember) { + return otherMember.getAvatarUrl( MatrixClientPeg.get().getHomeserverUrl(), width, height, resizeMethod, false, ); - if (explicitRoomAvatar) { - return explicitRoomAvatar; - } - - let otherMember = null; - const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId); - if (otherUserId) { - otherMember = room.getMember(otherUserId); - } else { - // if the room is not marked as a 1:1, but only has max 2 members - // then still try to show any avatar (pref. other member) - otherMember = room.getAvatarFallbackMember(); - } - if (otherMember) { - return otherMember.getAvatarUrl( - MatrixClientPeg.get().getHomeserverUrl(), - width, - height, - resizeMethod, - false, - ); - } - return null; - }, -}; + } + return null; +} diff --git a/src/CallHandler.js b/src/CallHandler.js index ecbf6c2c12e..eb5a5c1c8ef 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -583,4 +583,4 @@ if (global.mxCallHandler === undefined) { global.mxCallHandler = callHandler; } -module.exports = global.mxCallHandler; +export default global.mxCallHandler; diff --git a/src/Entities.js b/src/Entities.js index 8be1da0db84..0906bef5de2 100644 --- a/src/Entities.js +++ b/src/Entities.js @@ -105,36 +105,33 @@ class UserEntity extends Entity { } } +export function newEntity(jsx, matchFn) { + const entity = new Entity(); + entity.getJsx = function() { + return jsx; + }; + entity.matches = matchFn; + return entity; +} + +/** + * @param {RoomMember[]} members + * @return {Entity[]} + */ +export function fromRoomMembers(members) { + return members.map(function(m) { + return new MemberEntity(m); + }); +} -module.exports = { - newEntity: function(jsx, matchFn) { - const entity = new Entity(); - entity.getJsx = function() { - return jsx; - }; - entity.matches = matchFn; - return entity; - }, - - /** - * @param {RoomMember[]} members - * @return {Entity[]} - */ - fromRoomMembers: function(members) { - return members.map(function(m) { - return new MemberEntity(m); - }); - }, - - /** - * @param {User[]} users - * @param {boolean} showInviteButton - * @param {Function} inviteFn Called with the user ID. - * @return {Entity[]} - */ - fromUsers: function(users, showInviteButton, inviteFn) { - return users.map(function(u) { - return new UserEntity(u, showInviteButton, inviteFn); - }); - }, -}; +/** + * @param {User[]} users + * @param {boolean} showInviteButton + * @param {Function} inviteFn Called with the user ID. + * @return {Entity[]} + */ +export function fromUsers(users, showInviteButton, inviteFn) { + return users.map(function(u) { + return new UserEntity(u, showInviteButton, inviteFn); + }); +} diff --git a/src/ImageUtils.js b/src/ImageUtils.js index a83d94a6333..c0f7b94b810 100644 --- a/src/ImageUtils.js +++ b/src/ImageUtils.js @@ -16,41 +16,38 @@ limitations under the License. 'use strict'; -module.exports = { - - /** - * Returns the actual height that an image of dimensions (fullWidth, fullHeight) - * will occupy if resized to fit inside a thumbnail bounding box of size - * (thumbWidth, thumbHeight). - * - * If the aspect ratio of the source image is taller than the aspect ratio of - * the thumbnail bounding box, then we return the thumbHeight parameter unchanged. - * Otherwise we return the thumbHeight parameter scaled down appropriately to - * reflect the actual height the scaled thumbnail occupies. - * - * This is very useful for calculating how much height a thumbnail will actually - * consume in the timeline, when performing scroll offset calcuations - * (e.g. scroll locking) - */ - thumbHeight: function(fullWidth, fullHeight, thumbWidth, thumbHeight) { - if (!fullWidth || !fullHeight) { - // Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even - // log this because it's spammy - return undefined; - } - if (fullWidth < thumbWidth && fullHeight < thumbHeight) { - // no scaling needs to be applied - return fullHeight; - } - const widthMulti = thumbWidth / fullWidth; - const heightMulti = thumbHeight / fullHeight; - if (widthMulti < heightMulti) { - // width is the dominant dimension so scaling will be fixed on that - return Math.floor(widthMulti * fullHeight); - } else { - // height is the dominant dimension so scaling will be fixed on that - return Math.floor(heightMulti * fullHeight); - } - }, -}; +/** + * Returns the actual height that an image of dimensions (fullWidth, fullHeight) + * will occupy if resized to fit inside a thumbnail bounding box of size + * (thumbWidth, thumbHeight). + * + * If the aspect ratio of the source image is taller than the aspect ratio of + * the thumbnail bounding box, then we return the thumbHeight parameter unchanged. + * Otherwise we return the thumbHeight parameter scaled down appropriately to + * reflect the actual height the scaled thumbnail occupies. + * + * This is very useful for calculating how much height a thumbnail will actually + * consume in the timeline, when performing scroll offset calcuations + * (e.g. scroll locking) + */ +export function thumbHeight(fullWidth, fullHeight, thumbWidth, thumbHeight) { + if (!fullWidth || !fullHeight) { + // Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even + // log this because it's spammy + return undefined; + } + if (fullWidth < thumbWidth && fullHeight < thumbHeight) { + // no scaling needs to be applied + return fullHeight; + } + const widthMulti = thumbWidth / fullWidth; + const heightMulti = thumbHeight / fullHeight; + if (widthMulti < heightMulti) { + // width is the dominant dimension so scaling will be fixed on that + return Math.floor(widthMulti * fullHeight); + } else { + // height is the dominant dimension so scaling will be fixed on that + return Math.floor(heightMulti * fullHeight); + } +} diff --git a/src/Notifier.js b/src/Notifier.js index dd691d8ca77..10d2048f459 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -364,4 +364,4 @@ if (!global.mxNotifier) { global.mxNotifier = Notifier; } -module.exports = global.mxNotifier; +export default global.mxNotifier; diff --git a/src/PasswordReset.js b/src/PasswordReset.js index 31339eb4e5d..320599f6d98 100644 --- a/src/PasswordReset.js +++ b/src/PasswordReset.js @@ -25,7 +25,7 @@ import { _t } from './languageHandler'; * the client owns the given email address, which is then passed to the password * API on the homeserver in question with the new password. */ -class PasswordReset { +export default class PasswordReset { /** * Configure the endpoints for password resetting. * @param {string} homeserverUrl The URL to the HS which has the account to reset. @@ -101,4 +101,3 @@ class PasswordReset { } } -module.exports = PasswordReset; diff --git a/src/PlatformPeg.js b/src/PlatformPeg.js index 5c1112e23bd..34131fde7d3 100644 --- a/src/PlatformPeg.js +++ b/src/PlatformPeg.js @@ -47,4 +47,4 @@ class PlatformPeg { if (!global.mxPlatformPeg) { global.mxPlatformPeg = new PlatformPeg(); } -module.exports = global.mxPlatformPeg; +export default global.mxPlatformPeg; diff --git a/src/Presence.js b/src/Presence.js index 8ef988f1713..47761575142 100644 --- a/src/Presence.js +++ b/src/Presence.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -104,4 +105,4 @@ class Presence { } } -module.exports = new Presence(); +export default new Presence(); diff --git a/src/RoomListSorter.js b/src/RoomListSorter.js index c06cc60c97f..0ff37a6af22 100644 --- a/src/RoomListSorter.js +++ b/src/RoomListSorter.js @@ -24,12 +24,8 @@ function tsOfNewestEvent(room) { } } -function mostRecentActivityFirst(roomList) { +export function mostRecentActivityFirst(roomList) { return roomList.sort(function(a, b) { return tsOfNewestEvent(b) - tsOfNewestEvent(a); }); } - -module.exports = { - mostRecentActivityFirst, -}; diff --git a/src/ScalarMessaging.js b/src/ScalarMessaging.js index c0ffc3022d6..a449c2c2b9e 100644 --- a/src/ScalarMessaging.js +++ b/src/ScalarMessaging.js @@ -658,30 +658,29 @@ const onMessage = function(event) { let listenerCount = 0; let openManagerUrl = null; -module.exports = { - startListening: function() { - if (listenerCount === 0) { - window.addEventListener("message", onMessage, false); - } - listenerCount += 1; - }, - stopListening: function() { - listenerCount -= 1; - if (listenerCount === 0) { - window.removeEventListener("message", onMessage); - } - if (listenerCount < 0) { - // Make an error so we get a stack trace - const e = new Error( - "ScalarMessaging: mismatched startListening / stopListening detected." + - " Negative count", - ); - console.error(e); - } - }, +export function startListening() { + if (listenerCount === 0) { + window.addEventListener("message", onMessage, false); + } + listenerCount += 1; +} - setOpenManagerUrl: function(url) { - openManagerUrl = url; - }, -}; +export function stopListening() { + listenerCount -= 1; + if (listenerCount === 0) { + window.removeEventListener("message", onMessage); + } + if (listenerCount < 0) { + // Make an error so we get a stack trace + const e = new Error( + "ScalarMessaging: mismatched startListening / stopListening detected." + + " Negative count", + ); + console.error(e); + } +} + +export function setOpenManagerUrl(url) { + openManagerUrl = url; +} diff --git a/src/Skinner.js b/src/Skinner.js index 7235d55937e..fee234d77e5 100644 --- a/src/Skinner.js +++ b/src/Skinner.js @@ -106,5 +106,5 @@ class Skinner { if (global.mxSkinner === undefined) { global.mxSkinner = new Skinner(); } -module.exports = global.mxSkinner; +export default global.mxSkinner; diff --git a/src/TextForEvent.js b/src/TextForEvent.js index c3c8396e26d..fe936d7d21b 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -620,10 +620,8 @@ for (const evType of ALL_RULE_TYPES) { stateHandlers[evType] = textForMjolnirEvent; } -module.exports = { - textForEvent: function(ev) { - const handler = (ev.isState() ? stateHandlers : handlers)[ev.getType()]; - if (handler) return handler(ev); - return ''; - }, -}; +export function textForEvent(ev) { + const handler = (ev.isState() ? stateHandlers : handlers)[ev.getType()]; + if (handler) return handler(ev); + return ''; +} diff --git a/src/Unread.js b/src/Unread.js index d5c5993974b..c2eaa468f5e 100644 --- a/src/Unread.js +++ b/src/Unread.js @@ -18,76 +18,74 @@ const MatrixClientPeg = require('./MatrixClientPeg'); import shouldHideEvent from './shouldHideEvent'; const sdk = require('./index'); -module.exports = { - /** - * Returns true iff this event arriving in a room should affect the room's - * count of unread messages - */ - eventTriggersUnreadCount: function(ev) { - if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) { - return false; - } else if (ev.getType() == 'm.room.member') { - return false; - } else if (ev.getType() == 'm.room.third_party_invite') { - return false; - } else if (ev.getType() == 'm.call.answer' || ev.getType() == 'm.call.hangup') { - return false; - } else if (ev.getType() == 'm.room.message' && ev.getContent().msgtype == 'm.notify') { - return false; - } else if (ev.getType() == 'm.room.aliases' || ev.getType() == 'm.room.canonical_alias') { - return false; - } else if (ev.getType() == 'm.room.server_acl') { - return false; - } - const EventTile = sdk.getComponent('rooms.EventTile'); - return EventTile.haveTileForEvent(ev); - }, +/** + * Returns true iff this event arriving in a room should affect the room's + * count of unread messages + */ +export function eventTriggersUnreadCount(ev) { + if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) { + return false; + } else if (ev.getType() == 'm.room.member') { + return false; + } else if (ev.getType() == 'm.room.third_party_invite') { + return false; + } else if (ev.getType() == 'm.call.answer' || ev.getType() == 'm.call.hangup') { + return false; + } else if (ev.getType() == 'm.room.message' && ev.getContent().msgtype == 'm.notify') { + return false; + } else if (ev.getType() == 'm.room.aliases' || ev.getType() == 'm.room.canonical_alias') { + return false; + } else if (ev.getType() == 'm.room.server_acl') { + return false; + } + const EventTile = sdk.getComponent('rooms.EventTile'); + return EventTile.haveTileForEvent(ev); +} - doesRoomHaveUnreadMessages: function(room) { - const myUserId = MatrixClientPeg.get().credentials.userId; +export function doesRoomHaveUnreadMessages(room) { + const myUserId = MatrixClientPeg.get().credentials.userId; - // get the most recent read receipt sent by our account. - // N.B. this is NOT a read marker (RM, aka "read up to marker"), - // despite the name of the method :(( - const readUpToId = room.getEventReadUpTo(myUserId); + // get the most recent read receipt sent by our account. + // N.B. this is NOT a read marker (RM, aka "read up to marker"), + // despite the name of the method :(( + const readUpToId = room.getEventReadUpTo(myUserId); - // as we don't send RRs for our own messages, make sure we special case that - // if *we* sent the last message into the room, we consider it not unread! - // Should fix: https://github.com/vector-im/riot-web/issues/3263 - // https://github.com/vector-im/riot-web/issues/2427 - // ...and possibly some of the others at - // https://github.com/vector-im/riot-web/issues/3363 - if (room.timeline.length && - room.timeline[room.timeline.length - 1].sender && - room.timeline[room.timeline.length - 1].sender.userId === myUserId) { - return false; - } + // as we don't send RRs for our own messages, make sure we special case that + // if *we* sent the last message into the room, we consider it not unread! + // Should fix: https://github.com/vector-im/riot-web/issues/3263 + // https://github.com/vector-im/riot-web/issues/2427 + // ...and possibly some of the others at + // https://github.com/vector-im/riot-web/issues/3363 + if (room.timeline.length && + room.timeline[room.timeline.length - 1].sender && + room.timeline[room.timeline.length - 1].sender.userId === myUserId) { + return false; + } - // this just looks at whatever history we have, which if we've only just started - // up probably won't be very much, so if the last couple of events are ones that - // don't count, we don't know if there are any events that do count between where - // we have and the read receipt. We could fetch more history to try & find out, - // but currently we just guess. + // this just looks at whatever history we have, which if we've only just started + // up probably won't be very much, so if the last couple of events are ones that + // don't count, we don't know if there are any events that do count between where + // we have and the read receipt. We could fetch more history to try & find out, + // but currently we just guess. - // Loop through messages, starting with the most recent... - for (let i = room.timeline.length - 1; i >= 0; --i) { - const ev = room.timeline[i]; + // Loop through messages, starting with the most recent... + for (let i = room.timeline.length - 1; i >= 0; --i) { + const ev = room.timeline[i]; - if (ev.getId() == readUpToId) { - // If we've read up to this event, there's nothing more recent - // that counts and we can stop looking because the user's read - // this and everything before. - return false; - } else if (!shouldHideEvent(ev) && this.eventTriggersUnreadCount(ev)) { - // We've found a message that counts before we hit - // the user's read receipt, so this room is definitely unread. - return true; - } + if (ev.getId() == readUpToId) { + // If we've read up to this event, there's nothing more recent + // that counts and we can stop looking because the user's read + // this and everything before. + return false; + } else if (!shouldHideEvent(ev) && this.eventTriggersUnreadCount(ev)) { + // We've found a message that counts before we hit + // the user's read receipt, so this room is definitely unread. + return true; } - // If we got here, we didn't find a message that counted but didn't find - // the user's read receipt either, so we guess and say that the room is - // unread on the theory that false positives are better than false - // negatives here. - return true; - }, -}; + } + // If we got here, we didn't find a message that counted but didn't find + // the user's read receipt either, so we guess and say that the room is + // unread on the theory that false positives are better than false + // negatives here. + return true; +} diff --git a/src/WhoIsTyping.js b/src/WhoIsTyping.js index eb09685cbef..d690466127d 100644 --- a/src/WhoIsTyping.js +++ b/src/WhoIsTyping.js @@ -17,68 +17,66 @@ limitations under the License. import MatrixClientPeg from "./MatrixClientPeg"; import { _t } from './languageHandler'; -module.exports = { - usersTypingApartFromMeAndIgnored: function(room) { - return this.usersTyping( - room, [MatrixClientPeg.get().credentials.userId].concat(MatrixClientPeg.get().getIgnoredUsers()), - ); - }, +export function usersTypingApartFromMeAndIgnored(room) { + return usersTyping( + room, [MatrixClientPeg.get().credentials.userId].concat(MatrixClientPeg.get().getIgnoredUsers()), + ); +} - usersTypingApartFromMe: function(room) { - return this.usersTyping( - room, [MatrixClientPeg.get().credentials.userId], - ); - }, +export function usersTypingApartFromMe(room) { + return usersTyping( + room, [MatrixClientPeg.get().credentials.userId], + ); +} - /** - * Given a Room object and, optionally, a list of userID strings - * to exclude, return a list of user objects who are typing. - * @param {Room} room: room object to get users from. - * @param {string[]} exclude: list of user mxids to exclude. - * @returns {string[]} list of user objects who are typing. - */ - usersTyping: function(room, exclude) { - const whoIsTyping = []; +/** + * Given a Room object and, optionally, a list of userID strings + * to exclude, return a list of user objects who are typing. + * @param {Room} room: room object to get users from. + * @param {string[]} exclude: list of user mxids to exclude. + * @returns {string[]} list of user objects who are typing. + */ +export function usersTyping(room, exclude) { + const whoIsTyping = []; - if (exclude === undefined) { - exclude = []; - } + if (exclude === undefined) { + exclude = []; + } - const memberKeys = Object.keys(room.currentState.members); - for (let i = 0; i < memberKeys.length; ++i) { - const userId = memberKeys[i]; + const memberKeys = Object.keys(room.currentState.members); + for (let i = 0; i < memberKeys.length; ++i) { + const userId = memberKeys[i]; - if (room.currentState.members[userId].typing) { - if (exclude.indexOf(userId) === -1) { - whoIsTyping.push(room.currentState.members[userId]); - } + if (room.currentState.members[userId].typing) { + if (exclude.indexOf(userId) === -1) { + whoIsTyping.push(room.currentState.members[userId]); } } + } - return whoIsTyping; - }, + return whoIsTyping; +} - whoIsTypingString: function(whoIsTyping, limit) { - let othersCount = 0; - if (whoIsTyping.length > limit) { - othersCount = whoIsTyping.length - limit + 1; - } - if (whoIsTyping.length === 0) { - return ''; - } else if (whoIsTyping.length === 1) { - return _t('%(displayName)s is typing …', {displayName: whoIsTyping[0].name}); - } - const names = whoIsTyping.map(function(m) { - return m.name; +export function whoIsTypingString(whoIsTyping, limit) { + let othersCount = 0; + if (whoIsTyping.length > limit) { + othersCount = whoIsTyping.length - limit + 1; + } + if (whoIsTyping.length === 0) { + return ''; + } else if (whoIsTyping.length === 1) { + return _t('%(displayName)s is typing …', {displayName: whoIsTyping[0].name}); + } + const names = whoIsTyping.map(function(m) { + return m.name; + }); + if (othersCount>=1) { + return _t('%(names)s and %(count)s others are typing …', { + names: names.slice(0, limit - 1).join(', '), + count: othersCount, }); - if (othersCount>=1) { - return _t('%(names)s and %(count)s others are typing …', { - names: names.slice(0, limit - 1).join(', '), - count: othersCount, - }); - } else { - const lastPerson = names.pop(); - return _t('%(names)s and %(lastPerson)s are typing …', {names: names.join(', '), lastPerson: lastPerson}); - } - }, -}; + } else { + const lastPerson = names.pop(); + return _t('%(names)s and %(lastPerson)s are typing …', {names: names.join(', '), lastPerson: lastPerson}); + } +} diff --git a/src/async-components/views/dialogs/EncryptedEventDialog.js b/src/async-components/views/dialogs/EncryptedEventDialog.js index 145203136aa..b6383c9dabc 100644 --- a/src/async-components/views/dialogs/EncryptedEventDialog.js +++ b/src/async-components/views/dialogs/EncryptedEventDialog.js @@ -21,7 +21,7 @@ import { _t } from '../../../languageHandler'; const sdk = require('../../../index'); const MatrixClientPeg = require("../../../MatrixClientPeg"); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'EncryptedEventDialog', propTypes: { diff --git a/src/components/structures/CompatibilityPage.js b/src/components/structures/CompatibilityPage.js index 28c86f8dd80..9a3fdb5f397 100644 --- a/src/components/structures/CompatibilityPage.js +++ b/src/components/structures/CompatibilityPage.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import { _t } from '../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CompatibilityPage', propTypes: { onAccept: PropTypes.func, diff --git a/src/components/structures/FilePanel.js b/src/components/structures/FilePanel.js index f5a5912dd55..b6fbf6d45d7 100644 --- a/src/components/structures/FilePanel.js +++ b/src/components/structures/FilePanel.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -126,4 +127,4 @@ const FilePanel = createReactClass({ }, }); -module.exports = FilePanel; +export default FilePanel; diff --git a/src/components/structures/LeftPanel.js b/src/components/structures/LeftPanel.js index a0ad2b5c811..57cbd6ec599 100644 --- a/src/components/structures/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -308,4 +308,4 @@ const LeftPanel = createReactClass({ }, }); -module.exports = LeftPanel; +export default LeftPanel; diff --git a/src/components/structures/NotificationPanel.js b/src/components/structures/NotificationPanel.js index 470c7c87280..b65365b7e44 100644 --- a/src/components/structures/NotificationPanel.js +++ b/src/components/structures/NotificationPanel.js @@ -1,6 +1,7 @@ /* Copyright 2016 OpenMarket Ltd Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -60,4 +61,4 @@ const NotificationPanel = createReactClass({ }, }); -module.exports = NotificationPanel; +export default NotificationPanel; diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 4823b0976c4..16333d51c0b 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -38,7 +38,7 @@ function track(action) { Analytics.trackEvent('RoomDirectory', action); } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomDirectory', propTypes: { diff --git a/src/components/structures/RoomStatusBar.js b/src/components/structures/RoomStatusBar.js index b0aa4cb59be..e7a0771962b 100644 --- a/src/components/structures/RoomStatusBar.js +++ b/src/components/structures/RoomStatusBar.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2017, 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +39,7 @@ function getUnsentMessages(room) { }); } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomStatusBar', propTypes: { diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 2f8d2748662..3f9d6805033 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -72,7 +72,7 @@ const RoomContext = PropTypes.shape({ room: PropTypes.instanceOf(Room), }); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomView', propTypes: { ConferenceHandler: PropTypes.any, diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index 17583a22eda..c5725e1343b 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -84,7 +84,7 @@ if (DEBUG_SCROLL) { * offset as normal. */ -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ScrollPanel', propTypes: { diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index 0aa2e15f4cb..faa20a68ba0 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -24,7 +24,7 @@ import { throttle } from 'lodash'; import AccessibleButton from '../../components/views/elements/AccessibleButton'; import classNames from 'classnames'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'SearchBox', propTypes: { diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 41283b53088..d0f99aec912 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -1347,4 +1347,4 @@ const TimelinePanel = createReactClass({ }, }); -module.exports = TimelinePanel; +export default TimelinePanel; diff --git a/src/components/structures/UploadBar.js b/src/components/structures/UploadBar.js index da0ca7fe99f..ce5441089c1 100644 --- a/src/components/structures/UploadBar.js +++ b/src/components/structures/UploadBar.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ const dis = require('../../dispatcher'); const filesize = require('filesize'); import { _t } from '../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'UploadBar', propTypes: { room: PropTypes.object, diff --git a/src/components/structures/ViewSource.js b/src/components/structures/ViewSource.js index ef4ede517a5..e946b5afbfb 100644 --- a/src/components/structures/ViewSource.js +++ b/src/components/structures/ViewSource.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import {_t} from "../../languageHandler"; import sdk from "../../index"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ViewSource', propTypes: { diff --git a/src/components/structures/auth/ForgotPassword.js b/src/components/structures/auth/ForgotPassword.js index ada7d4449b1..6a84913f36d 100644 --- a/src/components/structures/auth/ForgotPassword.js +++ b/src/components/structures/auth/ForgotPassword.js @@ -40,7 +40,7 @@ const PHASE_EMAIL_SENT = 3; // User has clicked the link in email and completed reset const PHASE_DONE = 4; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ForgotPassword', propTypes: { diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index ade417d1562..dc2755be8e1 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -54,7 +54,7 @@ _td("General failure"); /** * A wire component which glues together login UI components and Login logic */ -module.exports = createReactClass({ +export default createReactClass({ displayName: 'Login', propTypes: { diff --git a/src/components/structures/auth/PostRegistration.js b/src/components/structures/auth/PostRegistration.js index a77b4d0d56d..128c061cc4a 100644 --- a/src/components/structures/auth/PostRegistration.js +++ b/src/components/structures/auth/PostRegistration.js @@ -22,7 +22,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import AuthPage from "../../views/auth/AuthPage"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'PostRegistration', propTypes: { diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 69f34f764a2..fce77631f86 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -41,7 +41,7 @@ const PHASE_REGISTRATION = 1; // Enable phases for registration const PHASES_ENABLED = true; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'Registration', propTypes: { diff --git a/src/components/views/auth/AuthFooter.js b/src/components/views/auth/AuthFooter.js index 39d636f9cc4..40761416067 100644 --- a/src/components/views/auth/AuthFooter.js +++ b/src/components/views/auth/AuthFooter.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +20,7 @@ import { _t } from '../../../languageHandler'; import React from 'react'; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'AuthFooter', render: function() { diff --git a/src/components/views/auth/AuthHeader.js b/src/components/views/auth/AuthHeader.js index 193f3478575..70484726814 100644 --- a/src/components/views/auth/AuthHeader.js +++ b/src/components/views/auth/AuthHeader.js @@ -19,7 +19,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import sdk from '../../../index'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'AuthHeader', render: function() { diff --git a/src/components/views/auth/CaptchaForm.js b/src/components/views/auth/CaptchaForm.js index f907a580265..2da837f0293 100644 --- a/src/components/views/auth/CaptchaForm.js +++ b/src/components/views/auth/CaptchaForm.js @@ -24,7 +24,7 @@ const DIV_ID = 'mx_recaptcha'; /** * A pure UI component which displays a captcha form. */ -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CaptchaForm', propTypes: { diff --git a/src/components/views/auth/CustomServerDialog.js b/src/components/views/auth/CustomServerDialog.js index a9a3a53f02c..024951e6c01 100644 --- a/src/components/views/auth/CustomServerDialog.js +++ b/src/components/views/auth/CustomServerDialog.js @@ -19,7 +19,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CustomServerDialog', render: function() { diff --git a/src/components/views/auth/RegistrationForm.js b/src/components/views/auth/RegistrationForm.js index 03fb74462ce..28efe60d0e9 100644 --- a/src/components/views/auth/RegistrationForm.js +++ b/src/components/views/auth/RegistrationForm.js @@ -41,7 +41,7 @@ const PASSWORD_MIN_SCORE = 3; // safely unguessable: moderate protection from of /** * A pure UI component which displays a registration form. */ -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RegistrationForm', propTypes: { diff --git a/src/components/views/avatars/BaseAvatar.js b/src/components/views/avatars/BaseAvatar.js index 82db78615e8..ae9eaba4885 100644 --- a/src/components/views/avatars/BaseAvatar.js +++ b/src/components/views/avatars/BaseAvatar.js @@ -2,6 +2,7 @@ Copyright 2015, 2016 OpenMarket Ltd Copyright 2018 New Vector Ltd Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ import AvatarLogic from '../../../Avatar'; import SettingsStore from "../../../settings/SettingsStore"; import AccessibleButton from '../elements/AccessibleButton'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'BaseAvatar', propTypes: { diff --git a/src/components/views/avatars/MemberAvatar.js b/src/components/views/avatars/MemberAvatar.js index 383bab5e793..4f84191ccd8 100644 --- a/src/components/views/avatars/MemberAvatar.js +++ b/src/components/views/avatars/MemberAvatar.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ const Avatar = require('../../../Avatar'); const sdk = require("../../../index"); const dispatcher = require("../../../dispatcher"); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MemberAvatar', propTypes: { diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index 6f8f236afcd..3e02e439ffa 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -22,7 +22,7 @@ import Modal from '../../../Modal'; import sdk from "../../../index"; import Avatar from '../../../Avatar'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomAvatar', // Room may be left unset here, but if it is, diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index efbfc4322f5..1011b6ce469 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -37,7 +37,7 @@ function canCancel(eventStatus) { return eventStatus === EventStatus.QUEUED || eventStatus === EventStatus.NOT_SENT; } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MessageContextMenu', propTypes: { diff --git a/src/components/views/context_menus/RoomTileContextMenu.js b/src/components/views/context_menus/RoomTileContextMenu.js index f5e68bd20b3..902506b0155 100644 --- a/src/components/views/context_menus/RoomTileContextMenu.js +++ b/src/components/views/context_menus/RoomTileContextMenu.js @@ -63,7 +63,7 @@ const NotifOption = ({active, onClick, src, label}) => { ); }; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomTileContextMenu', propTypes: { diff --git a/src/components/views/create_room/CreateRoomButton.js b/src/components/views/create_room/CreateRoomButton.js index 1c44aed78cb..adf3972effc 100644 --- a/src/components/views/create_room/CreateRoomButton.js +++ b/src/components/views/create_room/CreateRoomButton.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CreateRoomButton', propTypes: { onCreateRoom: PropTypes.func, diff --git a/src/components/views/create_room/Presets.js b/src/components/views/create_room/Presets.js index f512c3e2fdc..0f18d115116 100644 --- a/src/components/views/create_room/Presets.js +++ b/src/components/views/create_room/Presets.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,7 +26,7 @@ const Presets = { Custom: "custom", }; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CreateRoomPresets', propTypes: { onChange: PropTypes.func, diff --git a/src/components/views/create_room/RoomAlias.js b/src/components/views/create_room/RoomAlias.js index fd3e3365f78..bc5dec1468d 100644 --- a/src/components/views/create_room/RoomAlias.js +++ b/src/components/views/create_room/RoomAlias.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomAlias', propTypes: { // Specifying a homeserver will make magical things happen when you, diff --git a/src/components/views/dialogs/AddressPickerDialog.js b/src/components/views/dialogs/AddressPickerDialog.js index 2be505a7981..b7d8f3f55fc 100644 --- a/src/components/views/dialogs/AddressPickerDialog.js +++ b/src/components/views/dialogs/AddressPickerDialog.js @@ -43,7 +43,7 @@ const addressTypeName = { }; -module.exports = createReactClass({ +export default createReactClass({ displayName: "AddressPickerDialog", propTypes: { diff --git a/src/components/views/elements/DialogButtons.js b/src/components/views/elements/DialogButtons.js index e7b3a9c7eb9..4e47e730529 100644 --- a/src/components/views/elements/DialogButtons.js +++ b/src/components/views/elements/DialogButtons.js @@ -1,6 +1,7 @@ /* Copyright 2017 Aidan Gauland Copyright 2018 New Vector Ltd. +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import { _t } from '../../../languageHandler'; /** * Basic container for buttons in modal dialogs. */ -module.exports = createReactClass({ +export default createReactClass({ displayName: "DialogButtons", propTypes: { diff --git a/src/components/views/elements/EditableText.js b/src/components/views/elements/EditableText.js index 59136822553..fbac63cbba4 100644 --- a/src/components/views/elements/EditableText.js +++ b/src/components/views/elements/EditableText.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import {Key} from "../../../Keyboard"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'EditableText', propTypes: { diff --git a/src/components/views/elements/InlineSpinner.js b/src/components/views/elements/InlineSpinner.js index 18711f90d3f..ad70471d89f 100644 --- a/src/components/views/elements/InlineSpinner.js +++ b/src/components/views/elements/InlineSpinner.js @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'InlineSpinner', render: function() { diff --git a/src/components/views/elements/MemberEventListSummary.js b/src/components/views/elements/MemberEventListSummary.js index ef80efaa681..4db0ad1c683 100644 --- a/src/components/views/elements/MemberEventListSummary.js +++ b/src/components/views/elements/MemberEventListSummary.js @@ -24,7 +24,7 @@ import { formatCommaSeparatedList } from '../../../utils/FormattingUtils'; import sdk from "../../../index"; import {MatrixEvent} from "matrix-js-sdk"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MemberEventListSummary', propTypes: { diff --git a/src/components/views/elements/MessageSpinner.js b/src/components/views/elements/MessageSpinner.js index f00fdcf5765..1775fdd4d70 100644 --- a/src/components/views/elements/MessageSpinner.js +++ b/src/components/views/elements/MessageSpinner.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MessageSpinner', render: function() { diff --git a/src/components/views/elements/PersistentApp.js b/src/components/views/elements/PersistentApp.js index 19e4be6083c..996dbf2283b 100644 --- a/src/components/views/elements/PersistentApp.js +++ b/src/components/views/elements/PersistentApp.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ import WidgetUtils from '../../../utils/WidgetUtils'; import sdk from '../../../index'; import MatrixClientPeg from '../../../MatrixClientPeg'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'PersistentApp', getInitialState: function() { diff --git a/src/components/views/elements/PowerSelector.js b/src/components/views/elements/PowerSelector.js index e6babded326..2f4c08922a3 100644 --- a/src/components/views/elements/PowerSelector.js +++ b/src/components/views/elements/PowerSelector.js @@ -22,7 +22,7 @@ import { _t } from '../../../languageHandler'; import Field from "./Field"; import {Key} from "../../../Keyboard"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'PowerSelector', propTypes: { diff --git a/src/components/views/elements/ProgressBar.js b/src/components/views/elements/ProgressBar.js index 3561763e514..045731ba388 100644 --- a/src/components/views/elements/ProgressBar.js +++ b/src/components/views/elements/ProgressBar.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ import React from "react"; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ProgressBar', propTypes: { value: PropTypes.number, diff --git a/src/components/views/elements/SettingsFlag.js b/src/components/views/elements/SettingsFlag.js index a3a6d18d331..15f17805a8b 100644 --- a/src/components/views/elements/SettingsFlag.js +++ b/src/components/views/elements/SettingsFlag.js @@ -1,5 +1,6 @@ /* Copyright 2017 Travis Ralston +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ import SettingsStore from "../../../settings/SettingsStore"; import { _t } from '../../../languageHandler'; import ToggleSwitch from "./ToggleSwitch"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'SettingsFlag', propTypes: { name: PropTypes.string.isRequired, diff --git a/src/components/views/elements/Spinner.js b/src/components/views/elements/Spinner.js index 5d43e836ccc..b1fe97d5d21 100644 --- a/src/components/views/elements/Spinner.js +++ b/src/components/views/elements/Spinner.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +18,7 @@ limitations under the License. import React from "react"; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'Spinner', render: function() { diff --git a/src/components/views/elements/TintableSvg.js b/src/components/views/elements/TintableSvg.js index 73ba375d595..3e0e41f4115 100644 --- a/src/components/views/elements/TintableSvg.js +++ b/src/components/views/elements/TintableSvg.js @@ -1,5 +1,6 @@ /* Copyright 2015 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -83,4 +84,4 @@ Tinter.registerTintable(function() { } }); -module.exports = TintableSvg; +export default TintableSvg; diff --git a/src/components/views/elements/Tooltip.js b/src/components/views/elements/Tooltip.js index 8ff3ce9bdbf..fd845d9db30 100644 --- a/src/components/views/elements/Tooltip.js +++ b/src/components/views/elements/Tooltip.js @@ -2,6 +2,7 @@ Copyright 2015, 2016 OpenMarket Ltd Copyright 2019 New Vector Ltd Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +27,7 @@ import classNames from 'classnames'; const MIN_TOOLTIP_HEIGHT = 25; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'Tooltip', propTypes: { diff --git a/src/components/views/elements/TooltipButton.js b/src/components/views/elements/TooltipButton.js index 0cabf776a4b..29a18d4b345 100644 --- a/src/components/views/elements/TooltipButton.js +++ b/src/components/views/elements/TooltipButton.js @@ -19,7 +19,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import sdk from '../../../index'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'TooltipButton', getInitialState: function() { diff --git a/src/components/views/elements/TruncatedList.js b/src/components/views/elements/TruncatedList.js index e6a5e2ae322..9ce23956388 100644 --- a/src/components/views/elements/TruncatedList.js +++ b/src/components/views/elements/TruncatedList.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'TruncatedList', propTypes: { diff --git a/src/components/views/elements/UserSelector.js b/src/components/views/elements/UserSelector.js index 1010d4144cd..706c6ed2e5a 100644 --- a/src/components/views/elements/UserSelector.js +++ b/src/components/views/elements/UserSelector.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'UserSelector', propTypes: { diff --git a/src/components/views/globals/MatrixToolbar.js b/src/components/views/globals/MatrixToolbar.js index aabf0810f8b..ac449c39d7e 100644 --- a/src/components/views/globals/MatrixToolbar.js +++ b/src/components/views/globals/MatrixToolbar.js @@ -20,7 +20,7 @@ import { _t } from '../../../languageHandler'; import Notifier from '../../../Notifier'; import AccessibleButton from '../../../components/views/elements/AccessibleButton'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MatrixToolbar', hideToolbar: function() { diff --git a/src/components/views/groups/GroupMemberInfo.js b/src/components/views/groups/GroupMemberInfo.js index 3dac90fc35a..e028f5a000c 100644 --- a/src/components/views/groups/GroupMemberInfo.js +++ b/src/components/views/groups/GroupMemberInfo.js @@ -1,6 +1,7 @@ /* Copyright 2017 Vector Creations Ltd Copyright 2017 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,7 +28,7 @@ import { GroupMemberType } from '../../../groups'; import GroupStore from '../../../stores/GroupStore'; import AccessibleButton from '../elements/AccessibleButton'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'GroupMemberInfo', contextTypes: { diff --git a/src/components/views/groups/GroupRoomInfo.js b/src/components/views/groups/GroupRoomInfo.js index f9f7324e23b..1460c7bf0b3 100644 --- a/src/components/views/groups/GroupRoomInfo.js +++ b/src/components/views/groups/GroupRoomInfo.js @@ -1,5 +1,6 @@ /* Copyright 2017 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ import sdk from '../../../index'; import { _t } from '../../../languageHandler'; import GroupStore from '../../../stores/GroupStore'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'GroupRoomInfo', contextTypes: { diff --git a/src/components/views/messages/MFileBody.js b/src/components/views/messages/MFileBody.js index 552b1108d2a..37f1401a58d 100644 --- a/src/components/views/messages/MFileBody.js +++ b/src/components/views/messages/MFileBody.js @@ -194,7 +194,7 @@ function computedStyle(element) { return cssText; } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MFileBody', getInitialState: function() { diff --git a/src/components/views/messages/MVideoBody.js b/src/components/views/messages/MVideoBody.js index 8366d0dd01e..7d0c782bdcd 100644 --- a/src/components/views/messages/MVideoBody.js +++ b/src/components/views/messages/MVideoBody.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import { decryptFile } from '../../../utils/DecryptFile'; import { _t } from '../../../languageHandler'; import SettingsStore from "../../../settings/SettingsStore"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MVideoBody', propTypes: { diff --git a/src/components/views/messages/MessageEvent.js b/src/components/views/messages/MessageEvent.js index ba271f95b5c..61170111c7c 100644 --- a/src/components/views/messages/MessageEvent.js +++ b/src/components/views/messages/MessageEvent.js @@ -21,7 +21,7 @@ import sdk from '../../../index'; import SettingsStore from "../../../settings/SettingsStore"; import {Mjolnir} from "../../../mjolnir/Mjolnir"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MessageEvent', propTypes: { diff --git a/src/components/views/messages/RoomAvatarEvent.js b/src/components/views/messages/RoomAvatarEvent.js index 513e104d122..faae53776d1 100644 --- a/src/components/views/messages/RoomAvatarEvent.js +++ b/src/components/views/messages/RoomAvatarEvent.js @@ -1,6 +1,7 @@ /* Copyright 2017 Vector Creations Ltd Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ import sdk from '../../../index'; import Modal from '../../../Modal'; import AccessibleButton from '../elements/AccessibleButton'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomAvatarEvent', propTypes: { diff --git a/src/components/views/messages/RoomCreate.js b/src/components/views/messages/RoomCreate.js index 9bb6fcc0d8a..8689a636d8a 100644 --- a/src/components/views/messages/RoomCreate.js +++ b/src/components/views/messages/RoomCreate.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks'; import { _t } from '../../../languageHandler'; import MatrixClientPeg from '../../../MatrixClientPeg'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomCreate', propTypes: { diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 6bf45d91933..48144fbb2d8 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -35,7 +35,7 @@ import {IntegrationManagers} from "../../../integrations/IntegrationManagers"; import {isPermalinkHost} from "../../../utils/permalinks/Permalinks"; import {toRightOf} from "../../structures/ContextMenu"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'TextualBody', propTypes: { diff --git a/src/components/views/messages/TextualEvent.js b/src/components/views/messages/TextualEvent.js index be9adeed773..83b3c84f1e5 100644 --- a/src/components/views/messages/TextualEvent.js +++ b/src/components/views/messages/TextualEvent.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ import createReactClass from 'create-react-class'; const TextForEvent = require('../../../TextForEvent'); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'TextualEvent', propTypes: { diff --git a/src/components/views/messages/UnknownBody.js b/src/components/views/messages/UnknownBody.js index ed2306de4f0..2a19f324e8f 100644 --- a/src/components/views/messages/UnknownBody.js +++ b/src/components/views/messages/UnknownBody.js @@ -18,7 +18,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'UnknownBody', render: function() { diff --git a/src/components/views/room_settings/ColorSettings.js b/src/components/views/room_settings/ColorSettings.js index 952c49828b7..1e06da0cd83 100644 --- a/src/components/views/room_settings/ColorSettings.js +++ b/src/components/views/room_settings/ColorSettings.js @@ -40,7 +40,7 @@ const ROOM_COLORS = [ // has a high possibility of being used in the nearish future. // Ref: https://github.com/vector-im/riot-web/issues/8421 -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ColorSettings', propTypes: { diff --git a/src/components/views/room_settings/UrlPreviewSettings.js b/src/components/views/room_settings/UrlPreviewSettings.js index 7a8332cc9f5..30420b193fe 100644 --- a/src/components/views/room_settings/UrlPreviewSettings.js +++ b/src/components/views/room_settings/UrlPreviewSettings.js @@ -1,7 +1,8 @@ /* Copyright 2016 OpenMarket Ltd Copyright 2017 Travis Ralston -Copyright 2018-2019 New Vector Ltd +Copyright 2018, 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +27,7 @@ import dis from "../../../dispatcher"; import MatrixClientPeg from "../../../MatrixClientPeg"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'UrlPreviewSettings', propTypes: { diff --git a/src/components/views/rooms/AppsDrawer.js b/src/components/views/rooms/AppsDrawer.js index e53570dc5b2..5cf7923df30 100644 --- a/src/components/views/rooms/AppsDrawer.js +++ b/src/components/views/rooms/AppsDrawer.js @@ -34,7 +34,7 @@ import SettingsStore from "../../../settings/SettingsStore"; // The maximum number of widgets that can be added in a room const MAX_WIDGETS = 2; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'AppsDrawer', propTypes: { diff --git a/src/components/views/rooms/AuxPanel.js b/src/components/views/rooms/AuxPanel.js index a83160ddbf8..498a7131a27 100644 --- a/src/components/views/rooms/AuxPanel.js +++ b/src/components/views/rooms/AuxPanel.js @@ -29,7 +29,7 @@ import RateLimitedFunc from '../../../ratelimitedfunc'; import SettingsStore from "../../../settings/SettingsStore"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'AuxPanel', propTypes: { diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 988482df7f3..8f645522a31 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -118,7 +118,7 @@ const MAX_READ_AVATARS = 5; // | '--------------------------------------' | // '----------------------------------------------------------' -module.exports = createReactClass({ +export default createReactClass({ displayName: 'EventTile', propTypes: { diff --git a/src/components/views/rooms/ForwardMessage.js b/src/components/views/rooms/ForwardMessage.js index 4a6c560d2c3..7e48071fe50 100644 --- a/src/components/views/rooms/ForwardMessage.js +++ b/src/components/views/rooms/ForwardMessage.js @@ -23,7 +23,7 @@ import dis from '../../../dispatcher'; import { KeyCode } from '../../../Keyboard'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ForwardMessage', propTypes: { diff --git a/src/components/views/rooms/LinkPreviewWidget.js b/src/components/views/rooms/LinkPreviewWidget.js index 2e3a3915d00..985ddc43bd5 100644 --- a/src/components/views/rooms/LinkPreviewWidget.js +++ b/src/components/views/rooms/LinkPreviewWidget.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,7 +26,7 @@ const MatrixClientPeg = require('../../../MatrixClientPeg'); const ImageUtils = require('../../../ImageUtils'); const Modal = require('../../../Modal'); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'LinkPreviewWidget', propTypes: { diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 1a2c8e2212d..d6e23bd87c8 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -50,7 +50,7 @@ import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; import MatrixClientPeg from "../../../MatrixClientPeg"; import {EventTimeline} from "matrix-js-sdk"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MemberInfo', propTypes: { diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 05464b43c9c..a74d34c02c1 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -32,7 +32,7 @@ const INITIAL_LOAD_NUM_MEMBERS = 30; const INITIAL_LOAD_NUM_INVITED = 5; const SHOW_MORE_INCREMENT = 100; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MemberList', getInitialState: function() { diff --git a/src/components/views/rooms/MemberTile.js b/src/components/views/rooms/MemberTile.js index c002849450f..eacb35c69d2 100644 --- a/src/components/views/rooms/MemberTile.js +++ b/src/components/views/rooms/MemberTile.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ const sdk = require('../../../index'); const dis = require('../../../dispatcher'); import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'MemberTile', propTypes: { diff --git a/src/components/views/rooms/PinnedEventTile.js b/src/components/views/rooms/PinnedEventTile.js index 1279c010496..ca03fd787c0 100644 --- a/src/components/views/rooms/PinnedEventTile.js +++ b/src/components/views/rooms/PinnedEventTile.js @@ -25,7 +25,7 @@ import MemberAvatar from "../avatars/MemberAvatar"; import { _t } from '../../../languageHandler'; import {formatFullDate} from '../../../DateUtils'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'PinnedEventTile', propTypes: { mxRoom: PropTypes.object.isRequired, diff --git a/src/components/views/rooms/PinnedEventsPanel.js b/src/components/views/rooms/PinnedEventsPanel.js index dd2febdf399..3f07e255883 100644 --- a/src/components/views/rooms/PinnedEventsPanel.js +++ b/src/components/views/rooms/PinnedEventsPanel.js @@ -1,5 +1,6 @@ /* Copyright 2017 Travis Ralston +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import PinnedEventTile from "./PinnedEventTile"; import { _t } from '../../../languageHandler'; import PinningUtils from "../../../utils/PinningUtils"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'PinnedEventsPanel', propTypes: { // The Room from the js-sdk we're going to show pinned events for diff --git a/src/components/views/rooms/PresenceLabel.js b/src/components/views/rooms/PresenceLabel.js index 5cb34b473fd..f9dcd7e89de 100644 --- a/src/components/views/rooms/PresenceLabel.js +++ b/src/components/views/rooms/PresenceLabel.js @@ -21,7 +21,7 @@ import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'PresenceLabel', propTypes: { diff --git a/src/components/views/rooms/ReadReceiptMarker.js b/src/components/views/rooms/ReadReceiptMarker.js index 27c5e8c20ea..7dda4651b5e 100644 --- a/src/components/views/rooms/ReadReceiptMarker.js +++ b/src/components/views/rooms/ReadReceiptMarker.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,7 +36,7 @@ try { } catch (e) { } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ReadReceiptMarker', propTypes: { diff --git a/src/components/views/rooms/RoomDropTarget.js b/src/components/views/rooms/RoomDropTarget.js index 1012b231053..61b7ca6d594 100644 --- a/src/components/views/rooms/RoomDropTarget.js +++ b/src/components/views/rooms/RoomDropTarget.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +18,7 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomDropTarget', render: function() { diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index eaf2e733ca1..8567c325635 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,7 +33,7 @@ import SettingsStore from "../../../settings/SettingsStore"; import RoomHeaderButtons from '../right_panel/RoomHeaderButtons'; import E2EIcon from './E2EIcon'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomHeader', propTypes: { diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 210c9394dcb..496f9422451 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -49,7 +49,7 @@ function labelForTagName(tagName) { return tagName; } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomList', propTypes: { diff --git a/src/components/views/rooms/RoomNameEditor.js b/src/components/views/rooms/RoomNameEditor.js index 375a4b42b15..d227574ed1f 100644 --- a/src/components/views/rooms/RoomNameEditor.js +++ b/src/components/views/rooms/RoomNameEditor.js @@ -21,7 +21,7 @@ const sdk = require('../../../index'); const MatrixClientPeg = require('../../../MatrixClientPeg'); import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomNameEditor', propTypes: { diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index a43a4df1580..e460c2583f6 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -43,7 +43,7 @@ const MessageCase = Object.freeze({ OtherError: "OtherError", }); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomPreviewBar', propTypes: { diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 817ada97061..1ae0af29c25 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -33,7 +33,7 @@ import RoomViewStore from '../../../stores/RoomViewStore'; import SettingsStore from "../../../settings/SettingsStore"; import {_t} from "../../../languageHandler"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomTile', propTypes: { diff --git a/src/components/views/rooms/RoomTopicEditor.js b/src/components/views/rooms/RoomTopicEditor.js index a7d11313ff1..2a58dcef39f 100644 --- a/src/components/views/rooms/RoomTopicEditor.js +++ b/src/components/views/rooms/RoomTopicEditor.js @@ -20,7 +20,7 @@ import createReactClass from 'create-react-class'; import sdk from '../../../index'; import { _t } from "../../../languageHandler"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomTopicEditor', propTypes: { diff --git a/src/components/views/rooms/RoomUpgradeWarningBar.js b/src/components/views/rooms/RoomUpgradeWarningBar.js index 58d959ddcc1..f1117ff8c60 100644 --- a/src/components/views/rooms/RoomUpgradeWarningBar.js +++ b/src/components/views/rooms/RoomUpgradeWarningBar.js @@ -23,7 +23,7 @@ import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; import MatrixClientPeg from "../../../MatrixClientPeg"; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'RoomUpgradeWarningBar', propTypes: { diff --git a/src/components/views/rooms/SearchBar.js b/src/components/views/rooms/SearchBar.js index 492c29a6217..4edcab3d16e 100644 --- a/src/components/views/rooms/SearchBar.js +++ b/src/components/views/rooms/SearchBar.js @@ -20,7 +20,7 @@ const classNames = require('classnames'); const AccessibleButton = require('../../../components/views/elements/AccessibleButton'); import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'SearchBar', getInitialState: function() { diff --git a/src/components/views/rooms/SearchResultTile.js b/src/components/views/rooms/SearchResultTile.js index 19ed4906830..f5e77879b2e 100644 --- a/src/components/views/rooms/SearchResultTile.js +++ b/src/components/views/rooms/SearchResultTile.js @@ -1,5 +1,6 @@ /* Copyright 2015 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import sdk from '../../../index'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'SearchResult', propTypes: { diff --git a/src/components/views/rooms/SearchableEntityList.js b/src/components/views/rooms/SearchableEntityList.js index 024816c6fcc..bbc98cedef0 100644 --- a/src/components/views/rooms/SearchableEntityList.js +++ b/src/components/views/rooms/SearchableEntityList.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -182,4 +183,4 @@ const SearchableEntityList = createReactClass({ }, }); - module.exports = SearchableEntityList; +export default SearchableEntityList; diff --git a/src/components/views/rooms/TopUnreadMessagesBar.js b/src/components/views/rooms/TopUnreadMessagesBar.js index c7a1a225806..04805c799f7 100644 --- a/src/components/views/rooms/TopUnreadMessagesBar.js +++ b/src/components/views/rooms/TopUnreadMessagesBar.js @@ -22,7 +22,7 @@ import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; import AccessibleButton from '../elements/AccessibleButton'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'TopUnreadMessagesBar', propTypes: { diff --git a/src/components/views/rooms/UserTile.js b/src/components/views/rooms/UserTile.js index 76afda6dd77..0234d1ed852 100644 --- a/src/components/views/rooms/UserTile.js +++ b/src/components/views/rooms/UserTile.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ import createReactClass from 'create-react-class'; const Avatar = require("../../../Avatar"); const sdk = require('../../../index'); -module.exports = createReactClass({ +export default createReactClass({ displayName: 'UserTile', propTypes: { diff --git a/src/components/views/rooms/WhoIsTypingTile.js b/src/components/views/rooms/WhoIsTypingTile.js index 0e23286eb6d..567d821a5e8 100644 --- a/src/components/views/rooms/WhoIsTypingTile.js +++ b/src/components/views/rooms/WhoIsTypingTile.js @@ -23,7 +23,7 @@ import Timer from '../../../utils/Timer'; import MatrixClientPeg from '../../../MatrixClientPeg'; import MemberAvatar from '../avatars/MemberAvatar'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'WhoIsTypingTile', propTypes: { diff --git a/src/components/views/settings/ChangeAvatar.js b/src/components/views/settings/ChangeAvatar.js index 904b17b15fe..3718e8d2dbb 100644 --- a/src/components/views/settings/ChangeAvatar.js +++ b/src/components/views/settings/ChangeAvatar.js @@ -21,7 +21,7 @@ import MatrixClientPeg from "../../../MatrixClientPeg"; import sdk from '../../../index'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ChangeAvatar', propTypes: { initialAvatarUrl: PropTypes.string, diff --git a/src/components/views/settings/ChangeDisplayName.js b/src/components/views/settings/ChangeDisplayName.js index 90c761ba3d1..65aa8a9af67 100644 --- a/src/components/views/settings/ChangeDisplayName.js +++ b/src/components/views/settings/ChangeDisplayName.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ import sdk from '../../../index'; import MatrixClientPeg from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ChangeDisplayName', _getDisplayName: async function() { diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js index a317c46cecb..db38fa065a0 100644 --- a/src/components/views/settings/ChangePassword.js +++ b/src/components/views/settings/ChangePassword.js @@ -30,7 +30,7 @@ import { _t } from '../../../languageHandler'; import sessionStore from '../../../stores/SessionStore'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'ChangePassword', propTypes: { diff --git a/src/components/views/settings/EnableNotificationsButton.js b/src/components/views/settings/EnableNotificationsButton.js index 1f65c39e6ed..9ca591f30e7 100644 --- a/src/components/views/settings/EnableNotificationsButton.js +++ b/src/components/views/settings/EnableNotificationsButton.js @@ -20,7 +20,7 @@ import Notifier from "../../../Notifier"; import dis from "../../../dispatcher"; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'EnableNotificationsButton', componentDidMount: function() { diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 7345980bff9..cc0841011f9 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -63,7 +63,7 @@ function portLegacyActions(actions) { } } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'Notifications', phases: { diff --git a/src/components/views/voip/CallPreview.js b/src/components/views/voip/CallPreview.js index 15c30dcb5b0..d049e23dcf6 100644 --- a/src/components/views/voip/CallPreview.js +++ b/src/components/views/voip/CallPreview.js @@ -1,5 +1,6 @@ /* Copyright 2017, 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ import CallHandler from '../../../CallHandler'; import dis from '../../../dispatcher'; import sdk from '../../../index'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CallPreview', propTypes: { diff --git a/src/components/views/voip/CallView.js b/src/components/views/voip/CallView.js index 3a62ffbac29..79c1c13c306 100644 --- a/src/components/views/voip/CallView.js +++ b/src/components/views/voip/CallView.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ import sdk from '../../../index'; import MatrixClientPeg from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'CallView', propTypes: { diff --git a/src/components/views/voip/IncomingCallBox.js b/src/components/views/voip/IncomingCallBox.js index 2a2839d1034..7317e0a63fa 100644 --- a/src/components/views/voip/IncomingCallBox.js +++ b/src/components/views/voip/IncomingCallBox.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; import sdk from '../../../index'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'IncomingCallBox', propTypes: { diff --git a/src/components/views/voip/VideoFeed.js b/src/components/views/voip/VideoFeed.js index 0faa227088b..4210c60177a 100644 --- a/src/components/views/voip/VideoFeed.js +++ b/src/components/views/voip/VideoFeed.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -module.exports = createReactClass({ +export default createReactClass({ displayName: 'VideoFeed', propTypes: { diff --git a/src/components/views/voip/VideoView.js b/src/components/views/voip/VideoView.js index 83584bcc68a..4409e1aad53 100644 --- a/src/components/views/voip/VideoView.js +++ b/src/components/views/voip/VideoView.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,7 +35,7 @@ function getFullScreenElement() { ); } -module.exports = createReactClass({ +export default createReactClass({ displayName: 'VideoView', propTypes: { diff --git a/src/createRoom.js b/src/createRoom.js index 0ee90beba8c..d47343abf61 100644 --- a/src/createRoom.js +++ b/src/createRoom.js @@ -35,7 +35,7 @@ import {getAddressType} from "./UserAddress"; * @returns {Promise} which resolves to the room id, or null if the * action was aborted or failed. */ -function createRoom(opts) { +export default function createRoom(opts) { opts = opts || {}; if (opts.spinner === undefined) opts.spinner = true; @@ -139,5 +139,3 @@ function createRoom(opts) { return null; }); } - -module.exports = createRoom; diff --git a/src/dispatcher.js b/src/dispatcher.js index 48c8dc86e94..f6bbea97d8c 100644 --- a/src/dispatcher.js +++ b/src/dispatcher.js @@ -55,4 +55,4 @@ class MatrixDispatcher extends flux.Dispatcher { if (global.mxDispatcher === undefined) { global.mxDispatcher = new MatrixDispatcher(); } -module.exports = global.mxDispatcher; +export default global.mxDispatcher; diff --git a/src/email.js b/src/email.js index 3fd535c8490..6e2ed69bb72 100644 --- a/src/email.js +++ b/src/email.js @@ -16,8 +16,6 @@ limitations under the License. const EMAIL_ADDRESS_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; -module.exports = { - looksValid: function(email) { - return EMAIL_ADDRESS_REGEX.test(email); - }, -}; +export function looksValid(email) { + return EMAIL_ADDRESS_REGEX.test(email); +} diff --git a/src/extend.js b/src/extend.js index 4b3f028a94c..263d802ab69 100644 --- a/src/extend.js +++ b/src/extend.js @@ -16,11 +16,11 @@ limitations under the License. 'use strict'; -module.exports = function(dest, src) { +export default function(dest, src) { for (const i in src) { if (src.hasOwnProperty(i)) { dest[i] = src[i]; } } return dest; -}; +} diff --git a/src/indexing/EventIndexPeg.js b/src/indexing/EventIndexPeg.js index 75f0fa66ba7..3746591b1f4 100644 --- a/src/indexing/EventIndexPeg.js +++ b/src/indexing/EventIndexPeg.js @@ -110,4 +110,4 @@ class EventIndexPeg { if (!global.mxEventIndexPeg) { global.mxEventIndexPeg = new EventIndexPeg(); } -module.exports = global.mxEventIndexPeg; +export default global.mxEventIndexPeg; diff --git a/src/notifications/ContentRules.js b/src/notifications/ContentRules.js index f7e722dbfe0..8c285220c7e 100644 --- a/src/notifications/ContentRules.js +++ b/src/notifications/ContentRules.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,9 +17,9 @@ limitations under the License. 'use strict'; -const PushRuleVectorState = require('./PushRuleVectorState'); +import {PushRuleVectorState} from "./PushRuleVectorState"; -module.exports = { +export class ContentRules { /** * Extract the keyword rules from a list of rules, and parse them * into a form which is useful for Vector's UI. @@ -30,7 +31,7 @@ module.exports = { * externalRules: a list of other keyword rules, with states other than * vectorState */ - parseContentRules: function(rulesets) { + static parseContentRules(rulesets) { // first categorise the keyword rules in terms of their actions const contentRules = this._categoriseContentRules(rulesets); @@ -79,9 +80,9 @@ module.exports = { externalRules: contentRules.other, }; } - }, + } - _categoriseContentRules: function(rulesets) { + static _categoriseContentRules(rulesets) { const contentRules = {on: [], on_but_disabled: [], loud: [], loud_but_disabled: [], other: []}; for (const kind in rulesets.global) { for (let i = 0; i < Object.keys(rulesets.global[kind]).length; ++i) { @@ -116,5 +117,5 @@ module.exports = { } } return contentRules; - }, -}; + } +} diff --git a/src/notifications/NotificationUtils.js b/src/notifications/NotificationUtils.js index 79c1b38f6de..bf393da060a 100644 --- a/src/notifications/NotificationUtils.js +++ b/src/notifications/NotificationUtils.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,14 +17,14 @@ limitations under the License. 'use strict'; -module.exports = { +export class NotificationUtils { // Encodes a dictionary of { // "notify": true/false, // "sound": string or undefined, // "highlight: true/false, // } // to a list of push actions. - encodeActions: function(action) { + static encodeActions(action) { const notify = action.notify; const sound = action.sound; const highlight = action.highlight; @@ -41,7 +42,7 @@ module.exports = { } else { return ["dont_notify"]; } - }, + } // Decode a list of actions to a dictionary of { // "notify": true/false, @@ -49,7 +50,7 @@ module.exports = { // "highlight: true/false, // } // If the actions couldn't be decoded then returns null. - decodeActions: function(actions) { + static decodeActions(actions) { let notify = false; let sound = null; let highlight = false; @@ -85,5 +86,5 @@ module.exports = { result.sound = sound; } return result; - }, -}; + } +} diff --git a/src/notifications/PushRuleVectorState.js b/src/notifications/PushRuleVectorState.js index f4ba365b6d4..263226ce1c9 100644 --- a/src/notifications/PushRuleVectorState.js +++ b/src/notifications/PushRuleVectorState.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,42 +17,44 @@ limitations under the License. 'use strict'; -const StandardActions = require('./StandardActions'); -const NotificationUtils = require('./NotificationUtils'); +import {StandardActions} from "./StandardActions"; +import {NotificationUtils} from "./NotificationUtils"; -const states = { - /** The push rule is disabled */ - OFF: "off", +export class PushRuleVectorState { + // Backwards compatibility (things should probably be using .states instead) + static OFF = "off"; + static ON = "on"; + static LOUD = "loud"; - /** The user will receive push notification for this rule */ - ON: "on", - - /** The user will receive push notification for this rule with sound and - highlight if this is legitimate */ - LOUD: "loud", -}; - - -module.exports = { /** * Enum for state of a push rule as defined by the Vector UI. * @readonly * @enum {string} */ - states: states, + static states = { + /** The push rule is disabled */ + OFF: PushRuleVectorState.OFF, + + /** The user will receive push notification for this rule */ + ON: PushRuleVectorState.ON, + + /** The user will receive push notification for this rule with sound and + highlight if this is legitimate */ + LOUD: PushRuleVectorState.LOUD, + }; /** * Convert a PushRuleVectorState to a list of actions * * @return [object] list of push-rule actions */ - actionsFor: function(pushRuleVectorState) { - if (pushRuleVectorState === this.ON) { + static actionsFor(pushRuleVectorState) { + if (pushRuleVectorState === PushRuleVectorState.ON) { return StandardActions.ACTION_NOTIFY; - } else if (pushRuleVectorState === this.LOUD) { + } else if (pushRuleVectorState === PushRuleVectorState.LOUD) { return StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND; } - }, + } /** * Convert a pushrule's actions to a PushRuleVectorState. @@ -60,7 +63,7 @@ module.exports = { * category or in PushRuleVectorState.LOUD, regardless of its enabled * state. Returns null if it does not match these categories. */ - contentRuleVectorStateKind: function(rule) { + static contentRuleVectorStateKind(rule) { const decoded = NotificationUtils.decodeActions(rule.actions); if (!decoded) { @@ -78,16 +81,12 @@ module.exports = { let stateKind = null; switch (tweaks) { case 0: - stateKind = this.ON; + stateKind = PushRuleVectorState.ON; break; case 2: - stateKind = this.LOUD; + stateKind = PushRuleVectorState.LOUD; break; } return stateKind; - }, -}; - -for (const k in states) { - module.exports[k] = states[k]; + } } diff --git a/src/notifications/StandardActions.js b/src/notifications/StandardActions.js index 15f645d5f7e..b54cea332a5 100644 --- a/src/notifications/StandardActions.js +++ b/src/notifications/StandardActions.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,16 +17,16 @@ limitations under the License. 'use strict'; -const NotificationUtils = require('./NotificationUtils'); +import {NotificationUtils} from "./NotificationUtils"; const encodeActions = NotificationUtils.encodeActions; -module.exports = { - ACTION_NOTIFY: encodeActions({notify: true}), - ACTION_NOTIFY_DEFAULT_SOUND: encodeActions({notify: true, sound: "default"}), - ACTION_NOTIFY_RING_SOUND: encodeActions({notify: true, sound: "ring"}), - ACTION_HIGHLIGHT: encodeActions({notify: true, highlight: true}), - ACTION_HIGHLIGHT_DEFAULT_SOUND: encodeActions({notify: true, sound: "default", highlight: true}), - ACTION_DONT_NOTIFY: encodeActions({notify: false}), - ACTION_DISABLED: null, -}; +export class StandardActions { + static ACTION_NOTIFY = encodeActions({notify: true}); + static ACTION_NOTIFY_DEFAULT_SOUND = encodeActions({notify: true, sound: "default"}); + static ACTION_NOTIFY_RING_SOUND = encodeActions({notify: true, sound: "ring"}); + static ACTION_HIGHLIGHT = encodeActions({notify: true, highlight: true}); + static ACTION_HIGHLIGHT_DEFAULT_SOUND = encodeActions({notify: true, sound: "default", highlight: true}); + static ACTION_DONT_NOTIFY = encodeActions({notify: false}); + static ACTION_DISABLED = null; +} diff --git a/src/notifications/VectorPushRulesDefinitions.js b/src/notifications/VectorPushRulesDefinitions.js index b15fb4ccd73..98d197a004d 100644 --- a/src/notifications/VectorPushRulesDefinitions.js +++ b/src/notifications/VectorPushRulesDefinitions.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,10 +18,9 @@ limitations under the License. 'use strict'; import { _td } from '../languageHandler'; - -const StandardActions = require('./StandardActions'); -const PushRuleVectorState = require('./PushRuleVectorState'); -const { decodeActions } = require('./NotificationUtils'); +import {StandardActions} from "./StandardActions"; +import {PushRuleVectorState} from "./PushRuleVectorState"; +import {NotificationUtils} from "./NotificationUtils"; class VectorPushRuleDefinition { constructor(opts) { @@ -51,8 +51,8 @@ class VectorPushRuleDefinition { // value: true vs. unspecified for highlight (which defaults to // true, making them equivalent). if (enabled && - JSON.stringify(decodeActions(rule.actions)) === - JSON.stringify(decodeActions(vectorStateToActions))) { + JSON.stringify(NotificationUtils.decodeActions(rule.actions)) === + JSON.stringify(NotificationUtils.decodeActions(vectorStateToActions))) { return state; } } @@ -68,7 +68,7 @@ class VectorPushRuleDefinition { /** * The descriptions of rules managed by the Vector UI. */ -module.exports = { +export const VectorPushRulesDefinitions = { // Messages containing user's display name ".m.rule.contains_display_name": new VectorPushRuleDefinition({ kind: "override", diff --git a/src/notifications/index.js b/src/notifications/index.js index 8ed77e9d41e..7c400ad8b3e 100644 --- a/src/notifications/index.js +++ b/src/notifications/index.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,9 +17,7 @@ limitations under the License. 'use strict'; -module.exports = { - NotificationUtils: require('./NotificationUtils'), - PushRuleVectorState: require('./PushRuleVectorState'), - VectorPushRulesDefinitions: require('./VectorPushRulesDefinitions'), - ContentRules: require('./ContentRules'), -}; +export * from "./NotificationUtils"; +export * from "./PushRuleVectorState"; +export * from "./VectorPushRulesDefinitions"; +export * from "./ContentRules"; diff --git a/src/rageshake/rageshake.js b/src/rageshake/rageshake.js index 47bab38079e..a9d17e77c95 100644 --- a/src/rageshake/rageshake.js +++ b/src/rageshake/rageshake.js @@ -432,77 +432,73 @@ function selectQuery(store, keyRange, resultMapper) { }); } - -module.exports = { - - /** - * Configure rage shaking support for sending bug reports. - * Modifies globals. - * @return {Promise} Resolves when set up. - */ - init: function() { - if (global.mx_rage_initPromise) { - return global.mx_rage_initPromise; - } - global.mx_rage_logger = new ConsoleLogger(); - global.mx_rage_logger.monkeyPatch(window.console); - - // just *accessing* indexedDB throws an exception in firefox with - // indexeddb disabled. - let indexedDB; - try { - indexedDB = window.indexedDB; - } catch (e) {} - - if (indexedDB) { - global.mx_rage_store = new IndexedDBLogStore(indexedDB, global.mx_rage_logger); - global.mx_rage_initPromise = global.mx_rage_store.connect(); - return global.mx_rage_initPromise; - } - global.mx_rage_initPromise = Promise.resolve(); +/** + * Configure rage shaking support for sending bug reports. + * Modifies globals. + * @return {Promise} Resolves when set up. + */ +export function init() { + if (global.mx_rage_initPromise) { return global.mx_rage_initPromise; - }, + } + global.mx_rage_logger = new ConsoleLogger(); + global.mx_rage_logger.monkeyPatch(window.console); + + // just *accessing* indexedDB throws an exception in firefox with + // indexeddb disabled. + let indexedDB; + try { + indexedDB = window.indexedDB; + } catch (e) {} + + if (indexedDB) { + global.mx_rage_store = new IndexedDBLogStore(indexedDB, global.mx_rage_logger); + global.mx_rage_initPromise = global.mx_rage_store.connect(); + return global.mx_rage_initPromise; + } + global.mx_rage_initPromise = Promise.resolve(); + return global.mx_rage_initPromise; +} - flush: function() { - if (!global.mx_rage_store) { - return; - } - global.mx_rage_store.flush(); - }, +export function flush() { + if (!global.mx_rage_store) { + return; + } + global.mx_rage_store.flush(); +} - /** - * Clean up old logs. - * @return Promise Resolves if cleaned logs. - */ - cleanup: async function() { - if (!global.mx_rage_store) { - return; - } - await global.mx_rage_store.consume(); - }, +/** + * Clean up old logs. + * @return Promise Resolves if cleaned logs. + */ +export async function cleanup() { + if (!global.mx_rage_store) { + return; + } + await global.mx_rage_store.consume(); +} - /** - * Get a recent snapshot of the logs, ready for attaching to a bug report - * - * @return {Array<{lines: string, id, string}>} list of log data - */ - getLogsForReport: async function() { - if (!global.mx_rage_logger) { - throw new Error( - "No console logger, did you forget to call init()?", - ); - } - // If in incognito mode, store is null, but we still want bug report - // sending to work going off the in-memory console logs. - if (global.mx_rage_store) { - // flush most recent logs - await global.mx_rage_store.flush(); - return await global.mx_rage_store.consume(); - } else { - return [{ - lines: global.mx_rage_logger.flush(true), - id: "-", - }]; - } - }, -}; +/** + * Get a recent snapshot of the logs, ready for attaching to a bug report + * + * @return {Array<{lines: string, id, string}>} list of log data + */ +export async function getLogsForReport() { + if (!global.mx_rage_logger) { + throw new Error( + "No console logger, did you forget to call init()?", + ); + } + // If in incognito mode, store is null, but we still want bug report + // sending to work going off the in-memory console logs. + if (global.mx_rage_store) { + // flush most recent logs + await global.mx_rage_store.flush(); + return await global.mx_rage_store.consume(); + } else { + return [{ + lines: global.mx_rage_logger.flush(true), + id: "-", + }]; + } +} diff --git a/src/rageshake/submit-rageshake.js b/src/rageshake/submit-rageshake.js index 457958eb827..0e5db7c54ce 100644 --- a/src/rageshake/submit-rageshake.js +++ b/src/rageshake/submit-rageshake.js @@ -22,7 +22,7 @@ import MatrixClientPeg from '../MatrixClientPeg'; import PlatformPeg from '../PlatformPeg'; import { _t } from '../languageHandler'; -import rageshake from './rageshake'; +import * as rageshake from './rageshake'; // polyfill textencoder if necessary diff --git a/src/stores/GroupStore.js b/src/stores/GroupStore.js index 637e87b7282..3ba0e04631d 100644 --- a/src/stores/GroupStore.js +++ b/src/stores/GroupStore.js @@ -340,4 +340,4 @@ let singletonGroupStore = null; if (!singletonGroupStore) { singletonGroupStore = new GroupStore(); } -module.exports = singletonGroupStore; +export default singletonGroupStore; diff --git a/src/stores/LifecycleStore.js b/src/stores/LifecycleStore.js index 91dcf0aebbe..904f29f7b35 100644 --- a/src/stores/LifecycleStore.js +++ b/src/stores/LifecycleStore.js @@ -1,6 +1,7 @@ /* Copyright 2017 Vector Creations Ltd Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -79,4 +80,4 @@ let singletonLifecycleStore = null; if (!singletonLifecycleStore) { singletonLifecycleStore = new LifecycleStore(); } -module.exports = singletonLifecycleStore; +export default singletonLifecycleStore; diff --git a/src/stores/MessageComposerStore.js b/src/stores/MessageComposerStore.js index ab2dbfedec2..3c7440e10b4 100644 --- a/src/stores/MessageComposerStore.js +++ b/src/stores/MessageComposerStore.js @@ -1,5 +1,6 @@ /* Copyright 2017, 2018 Vector Creations Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -63,4 +64,4 @@ let singletonMessageComposerStore = null; if (!singletonMessageComposerStore) { singletonMessageComposerStore = new MessageComposerStore(); } -module.exports = singletonMessageComposerStore; +export default singletonMessageComposerStore; diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index a3caf876ef2..eb2d539bb17 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -1,6 +1,7 @@ /* Copyright 2017 Vector Creations Ltd Copyright 2017, 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -357,4 +358,4 @@ let singletonRoomViewStore = null; if (!singletonRoomViewStore) { singletonRoomViewStore = new RoomViewStore(); } -module.exports = singletonRoomViewStore; +export default singletonRoomViewStore; diff --git a/src/stores/SessionStore.js b/src/stores/SessionStore.js index ad58f1e93dd..f38bc046d01 100644 --- a/src/stores/SessionStore.js +++ b/src/stores/SessionStore.js @@ -1,5 +1,6 @@ /* Copyright 2017 Vector Creations Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -86,4 +87,4 @@ let singletonSessionStore = null; if (!singletonSessionStore) { singletonSessionStore = new SessionStore(); } -module.exports = singletonSessionStore; +export default singletonSessionStore; diff --git a/src/stores/WidgetEchoStore.js b/src/stores/WidgetEchoStore.js index 0d14ed1d603..33fa45c6359 100644 --- a/src/stores/WidgetEchoStore.js +++ b/src/stores/WidgetEchoStore.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -105,4 +106,4 @@ let singletonWidgetEchoStore = null; if (!singletonWidgetEchoStore) { singletonWidgetEchoStore = new WidgetEchoStore(); } -module.exports = singletonWidgetEchoStore; +export default singletonWidgetEchoStore; diff --git a/test/components/stub-component.js b/test/components/stub-component.js index 9264792ffb5..5638ada09d1 100644 --- a/test/components/stub-component.js +++ b/test/components/stub-component.js @@ -4,7 +4,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; -module.exports = function(opts) { +export default function(opts) { opts = opts || {}; if (!opts.displayName) { opts.displayName = 'StubComponent'; diff --git a/test/end-to-end-tests/src/logbuffer.js b/test/end-to-end-tests/src/logbuffer.js index d586dc8b846..db4be33e8d5 100644 --- a/test/end-to-end-tests/src/logbuffer.js +++ b/test/end-to-end-tests/src/logbuffer.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -module.exports = class LogBuffer { +export default class LogBuffer { constructor(page, eventName, eventMapper, reduceAsync=false, initialValue = "") { this.buffer = initialValue; page.on(eventName, (arg) => { diff --git a/test/end-to-end-tests/src/logger.js b/test/end-to-end-tests/src/logger.js index 283d07f163d..42a9544e4d9 100644 --- a/test/end-to-end-tests/src/logger.js +++ b/test/end-to-end-tests/src/logger.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -module.exports = class Logger { +export default class Logger { constructor(username) { this.indent = 0; this.username = username; diff --git a/test/end-to-end-tests/src/rest/creator.js b/test/end-to-end-tests/src/rest/creator.js index fde54014b29..c4ddee05818 100644 --- a/test/end-to-end-tests/src/rest/creator.js +++ b/test/end-to-end-tests/src/rest/creator.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -31,7 +32,7 @@ function execAsync(command, options) { }); } -module.exports = class RestSessionCreator { +export default class RestSessionCreator { constructor(synapseSubdir, hsUrl, cwd) { this.synapseSubdir = synapseSubdir; this.hsUrl = hsUrl; diff --git a/test/end-to-end-tests/src/rest/multi.js b/test/end-to-end-tests/src/rest/multi.js index e58b9f3f57c..d4cd5c765ce 100644 --- a/test/end-to-end-tests/src/rest/multi.js +++ b/test/end-to-end-tests/src/rest/multi.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +17,7 @@ limitations under the License. const Logger = require('../logger'); -module.exports = class RestMultiSession { +export default class RestMultiSession { constructor(sessions, groupName) { this.log = new Logger(groupName); this.sessions = sessions; diff --git a/test/end-to-end-tests/src/rest/room.js b/test/end-to-end-tests/src/rest/room.js index 429a29c31a5..b3ba7253363 100644 --- a/test/end-to-end-tests/src/rest/room.js +++ b/test/end-to-end-tests/src/rest/room.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +18,7 @@ limitations under the License. const uuidv4 = require('uuid/v4'); /* no pun intented */ -module.exports = class RestRoom { +export default class RestRoom { constructor(session, roomId, log) { this.session = session; this._roomId = roomId; diff --git a/test/end-to-end-tests/src/rest/session.js b/test/end-to-end-tests/src/rest/session.js index 5b97824f5c5..344493968c5 100644 --- a/test/end-to-end-tests/src/rest/session.js +++ b/test/end-to-end-tests/src/rest/session.js @@ -19,7 +19,7 @@ const Logger = require('../logger'); const RestRoom = require('./room'); const {approveConsent} = require('./consent'); -module.exports = class RestSession { +export default class RestSession { constructor(credentials) { this.log = new Logger(credentials.userId); this._credentials = credentials; diff --git a/test/end-to-end-tests/src/scenarios/directory.js b/test/end-to-end-tests/src/scenarios/directory.js index 3ae728a5b71..cf995ae1a85 100644 --- a/test/end-to-end-tests/src/scenarios/directory.js +++ b/test/end-to-end-tests/src/scenarios/directory.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ const {receiveMessage} = require('../usecases/timeline'); const {createRoom} = require('../usecases/create-room'); const changeRoomSettings = require('../usecases/room-settings'); -module.exports = async function roomDirectoryScenarios(alice, bob) { +export default async function roomDirectoryScenarios(alice, bob) { console.log(" creating a public room and join through directory:"); const room = 'test'; await createRoom(alice, room); diff --git a/test/end-to-end-tests/src/scenarios/e2e-encryption.js b/test/end-to-end-tests/src/scenarios/e2e-encryption.js index 8df374bacbe..2a002da66bc 100644 --- a/test/end-to-end-tests/src/scenarios/e2e-encryption.js +++ b/test/end-to-end-tests/src/scenarios/e2e-encryption.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ const changeRoomSettings = require('../usecases/room-settings'); const {startSasVerifcation, acceptSasVerification} = require('../usecases/verify'); const assert = require('assert'); -module.exports = async function e2eEncryptionScenarios(alice, bob) { +export default async function e2eEncryptionScenarios(alice, bob) { console.log(" creating an e2e encrypted room and join through invite:"); const room = "secrets"; await createRoom(bob, room); diff --git a/test/end-to-end-tests/src/scenarios/lazy-loading.js b/test/end-to-end-tests/src/scenarios/lazy-loading.js index be5a91bb714..651397e4261 100644 --- a/test/end-to-end-tests/src/scenarios/lazy-loading.js +++ b/test/end-to-end-tests/src/scenarios/lazy-loading.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,7 +28,7 @@ const {getMembersInMemberlist} = require('../usecases/memberlist'); const changeRoomSettings = require('../usecases/room-settings'); const assert = require('assert'); -module.exports = async function lazyLoadingScenarios(alice, bob, charlies) { +export default async function lazyLoadingScenarios(alice, bob, charlies) { console.log(" creating a room for lazy loading member scenarios:"); const charly1to5 = charlies.slice("charly-1..5", 0, 5); const charly6to10 = charlies.slice("charly-6..10", 5); diff --git a/test/end-to-end-tests/src/session.js b/test/end-to-end-tests/src/session.js index 65cec6fef08..b17e55efa40 100644 --- a/test/end-to-end-tests/src/session.js +++ b/test/end-to-end-tests/src/session.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ const {delay} = require('./util'); const DEFAULT_TIMEOUT = 20000; -module.exports = class RiotSession { +export default class RiotSession { constructor(browser, page, username, riotserver, hsUrl) { this.browser = browser; this.page = page; diff --git a/test/end-to-end-tests/src/usecases/accept-invite.js b/test/end-to-end-tests/src/usecases/accept-invite.js index 085c60aa6a7..d17f583a778 100644 --- a/test/end-to-end-tests/src/usecases/accept-invite.js +++ b/test/end-to-end-tests/src/usecases/accept-invite.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -module.exports = async function acceptInvite(session, name) { +export default async function acceptInvite(session, name) { session.log.step(`accepts "${name}" invite`); //TODO: brittle selector const invitesHandles = await session.queryAll('.mx_RoomTile_name.mx_RoomTile_invite'); diff --git a/test/end-to-end-tests/src/usecases/create-room.js b/test/end-to-end-tests/src/usecases/create-room.js index 75abdc78f47..7ca3826c71c 100644 --- a/test/end-to-end-tests/src/usecases/create-room.js +++ b/test/end-to-end-tests/src/usecases/create-room.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,12 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -async function openRoomDirectory(session) { +export async function openRoomDirectory(session) { const roomDirectoryButton = await session.query('.mx_LeftPanel_explore .mx_AccessibleButton'); await roomDirectoryButton.click(); } -async function createRoom(session, roomName) { +export async function createRoom(session, roomName) { session.log.step(`creates room "${roomName}"`); const roomListHeaders = await session.queryAll('.mx_RoomSubList_labelContainer'); @@ -42,5 +43,3 @@ async function createRoom(session, roomName) { await session.query('.mx_MessageComposer'); session.log.done(); } - -module.exports = {openRoomDirectory, createRoom}; diff --git a/test/end-to-end-tests/src/usecases/dialog.js b/test/end-to-end-tests/src/usecases/dialog.js index 7b5d4d09fa4..72d024fc790 100644 --- a/test/end-to-end-tests/src/usecases/dialog.js +++ b/test/end-to-end-tests/src/usecases/dialog.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,20 +17,20 @@ limitations under the License. const assert = require('assert'); -async function assertDialog(session, expectedTitle) { +export async function assertDialog(session, expectedTitle) { const titleElement = await session.query(".mx_Dialog .mx_Dialog_title"); const dialogHeader = await session.innerText(titleElement); assert(dialogHeader, expectedTitle); } -async function acceptDialog(session, expectedTitle) { +export async function acceptDialog(session, expectedTitle) { const foundDialog = await acceptDialogMaybe(session, expectedTitle); if (!foundDialog) { throw new Error("could not find a dialog"); } } -async function acceptDialogMaybe(session, expectedTitle) { +export async function acceptDialogMaybe(session, expectedTitle) { let primaryButton = null; try { primaryButton = await session.query(".mx_Dialog .mx_Dialog_primary"); @@ -42,9 +43,3 @@ async function acceptDialogMaybe(session, expectedTitle) { await primaryButton.click(); return true; } - -module.exports = { - assertDialog, - acceptDialog, - acceptDialogMaybe, -}; diff --git a/test/end-to-end-tests/src/usecases/invite.js b/test/end-to-end-tests/src/usecases/invite.js index 814ecd30a63..fc91e4ce161 100644 --- a/test/end-to-end-tests/src/usecases/invite.js +++ b/test/end-to-end-tests/src/usecases/invite.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -module.exports = async function invite(session, userId) { +export default async function invite(session, userId) { session.log.step(`invites "${userId}" to room`); await session.delay(1000); const memberPanelButton = await session.query(".mx_RightPanel_membersButton"); diff --git a/test/end-to-end-tests/src/usecases/join.js b/test/end-to-end-tests/src/usecases/join.js index bc292a07683..4fbc1345984 100644 --- a/test/end-to-end-tests/src/usecases/join.js +++ b/test/end-to-end-tests/src/usecases/join.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +17,7 @@ limitations under the License. const {openRoomDirectory} = require('./create-room'); -module.exports = async function join(session, roomName) { +export default async function join(session, roomName) { session.log.step(`joins room "${roomName}"`); await openRoomDirectory(session); const roomInput = await session.query('.mx_DirectorySearchBox input'); diff --git a/test/end-to-end-tests/src/usecases/room-settings.js b/test/end-to-end-tests/src/usecases/room-settings.js index 7655d2d066f..d853cf92e48 100644 --- a/test/end-to-end-tests/src/usecases/room-settings.js +++ b/test/end-to-end-tests/src/usecases/room-settings.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -29,7 +30,7 @@ async function setSettingsToggle(session, toggle, enabled) { } } -module.exports = async function changeRoomSettings(session, settings) { +export default async function changeRoomSettings(session, settings) { session.log.startGroup(`changes the room settings`); /// XXX delay is needed here, possibly because the header is being rerendered /// click doesn't do anything otherwise diff --git a/test/end-to-end-tests/src/usecases/signup.js b/test/end-to-end-tests/src/usecases/signup.js index fd2b9485728..381b87ec9eb 100644 --- a/test/end-to-end-tests/src/usecases/signup.js +++ b/test/end-to-end-tests/src/usecases/signup.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +17,7 @@ limitations under the License. const assert = require('assert'); -module.exports = async function signup(session, username, password, homeserver) { +export default async function signup(session, username, password, homeserver) { session.log.step("signs up"); await session.goto(session.url('/#/register')); // change the homeserver by clicking the advanced section From 4aec432b30209bfe633221c5a93c13140e69e213 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 19 Dec 2019 17:57:50 -0700 Subject: [PATCH 03/15] Convert the more complicated CommonJS exports to ES6-style --- src/CallHandler.js | 6 +-- src/ObjectUtils.js | 9 ++-- src/Resend.js | 42 ++++++++++--------- src/VectorConferenceHandler.js | 28 ++++++------- src/components/structures/RoomView.js | 4 +- src/components/views/rooms/EventTile.js | 8 ++-- src/index.js | 13 +++--- test/end-to-end-tests/src/rest/consent.js | 5 ++- .../src/usecases/memberlist.js | 13 +++--- .../end-to-end-tests/src/usecases/settings.js | 9 ++-- .../end-to-end-tests/src/usecases/timeline.js | 13 +++--- test/end-to-end-tests/src/usecases/verify.js | 9 ++-- test/end-to-end-tests/src/util.js | 9 ++-- test/mock-clock.js | 9 ++-- 14 files changed, 91 insertions(+), 86 deletions(-) diff --git a/src/CallHandler.js b/src/CallHandler.js index eb5a5c1c8ef..7dabaa3fc1a 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -302,7 +302,7 @@ function _onAction(payload) { switch (payload.action) { case 'place_call': { - if (module.exports.getAnyActiveCall()) { + if (callHandler.getAnyActiveCall()) { const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, { title: _t('Existing Call'), @@ -355,7 +355,7 @@ function _onAction(payload) { break; case 'incoming_call': { - if (module.exports.getAnyActiveCall()) { + if (callHandler.getAnyActiveCall()) { // ignore multiple incoming calls. in future, we may want a line-1/line-2 setup. // we avoid rejecting with "busy" in case the user wants to answer it on a different device. // in future we could signal a "local busy" as a warning to the caller. @@ -523,7 +523,7 @@ if (!global.mxCallHandler) { const callHandler = { getCallForRoom: function(roomId) { - let call = module.exports.getCall(roomId); + let call = callHandler.getCall(roomId); if (call) return call; if (ConferenceHandler) { diff --git a/src/ObjectUtils.js b/src/ObjectUtils.js index 07d8b465af1..24dfe61d688 100644 --- a/src/ObjectUtils.js +++ b/src/ObjectUtils.js @@ -1,5 +1,6 @@ /* Copyright 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ limitations under the License. * @return {Object[]} An array of objects with the form: * { key: $KEY, val: $VALUE, place: "add|del" } */ -module.exports.getKeyValueArrayDiffs = function(before, after) { +export function getKeyValueArrayDiffs(before, after) { const results = []; const delta = {}; Object.keys(before).forEach(function(beforeKey) { @@ -76,7 +77,7 @@ module.exports.getKeyValueArrayDiffs = function(before, after) { }); return results; -}; +} /** * Shallow-compare two objects for equality: each key and value must be identical @@ -84,7 +85,7 @@ module.exports.getKeyValueArrayDiffs = function(before, after) { * @param {Object} objB Second object to compare against the first * @return {boolean} whether the two objects have same key=values */ -module.exports.shallowEqual = function(objA, objB) { +export function shallowEqual(objA, objB) { if (objA === objB) { return true; } @@ -109,4 +110,4 @@ module.exports.shallowEqual = function(objA, objB) { } return true; -}; +} diff --git a/src/Resend.js b/src/Resend.js index 51ec804c010..563171d73e8 100644 --- a/src/Resend.js +++ b/src/Resend.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,40 +19,43 @@ import MatrixClientPeg from './MatrixClientPeg'; import dis from './dispatcher'; import { EventStatus } from 'matrix-js-sdk'; -module.exports = { - resendUnsentEvents: function(room) { - room.getPendingEvents().filter(function(ev) { +export default class Resend { + static resendUnsentEvents(room) { + room.getPendingEvents().filter(function (ev) { return ev.status === EventStatus.NOT_SENT; - }).forEach(function(event) { - module.exports.resend(event); + }).forEach(function (event) { + Resend.resend(event); }); - }, - cancelUnsentEvents: function(room) { - room.getPendingEvents().filter(function(ev) { + } + + static cancelUnsentEvents(room) { + room.getPendingEvents().filter(function (ev) { return ev.status === EventStatus.NOT_SENT; - }).forEach(function(event) { - module.exports.removeFromQueue(event); + }).forEach(function (event) { + Resend.removeFromQueue(event); }); - }, - resend: function(event) { + } + + static resend(event) { const room = MatrixClientPeg.get().getRoom(event.getRoomId()); - MatrixClientPeg.get().resendEvent(event, room).then(function(res) { + MatrixClientPeg.get().resendEvent(event, room).then(function (res) { dis.dispatch({ action: 'message_sent', event: event, }); - }, function(err) { + }, function (err) { // XXX: temporary logging to try to diagnose // https://github.com/vector-im/riot-web/issues/3148 - console.log('Resend got send failure: ' + err.name + '('+err+')'); + console.log('Resend got send failure: ' + err.name + '(' + err + ')'); dis.dispatch({ action: 'message_send_failed', event: event, }); }); - }, - removeFromQueue: function(event) { + } + + static removeFromQueue(event) { MatrixClientPeg.get().cancelPendingEvent(event); - }, -}; + } +} diff --git a/src/VectorConferenceHandler.js b/src/VectorConferenceHandler.js index e0e333a3717..debb5f94b21 100644 --- a/src/VectorConferenceHandler.js +++ b/src/VectorConferenceHandler.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,10 +29,10 @@ import MatrixClientPeg from "./MatrixClientPeg"; const USER_PREFIX = "fs_"; const DOMAIN = "matrix.org"; -function ConferenceCall(matrixClient, groupChatRoomId) { +export function ConferenceCall(matrixClient, groupChatRoomId) { this.client = matrixClient; this.groupRoomId = groupChatRoomId; - this.confUserId = module.exports.getConferenceUserIdForRoom(this.groupRoomId); + this.confUserId = getConferenceUserIdForRoom(this.groupRoomId); } ConferenceCall.prototype.setup = function() { @@ -90,7 +91,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() { * @param {string} userId The user ID to check. * @return {boolean} True if it is a conference bot. */ -module.exports.isConferenceUser = function(userId) { +export function isConferenceUser(userId) { if (userId.indexOf("@" + USER_PREFIX) !== 0) { return false; } @@ -101,26 +102,26 @@ module.exports.isConferenceUser = function(userId) { return /^!.+:.+/.test(decoded); } return false; -}; +} -module.exports.getConferenceUserIdForRoom = function(roomId) { +export function getConferenceUserIdForRoom(roomId) { // abuse browserify's core node Buffer support (strip padding ='s) const base64RoomId = new Buffer(roomId).toString("base64").replace(/=/g, ""); return "@" + USER_PREFIX + base64RoomId + ":" + DOMAIN; -}; +} -module.exports.createNewMatrixCall = function(client, roomId) { +export function createNewMatrixCall(client, roomId) { const confCall = new ConferenceCall( client, roomId, ); return confCall.setup(); -}; +} -module.exports.getConferenceCallForRoom = function(roomId) { +export function getConferenceCallForRoom(roomId) { // search for a conference 1:1 call for this group chat room ID const activeCall = CallHandler.getAnyActiveCall(); if (activeCall && activeCall.confUserId) { - const thisRoomConfUserId = module.exports.getConferenceUserIdForRoom( + const thisRoomConfUserId = getConferenceUserIdForRoom( roomId, ); if (thisRoomConfUserId === activeCall.confUserId) { @@ -128,8 +129,7 @@ module.exports.getConferenceCallForRoom = function(roomId) { } } return null; -}; - -module.exports.ConferenceCall = ConferenceCall; +} -module.exports.slot = 'conference'; +// TODO: Document this. +export const slot = 'conference'; diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 3f9d6805033..c2311586b3d 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -66,7 +66,7 @@ if (DEBUG) { debuglog = console.log.bind(console); } -const RoomContext = PropTypes.shape({ +export const RoomContext = PropTypes.shape({ canReact: PropTypes.bool.isRequired, canReply: PropTypes.bool.isRequired, room: PropTypes.instanceOf(Room), @@ -2002,5 +2002,3 @@ export default createReactClass({ ); }, }); - -module.exports.RoomContext = RoomContext; diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 8f645522a31..8b8c60e4023 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -75,7 +75,7 @@ for (const evType of ALL_RULE_TYPES) { stateEventTileTypes[evType] = 'messages.TextualEvent'; } -function getHandlerTile(ev) { +export function getHandlerTile(ev) { const type = ev.getType(); // don't show verification requests we're not involved in, @@ -879,7 +879,7 @@ function isMessageEvent(ev) { return (messageTypes.includes(ev.getType())); } -module.exports.haveTileForEvent = function(e) { +export function haveTileForEvent(e) { // Only messages have a tile (black-rectangle) if redacted if (e.isRedacted() && !isMessageEvent(e)) return false; @@ -895,7 +895,7 @@ module.exports.haveTileForEvent = function(e) { } else { return true; } -}; +} function E2ePadlockUndecryptable(props) { return ( @@ -964,5 +964,3 @@ class E2ePadlock extends React.Component { ); } } - -module.exports.getHandlerTile = getHandlerTile; diff --git a/src/index.js b/src/index.js index 7d0547d9c9f..008e15ad906 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,14 +17,14 @@ limitations under the License. import Skinner from './Skinner'; -module.exports.loadSkin = function(skinObject) { +export function loadSkin(skinObject) { Skinner.load(skinObject); -}; +} -module.exports.resetSkin = function() { +export function resetSkin() { Skinner.reset(); -}; +} -module.exports.getComponent = function(componentName) { +export function getComponent(componentName) { return Skinner.getComponent(componentName); -}; +} diff --git a/test/end-to-end-tests/src/rest/consent.js b/test/end-to-end-tests/src/rest/consent.js index 1e36f541a3a..5c424cd6e8a 100644 --- a/test/end-to-end-tests/src/rest/consent.js +++ b/test/end-to-end-tests/src/rest/consent.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ const request = require('request-promise-native'); const cheerio = require('cheerio'); const url = require("url"); -module.exports.approveConsent = async function(consentUrl) { +export async function approveConsent(consentUrl) { const body = await request.get(consentUrl); const doc = cheerio.load(body); const v = doc("input[name=v]").val(); @@ -27,4 +28,4 @@ module.exports.approveConsent = async function(consentUrl) { const formAction = doc("form").attr("action"); const absAction = url.resolve(consentUrl, formAction); await request.post(absAction).form({v, u, h}); -}; +} diff --git a/test/end-to-end-tests/src/usecases/memberlist.js b/test/end-to-end-tests/src/usecases/memberlist.js index 42601b66106..8d2aacf35cb 100644 --- a/test/end-to-end-tests/src/usecases/memberlist.js +++ b/test/end-to-end-tests/src/usecases/memberlist.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +17,7 @@ limitations under the License. const assert = require('assert'); -async function openMemberInfo(session, name) { +export async function openMemberInfo(session, name) { const membersAndNames = await getMembersInMemberlist(session); const matchingLabel = membersAndNames.filter((m) => { return m.displayName === name; @@ -24,9 +25,7 @@ async function openMemberInfo(session, name) { await matchingLabel.click(); } -module.exports.openMemberInfo = openMemberInfo; - -module.exports.verifyDeviceForUser = async function(session, name, expectedDevice) { +export async function verifyDeviceForUser(session, name, expectedDevice) { session.log.step(`verifies e2e device for ${name}`); const membersAndNames = await getMembersInMemberlist(session); const matchingLabel = membersAndNames.filter((m) => { @@ -59,9 +58,9 @@ module.exports.verifyDeviceForUser = async function(session, name, expectedDevic const closeMemberInfo = await session.query(".mx_MemberInfo_cancel"); await closeMemberInfo.click(); session.log.done(); -}; +} -async function getMembersInMemberlist(session) { +export async function getMembersInMemberlist(session) { const memberPanelButton = await session.query(".mx_RightPanel_membersButton"); try { await session.query(".mx_RightPanel_headerButton_highlight", 500); @@ -78,5 +77,3 @@ async function getMembersInMemberlist(session) { return {label: el, displayName: await session.innerText(el)}; })); } - -module.exports.getMembersInMemberlist = getMembersInMemberlist; diff --git a/test/end-to-end-tests/src/usecases/settings.js b/test/end-to-end-tests/src/usecases/settings.js index ec675157f25..411ec3b4976 100644 --- a/test/end-to-end-tests/src/usecases/settings.js +++ b/test/end-to-end-tests/src/usecases/settings.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,7 +29,7 @@ async function openSettings(session, section) { } } -module.exports.enableLazyLoading = async function(session) { +export async function enableLazyLoading(session) { session.log.step(`enables lazy loading of members in the lab settings`); const settingsButton = await session.query('.mx_BottomLeftMenu_settings'); await settingsButton.click(); @@ -38,9 +39,9 @@ module.exports.enableLazyLoading = async function(session) { const closeButton = await session.query(".mx_RoomHeader_cancelButton"); await closeButton.click(); session.log.done(); -}; +} -module.exports.getE2EDeviceFromSettings = async function(session) { +export async function getE2EDeviceFromSettings(session) { session.log.step(`gets e2e device/key from settings`); await openSettings(session, "security"); const deviceAndKey = await session.queryAll(".mx_SettingsTab_section .mx_SecurityUserSettingsTab_deviceInfo code"); @@ -51,4 +52,4 @@ module.exports.getE2EDeviceFromSettings = async function(session) { await closeButton.click(); session.log.done(); return {id, key}; -}; +} diff --git a/test/end-to-end-tests/src/usecases/timeline.js b/test/end-to-end-tests/src/usecases/timeline.js index 3ff9e0f5b4a..8a18e2653fd 100644 --- a/test/end-to-end-tests/src/usecases/timeline.js +++ b/test/end-to-end-tests/src/usecases/timeline.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +17,7 @@ limitations under the License. const assert = require('assert'); -module.exports.scrollToTimelineTop = async function(session) { +export async function scrollToTimelineTop(session) { session.log.step(`scrolls to the top of the timeline`); await session.page.evaluate(() => { return Promise.resolve().then(async () => { @@ -40,9 +41,9 @@ module.exports.scrollToTimelineTop = async function(session) { }); }); session.log.done(); -}; +} -module.exports.receiveMessage = async function(session, expectedMessage) { +export async function receiveMessage(session, expectedMessage) { session.log.step(`receives message "${expectedMessage.body}" from ${expectedMessage.sender}`); // wait for a response to come in that contains the message // crude, but effective @@ -66,10 +67,10 @@ module.exports.receiveMessage = async function(session, expectedMessage) { }); assertMessage(lastMessage, expectedMessage); session.log.done(); -}; +} -module.exports.checkTimelineContains = async function(session, expectedMessages, sendersDescription) { +export async function checkTimelineContains(session, expectedMessages, sendersDescription) { session.log.step(`checks timeline contains ${expectedMessages.length} ` + `given messages${sendersDescription ? ` from ${sendersDescription}`:""}`); const eventTiles = await getAllEventTiles(session); @@ -101,7 +102,7 @@ module.exports.checkTimelineContains = async function(session, expectedMessages, }); session.log.done(); -}; +} function assertMessage(foundMessage, expectedMessage) { assert(foundMessage, `message ${JSON.stringify(expectedMessage)} not found in timeline`); diff --git a/test/end-to-end-tests/src/usecases/verify.js b/test/end-to-end-tests/src/usecases/verify.js index 11ff98d0979..a8b71cfe5cb 100644 --- a/test/end-to-end-tests/src/usecases/verify.js +++ b/test/end-to-end-tests/src/usecases/verify.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -37,7 +38,7 @@ async function getSasCodes(session) { return sasLabels; } -module.exports.startSasVerifcation = async function(session, name) { +export async function startSasVerifcation(session, name) { await startVerification(session, name); // expect "Verify device" dialog and click "Begin Verification" await assertDialog(session, "Verify device"); @@ -50,9 +51,9 @@ module.exports.startSasVerifcation = async function(session, name) { // click "Got it" when verification is done await acceptDialog(session); return sasCodes; -}; +} -module.exports.acceptSasVerification = async function(session, name) { +export async function acceptSasVerification(session, name) { await assertDialog(session, "Incoming Verification Request"); const opponentLabelElement = await session.query(".mx_IncomingSasDialog_opponentProfile h2"); const opponentLabel = await session.innerText(opponentLabelElement); @@ -66,4 +67,4 @@ module.exports.acceptSasVerification = async function(session, name) { // click "Got it" when verification is done await acceptDialog(session); return sasCodes; -}; +} diff --git a/test/end-to-end-tests/src/util.js b/test/end-to-end-tests/src/util.js index 699b11b5ce6..cafe929eca9 100644 --- a/test/end-to-end-tests/src/util.js +++ b/test/end-to-end-tests/src/util.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,14 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -module.exports.range = function(start, amount, step = 1) { +export function range(start, amount, step = 1) { const r = []; for (let i = 0; i < amount; ++i) { r.push(start + (i * step)); } return r; -}; +} -module.exports.delay = function(ms) { +export function delay(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); -}; +} diff --git a/test/mock-clock.js b/test/mock-clock.js index 103e186c1f4..7cad0e94832 100644 --- a/test/mock-clock.js +++ b/test/mock-clock.js @@ -1,5 +1,6 @@ /* Copyright (c) 2008-2015 Pivotal Labs +Copyright 2019 The Matrix.org Foundation C.I.C. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -411,10 +412,10 @@ j$.MockDate = function() { return MockDate; }(); -const clock = new j$.Clock(global, function() { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global)); +const _clock = new j$.Clock(global, function() { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global)); -module.exports.clock = function() { - return clock; -}; +export function clock() { + return _clock; +} From 042bd35d79bb640b6f454194a1924f0175a8e665 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 20 Dec 2019 14:13:46 -0700 Subject: [PATCH 04/15] Fix MatrixClientPeg imports --- src/AddThreepid.js | 2 +- src/Avatar.js | 2 +- src/CallHandler.js | 2 +- src/ContentMessages.js | 2 +- src/CrossSigningManager.js | 2 +- src/FromWidgetPostMessageApi.js | 2 +- src/GroupAddressPicker.js | 2 +- src/HtmlUtils.js | 2 +- src/IdentityAuthClient.js | 2 +- src/Lifecycle.js | 2 +- src/MatrixClientPeg.js | 5 ----- src/Notifier.js | 2 +- src/Presence.js | 2 +- src/Registration.js | 2 +- src/Resend.js | 2 +- src/RoomInvite.js | 2 +- src/RoomNotifs.js | 2 +- src/Rooms.js | 2 +- src/ScalarAuthClient.js | 3 +-- src/ScalarMessaging.js | 2 +- src/Searching.js | 2 +- src/SlashCommands.js | 2 +- src/Terms.js | 2 +- src/TextForEvent.js | 2 +- src/Unread.js | 2 +- src/VectorConferenceHandler.js | 2 +- src/WhoIsTyping.js | 2 +- src/WidgetMessaging.js | 2 +- src/async-components/views/dialogs/EncryptedEventDialog.js | 3 ++- .../views/dialogs/keybackup/CreateKeyBackupDialog.js | 2 +- .../views/dialogs/keybackup/NewRecoveryMethodDialog.js | 2 +- .../views/dialogs/secretstorage/CreateSecretStorageDialog.js | 2 +- src/autocomplete/CommunityProvider.js | 2 +- src/autocomplete/NotifProvider.js | 2 +- src/autocomplete/RoomProvider.js | 2 +- src/autocomplete/UserProvider.js | 2 +- src/components/structures/EmbeddedPage.js | 2 +- src/components/structures/FilePanel.js | 2 +- src/components/structures/GroupView.js | 2 +- src/components/structures/LoggedInView.js | 2 +- src/components/structures/MatrixChat.js | 2 +- src/components/structures/MessagePanel.js | 2 +- src/components/structures/NotificationPanel.js | 3 ++- src/components/structures/RoomDirectory.js | 4 ++-- src/components/structures/RoomStatusBar.js | 2 +- src/components/structures/RoomView.js | 2 +- src/components/structures/TimelinePanel.js | 2 +- src/components/structures/TopLeftMenuButton.js | 2 +- src/components/structures/UserView.js | 2 +- src/components/structures/auth/PostRegistration.js | 2 +- src/components/structures/auth/Registration.js | 2 +- src/components/structures/auth/SoftLogout.js | 2 +- src/components/views/avatars/GroupAvatar.js | 2 +- src/components/views/avatars/MemberStatusMessageAvatar.js | 2 +- src/components/views/avatars/RoomAvatar.js | 2 +- src/components/views/context_menus/MessageContextMenu.js | 2 +- src/components/views/context_menus/RoomTileContextMenu.js | 2 +- .../views/context_menus/StatusMessageContextMenu.js | 2 +- src/components/views/context_menus/TopLeftMenu.js | 2 +- src/components/views/dialogs/AddressPickerDialog.js | 2 +- src/components/views/dialogs/BaseDialog.js | 2 +- src/components/views/dialogs/CreateGroupDialog.js | 2 +- src/components/views/dialogs/CreateRoomDialog.js | 2 +- src/components/views/dialogs/DeactivateAccountDialog.js | 2 +- src/components/views/dialogs/DeviceVerifyDialog.js | 2 +- src/components/views/dialogs/DevtoolsDialog.js | 2 +- src/components/views/dialogs/IncomingSasDialog.js | 2 +- src/components/views/dialogs/LogoutDialog.js | 2 +- src/components/views/dialogs/MessageEditHistoryDialog.js | 2 +- src/components/views/dialogs/ReportEventDialog.js | 2 +- src/components/views/dialogs/RoomSettingsDialog.js | 2 +- src/components/views/dialogs/RoomUpgradeDialog.js | 2 +- src/components/views/dialogs/RoomUpgradeWarningDialog.js | 2 +- src/components/views/dialogs/SetMxIdDialog.js | 2 +- src/components/views/dialogs/UnknownDeviceDialog.js | 2 +- .../views/dialogs/keybackup/RestoreKeyBackupDialog.js | 2 +- .../views/dialogs/secretstorage/AccessSecretStorageDialog.js | 2 +- src/components/views/directory/NetworkDropdown.js | 2 +- src/components/views/elements/AddressTile.js | 2 +- src/components/views/elements/AppPermission.js | 2 +- src/components/views/elements/AppTile.js | 2 +- src/components/views/elements/DeviceVerifyButtons.js | 2 +- src/components/views/elements/ErrorBoundary.js | 2 +- src/components/views/elements/ImageView.js | 4 +--- src/components/views/elements/PersistentApp.js | 2 +- src/components/views/elements/Pill.js | 2 +- src/components/views/elements/RoomAliasField.js | 2 +- src/components/views/emojipicker/ReactionPicker.js | 2 +- src/components/views/groups/GroupInviteTile.js | 2 +- src/components/views/messages/EditHistoryMessage.js | 2 +- src/components/views/messages/MAudioBody.js | 2 +- src/components/views/messages/MFileBody.js | 2 +- src/components/views/messages/MKeyVerificationConclusion.js | 2 +- src/components/views/messages/MKeyVerificationRequest.js | 2 +- src/components/views/messages/MVideoBody.js | 2 +- src/components/views/messages/ReactionsRow.js | 2 +- src/components/views/messages/ReactionsRowButton.js | 2 +- src/components/views/messages/ReactionsRowButtonTooltip.js | 2 +- src/components/views/messages/RoomAvatarEvent.js | 2 +- src/components/views/messages/RoomCreate.js | 2 +- src/components/views/right_panel/UserInfo.js | 2 +- src/components/views/room_settings/AliasSettings.js | 2 +- src/components/views/room_settings/RoomProfileSettings.js | 2 +- src/components/views/room_settings/UrlPreviewSettings.js | 2 +- src/components/views/rooms/AppsDrawer.js | 2 +- src/components/views/rooms/AuxPanel.js | 2 +- src/components/views/rooms/EventTile.js | 2 +- src/components/views/rooms/LinkPreviewWidget.js | 2 +- src/components/views/rooms/MemberInfo.js | 2 +- src/components/views/rooms/MemberList.js | 2 +- src/components/views/rooms/MessageComposer.js | 2 +- src/components/views/rooms/MessageComposerInput.js | 2 +- src/components/views/rooms/PinnedEventTile.js | 2 +- src/components/views/rooms/PinnedEventsPanel.js | 2 +- src/components/views/rooms/RoomBreadcrumbs.js | 2 +- src/components/views/rooms/RoomDetailRow.js | 2 +- src/components/views/rooms/RoomHeader.js | 2 +- src/components/views/rooms/RoomList.js | 2 +- src/components/views/rooms/RoomNameEditor.js | 2 +- src/components/views/rooms/RoomPreviewBar.js | 2 +- src/components/views/rooms/RoomRecoveryReminder.js | 2 +- src/components/views/rooms/RoomTile.js | 2 +- src/components/views/rooms/RoomUpgradeWarningBar.js | 2 +- src/components/views/rooms/SlateMessageComposer.js | 2 +- src/components/views/rooms/Stickerpicker.js | 2 +- src/components/views/rooms/ThirdPartyMemberInfo.js | 2 +- src/components/views/rooms/WhoIsTypingTile.js | 2 +- src/components/views/settings/ChangeAvatar.js | 2 +- src/components/views/settings/ChangeDisplayName.js | 2 +- src/components/views/settings/ChangePassword.js | 2 +- src/components/views/settings/CrossSigningPanel.js | 2 +- src/components/views/settings/DevicesPanel.js | 2 +- src/components/views/settings/DevicesPanelEntry.js | 2 +- src/components/views/settings/KeyBackupPanel.js | 2 +- src/components/views/settings/Notifications.js | 2 +- src/components/views/settings/ProfileSettings.js | 2 +- src/components/views/settings/SetIdServer.js | 2 +- src/components/views/settings/account/EmailAddresses.js | 2 +- src/components/views/settings/account/PhoneNumbers.js | 2 +- src/components/views/settings/discovery/EmailAddresses.js | 2 +- src/components/views/settings/discovery/PhoneNumbers.js | 2 +- .../views/settings/tabs/room/AdvancedRoomSettingsTab.js | 2 +- .../views/settings/tabs/room/GeneralRoomSettingsTab.js | 2 +- .../views/settings/tabs/room/NotificationSettingsTab.js | 2 +- .../views/settings/tabs/room/RolesRoomSettingsTab.js | 2 +- .../views/settings/tabs/room/SecurityRoomSettingsTab.js | 2 +- .../views/settings/tabs/user/FlairUserSettingsTab.js | 2 +- .../views/settings/tabs/user/GeneralUserSettingsTab.js | 2 +- .../views/settings/tabs/user/HelpUserSettingsTab.js | 2 +- .../views/settings/tabs/user/MjolnirUserSettingsTab.js | 2 +- .../views/settings/tabs/user/SecurityUserSettingsTab.js | 2 +- .../views/settings/tabs/user/VoiceUserSettingsTab.js | 2 +- src/components/views/toasts/VerificationRequestToast.js | 2 +- src/components/views/voip/CallView.js | 2 +- src/components/views/voip/IncomingCallBox.js | 2 +- src/createRoom.js | 2 +- src/indexing/EventIndex.js | 2 +- src/integrations/IntegrationManagers.js | 2 +- src/mjolnir/BanList.js | 2 +- src/mjolnir/Mjolnir.js | 2 +- src/rageshake/submit-rageshake.js | 2 +- src/settings/controllers/NotificationControllers.js | 2 +- src/settings/handlers/AccountSettingsHandler.js | 2 +- src/settings/handlers/DeviceSettingsHandler.js | 2 +- src/settings/handlers/RoomAccountSettingsHandler.js | 2 +- src/settings/handlers/RoomSettingsHandler.js | 2 +- src/stores/ActiveWidgetStore.js | 2 +- src/stores/GroupStore.js | 2 +- src/stores/RoomViewStore.js | 2 +- src/stores/TagOrderStore.js | 2 +- src/stores/TypingStore.js | 2 +- src/utils/DMRoomMap.js | 2 +- src/utils/DecryptFile.js | 2 +- src/utils/EventUtils.js | 2 +- src/utils/HostingLink.js | 2 +- src/utils/IdentityServerUtils.js | 2 +- src/utils/KeyVerificationStateObserver.js | 2 +- src/utils/MultiInviter.js | 2 +- src/utils/PasswordScorer.js | 2 +- src/utils/WidgetUtils.js | 2 +- src/utils/permalinks/Permalinks.js | 2 +- src/utils/pillify.js | 2 +- test/ScalarAuthClient-test.js | 2 +- test/Terms-test.js | 2 +- test/components/structures/GroupView-test.js | 2 +- test/components/structures/MessagePanel-test.js | 2 +- test/components/views/dialogs/InteractiveAuthDialog-test.js | 2 +- test/components/views/groups/GroupMemberList-test.js | 2 +- test/components/views/rooms/MemberList-test.js | 2 +- test/components/views/rooms/MessageComposerInput-test.js | 2 +- test/components/views/rooms/RoomList-test.js | 2 +- test/components/views/rooms/RoomSettings-test.js | 2 +- 192 files changed, 194 insertions(+), 200 deletions(-) diff --git a/src/AddThreepid.js b/src/AddThreepid.js index 4d027e4cfb0..7a3250d0caf 100644 --- a/src/AddThreepid.js +++ b/src/AddThreepid.js @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import * as sdk from './index'; import Modal from './Modal'; import { _t } from './languageHandler'; diff --git a/src/Avatar.js b/src/Avatar.js index 17860698cb8..c74f21bd374 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -16,7 +16,7 @@ limitations under the License. 'use strict'; import {ContentRepo} from 'matrix-js-sdk'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import DMRoomMap from './utils/DMRoomMap'; module.exports = { diff --git a/src/CallHandler.js b/src/CallHandler.js index a5e6c34ab35..2c22b12a3d6 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -53,7 +53,7 @@ limitations under the License. * } */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import PlatformPeg from './PlatformPeg'; import Modal from './Modal'; import * as sdk from './index'; diff --git a/src/ContentMessages.js b/src/ContentMessages.js index 4b8b911cfa3..0752b0e59d0 100644 --- a/src/ContentMessages.js +++ b/src/ContentMessages.js @@ -19,7 +19,7 @@ limitations under the License. import extend from './extend'; import dis from './dispatcher'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import * as sdk from './index'; import { _t } from './languageHandler'; import Modal from './Modal'; diff --git a/src/CrossSigningManager.js b/src/CrossSigningManager.js index a0919ddb285..a242042bdba 100644 --- a/src/CrossSigningManager.js +++ b/src/CrossSigningManager.js @@ -16,7 +16,7 @@ limitations under the License. import Modal from './Modal'; import * as sdk from './index'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import { deriveKey } from 'matrix-js-sdk/src/crypto/key_passphrase'; import { decodeRecoveryKey } from 'matrix-js-sdk/src/crypto/recoverykey'; import { _t } from './languageHandler'; diff --git a/src/FromWidgetPostMessageApi.js b/src/FromWidgetPostMessageApi.js index 8915c1412fd..64caba0fdf8 100644 --- a/src/FromWidgetPostMessageApi.js +++ b/src/FromWidgetPostMessageApi.js @@ -20,7 +20,7 @@ import URL from 'url'; import dis from './dispatcher'; import WidgetMessagingEndpoint from './WidgetMessagingEndpoint'; import ActiveWidgetStore from './stores/ActiveWidgetStore'; -import MatrixClientPeg from "./MatrixClientPeg"; +import {MatrixClientPeg} from "./MatrixClientPeg"; import RoomViewStore from "./stores/RoomViewStore"; import {IntegrationManagers} from "./integrations/IntegrationManagers"; import SettingsStore from "./settings/SettingsStore"; diff --git a/src/GroupAddressPicker.js b/src/GroupAddressPicker.js index 2d34af01eb7..9131a89e5d2 100644 --- a/src/GroupAddressPicker.js +++ b/src/GroupAddressPicker.js @@ -19,7 +19,7 @@ import Modal from './Modal'; import * as sdk from './'; import MultiInviter from './utils/MultiInviter'; import { _t } from './languageHandler'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import GroupStore from './stores/GroupStore'; import {allSettled} from "./utils/promise"; diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index 2b7384a5aa5..3402ee13e31 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -29,7 +29,7 @@ import linkifyMatrix from './linkify-matrix'; import _linkifyElement from 'linkifyjs/element'; import _linkifyString from 'linkifyjs/string'; import classNames from 'classnames'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import url from 'url'; import EMOJIBASE from 'emojibase-data/en/compact.json'; diff --git a/src/IdentityAuthClient.js b/src/IdentityAuthClient.js index a501426865c..72432b9a44a 100644 --- a/src/IdentityAuthClient.js +++ b/src/IdentityAuthClient.js @@ -16,7 +16,7 @@ limitations under the License. import { createClient, SERVICE_TYPES } from 'matrix-js-sdk'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import Modal from './Modal'; import * as sdk from './index'; import { _t } from './languageHandler'; diff --git a/src/Lifecycle.js b/src/Lifecycle.js index 9847c972f4f..0796e326a0c 100644 --- a/src/Lifecycle.js +++ b/src/Lifecycle.js @@ -18,7 +18,7 @@ limitations under the License. import Matrix from 'matrix-js-sdk'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import EventIndexPeg from './indexing/EventIndexPeg'; import createMatrixClient from './utils/createMatrixClient'; import Analytics from './Analytics'; diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 44a05c2d6ee..9c939f2fd37 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -248,9 +248,4 @@ if (!global.mxMatrixClientPeg) { global.mxMatrixClientPeg = new _MatrixClientPeg(); } -// We export both because the syntax is slightly different with -// our babel changes. We maintain both for backwards compatibility -// and for babel to be happy. -// TODO: Convert this to a single export -export default global.mxMatrixClientPeg; export const MatrixClientPeg = global.mxMatrixClientPeg; diff --git a/src/Notifier.js b/src/Notifier.js index 73b1eae33c2..0c335a80303 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import PlatformPeg from './PlatformPeg'; import * as TextForEvent from './TextForEvent'; import Analytics from './Analytics'; diff --git a/src/Presence.js b/src/Presence.js index 8ef988f1713..e3f5169c8fc 100644 --- a/src/Presence.js +++ b/src/Presence.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from "./MatrixClientPeg"; +import {MatrixClientPeg} from "./MatrixClientPeg"; import dis from "./dispatcher"; import Timer from './utils/Timer'; diff --git a/src/Registration.js b/src/Registration.js index e76e7bc5bf9..ac8baa3cca6 100644 --- a/src/Registration.js +++ b/src/Registration.js @@ -24,7 +24,7 @@ import dis from './dispatcher'; import * as sdk from './index'; import Modal from './Modal'; import { _t } from './languageHandler'; -// import MatrixClientPeg from './MatrixClientPeg'; +// import {MatrixClientPeg} from './MatrixClientPeg'; // Regex for what a "safe" or "Matrix-looking" localpart would be. // TODO: Update as needed for https://github.com/matrix-org/matrix-doc/issues/1514 diff --git a/src/Resend.js b/src/Resend.js index 51ec804c010..31d541630c9 100644 --- a/src/Resend.js +++ b/src/Resend.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import dis from './dispatcher'; import { EventStatus } from 'matrix-js-sdk'; diff --git a/src/RoomInvite.js b/src/RoomInvite.js index 80979da372c..380bb4a7ac5 100644 --- a/src/RoomInvite.js +++ b/src/RoomInvite.js @@ -16,7 +16,7 @@ limitations under the License. */ import React from 'react'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import MultiInviter from './utils/MultiInviter'; import Modal from './Modal'; import { getAddressType } from './UserAddress'; diff --git a/src/RoomNotifs.js b/src/RoomNotifs.js index efc647436b7..c67acaf3145 100644 --- a/src/RoomNotifs.js +++ b/src/RoomNotifs.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import {PushProcessor} from 'matrix-js-sdk/src/pushprocessor'; export const ALL_MESSAGES_LOUD = 'all_messages_loud'; diff --git a/src/Rooms.js b/src/Rooms.js index 239e348b582..f65e0ff2182 100644 --- a/src/Rooms.js +++ b/src/Rooms.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; /** * Given a room object, return the alias we should use for it, diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index c67f49ba261..99d6c533a94 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -18,10 +18,9 @@ limitations under the License. import url from 'url'; import SettingsStore from "./settings/SettingsStore"; import { Service, startTermsFlow, TermsNotSignedError } from './Terms'; +import {MatrixClientPeg} from "./MatrixClientPeg"; const request = require('browser-request'); -const MatrixClientPeg = require('./MatrixClientPeg'); - import * as Matrix from 'matrix-js-sdk'; import SdkConfig from "./SdkConfig"; diff --git a/src/ScalarMessaging.js b/src/ScalarMessaging.js index c0ffc3022d6..daee7e32963 100644 --- a/src/ScalarMessaging.js +++ b/src/ScalarMessaging.js @@ -232,7 +232,7 @@ Example: } */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import { MatrixEvent } from 'matrix-js-sdk'; import dis from './dispatcher'; import WidgetUtils from './utils/WidgetUtils'; diff --git a/src/Searching.js b/src/Searching.js index f8976c92e4c..a5d945f64b4 100644 --- a/src/Searching.js +++ b/src/Searching.js @@ -15,7 +15,7 @@ limitations under the License. */ import EventIndexPeg from "./indexing/EventIndexPeg"; -import MatrixClientPeg from "./MatrixClientPeg"; +import {MatrixClientPeg} from "./MatrixClientPeg"; function serverSideSearch(term, roomId = undefined) { let filter; diff --git a/src/SlashCommands.js b/src/SlashCommands.js index b9b78666434..c855b42c29d 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import dis from './dispatcher'; import * as sdk from './index'; import {_t, _td} from './languageHandler'; diff --git a/src/Terms.js b/src/Terms.js index f6a48504461..6ae89f9a2c7 100644 --- a/src/Terms.js +++ b/src/Terms.js @@ -16,7 +16,7 @@ limitations under the License. import classNames from 'classnames'; -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import * as sdk from './'; import Modal from './Modal'; diff --git a/src/TextForEvent.js b/src/TextForEvent.js index c3c8396e26d..8a5bddf617f 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import CallHandler from './CallHandler'; import { _t } from './languageHandler'; import * as Roles from './Roles'; diff --git a/src/Unread.js b/src/Unread.js index d5c5993974b..8b859a07feb 100644 --- a/src/Unread.js +++ b/src/Unread.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -const MatrixClientPeg = require('./MatrixClientPeg'); +import {MatrixClientPeg} from "./MatrixClientPeg"; import shouldHideEvent from './shouldHideEvent'; const sdk = require('./index'); diff --git a/src/VectorConferenceHandler.js b/src/VectorConferenceHandler.js index e0e333a3717..0ade4c9daf6 100644 --- a/src/VectorConferenceHandler.js +++ b/src/VectorConferenceHandler.js @@ -16,7 +16,7 @@ limitations under the License. import {createNewMatrixCall, Room} from "matrix-js-sdk"; import CallHandler from './CallHandler'; -import MatrixClientPeg from "./MatrixClientPeg"; +import {MatrixClientPeg} from "./MatrixClientPeg"; // FIXME: this is Riot (Vector) specific code, but will be removed shortly when // we switch over to jitsi entirely for video conferencing. diff --git a/src/WhoIsTyping.js b/src/WhoIsTyping.js index eb09685cbef..8fce6d8311c 100644 --- a/src/WhoIsTyping.js +++ b/src/WhoIsTyping.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from "./MatrixClientPeg"; +import {MatrixClientPeg} from "./MatrixClientPeg"; import { _t } from './languageHandler'; module.exports = { diff --git a/src/WidgetMessaging.js b/src/WidgetMessaging.js index 1d8e1b9cd39..d40a8ab637b 100644 --- a/src/WidgetMessaging.js +++ b/src/WidgetMessaging.js @@ -23,7 +23,7 @@ limitations under the License. import FromWidgetPostMessageApi from './FromWidgetPostMessageApi'; import ToWidgetPostMessageApi from './ToWidgetPostMessageApi'; import Modal from "./Modal"; -import MatrixClientPeg from "./MatrixClientPeg"; +import {MatrixClientPeg} from "./MatrixClientPeg"; import SettingsStore from "./settings/SettingsStore"; import WidgetOpenIDPermissionsDialog from "./components/views/dialogs/WidgetOpenIDPermissionsDialog"; import WidgetUtils from "./utils/WidgetUtils"; diff --git a/src/async-components/views/dialogs/EncryptedEventDialog.js b/src/async-components/views/dialogs/EncryptedEventDialog.js index 145203136aa..64c36962c4a 100644 --- a/src/async-components/views/dialogs/EncryptedEventDialog.js +++ b/src/async-components/views/dialogs/EncryptedEventDialog.js @@ -18,8 +18,9 @@ const React = require("react"); import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; + const sdk = require('../../../index'); -const MatrixClientPeg = require("../../../MatrixClientPeg"); module.exports = createReactClass({ displayName: 'EncryptedEventDialog', diff --git a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js index 3b34c2f7a07..56d3c805496 100644 --- a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js +++ b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js @@ -19,7 +19,7 @@ import React from 'react'; import FileSaver from 'file-saver'; import * as sdk from '../../../../index'; -import MatrixClientPeg from '../../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import { scorePassword } from '../../../../utils/PasswordScorer'; import { _t } from '../../../../languageHandler'; diff --git a/src/async-components/views/dialogs/keybackup/NewRecoveryMethodDialog.js b/src/async-components/views/dialogs/keybackup/NewRecoveryMethodDialog.js index 5382aba23bb..7a7d130dbeb 100644 --- a/src/async-components/views/dialogs/keybackup/NewRecoveryMethodDialog.js +++ b/src/async-components/views/dialogs/keybackup/NewRecoveryMethodDialog.js @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; import PropTypes from "prop-types"; import * as sdk from "../../../../index"; -import MatrixClientPeg from '../../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import dis from "../../../../dispatcher"; import { _t } from "../../../../languageHandler"; import Modal from "../../../../Modal"; diff --git a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js index beb7a221570..df516507191 100644 --- a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js +++ b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import * as sdk from '../../../../index'; -import MatrixClientPeg from '../../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import { scorePassword } from '../../../../utils/PasswordScorer'; import FileSaver from 'file-saver'; import { _t } from '../../../../languageHandler'; diff --git a/src/autocomplete/CommunityProvider.js b/src/autocomplete/CommunityProvider.js index dce1d279ffe..e67c53b3f48 100644 --- a/src/autocomplete/CommunityProvider.js +++ b/src/autocomplete/CommunityProvider.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import { _t } from '../languageHandler'; import AutocompleteProvider from './AutocompleteProvider'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import QueryMatcher from './QueryMatcher'; import {PillCompletion} from './Components'; import * as sdk from '../index'; diff --git a/src/autocomplete/NotifProvider.js b/src/autocomplete/NotifProvider.js index 1fb9da95c93..b433e91b05c 100644 --- a/src/autocomplete/NotifProvider.js +++ b/src/autocomplete/NotifProvider.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import AutocompleteProvider from './AutocompleteProvider'; import { _t } from '../languageHandler'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import {PillCompletion} from './Components'; import * as sdk from '../index'; import type {Completion, SelectionRange} from "./Autocompleter"; diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index 91b4543432c..bb7f8ae0c90 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -20,7 +20,7 @@ limitations under the License. import React from 'react'; import { _t } from '../languageHandler'; import AutocompleteProvider from './AutocompleteProvider'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import QueryMatcher from './QueryMatcher'; import {PillCompletion} from './Components'; import {getDisplayAliasForRoom} from '../Rooms'; diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 3385e13b726..59075b0752c 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -25,7 +25,7 @@ import {PillCompletion} from './Components'; import * as sdk from '../index'; import QueryMatcher from './QueryMatcher'; import _sortBy from 'lodash/sortBy'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import type {MatrixEvent, Room, RoomMember, RoomState} from 'matrix-js-sdk'; import {makeUserPermalink} from "../utils/permalinks/Permalinks"; diff --git a/src/components/structures/EmbeddedPage.js b/src/components/structures/EmbeddedPage.js index 8cc8a9424e3..85ae414a0ab 100644 --- a/src/components/structures/EmbeddedPage.js +++ b/src/components/structures/EmbeddedPage.js @@ -25,7 +25,7 @@ import { _t } from '../../languageHandler'; import sanitizeHtml from 'sanitize-html'; import * as sdk from '../../index'; import dis from '../../dispatcher'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import { MatrixClient } from 'matrix-js-sdk'; import classnames from 'classnames'; diff --git a/src/components/structures/FilePanel.js b/src/components/structures/FilePanel.js index ef60f71ec91..03fd2e187af 100644 --- a/src/components/structures/FilePanel.js +++ b/src/components/structures/FilePanel.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import Matrix from 'matrix-js-sdk'; import * as sdk from '../../index'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import { _t } from '../../languageHandler'; /* diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 07a9fbc521f..f3e87befa33 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -19,7 +19,7 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import * as sdk from '../../index'; import dis from '../../dispatcher'; import { getHostingLink } from '../../utils/HostingLink'; diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 85b794f67f6..2cc30a5b393 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -29,7 +29,7 @@ import { fixupColorFonts } from '../../utils/FontManager'; import * as sdk from '../../index'; import dis from '../../dispatcher'; import sessionStore from '../../stores/SessionStore'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import SettingsStore from "../../settings/SettingsStore"; import RoomListStore from "../../stores/RoomListStore"; import { getHomePageUrl } from '../../utils/pages'; diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 1469324aafd..8dfb3dd74b6 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -29,7 +29,7 @@ import 'what-input'; import Analytics from "../../Analytics"; import { DecryptionFailureTracker } from "../../DecryptionFailureTracker"; -import MatrixClientPeg from "../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../MatrixClientPeg"; import PlatformPeg from "../../PlatformPeg"; import SdkConfig from "../../SdkConfig"; import * as RoomListSorter from "../../RoomListSorter"; diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index 01644d8affa..54b910732a9 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -24,7 +24,7 @@ import shouldHideEvent from '../../shouldHideEvent'; import {wantsDateSeparator} from '../../DateUtils'; import * as sdk from '../../index'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import SettingsStore from '../../settings/SettingsStore'; import {_t} from "../../languageHandler"; diff --git a/src/components/structures/NotificationPanel.js b/src/components/structures/NotificationPanel.js index 470c7c87280..eb46fbe1dc3 100644 --- a/src/components/structures/NotificationPanel.js +++ b/src/components/structures/NotificationPanel.js @@ -18,8 +18,9 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; import { _t } from '../../languageHandler'; +import {MatrixClientPeg} from "../../MatrixClientPeg"; + const sdk = require('../../index'); -const MatrixClientPeg = require("../../MatrixClientPeg"); /* * Component which shows the global notification list using a TimelinePanel diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 4823b0976c4..f88be944d73 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -18,9 +18,9 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; +import {ContentRepo} from "matrix-js-sdk"; +import {MatrixClientPeg} from "../../MatrixClientPeg"; -const MatrixClientPeg = require('../../MatrixClientPeg'); -const ContentRepo = require("matrix-js-sdk").ContentRepo; const Modal = require('../../Modal'); const sdk = require('../../index'); const dis = require('../../dispatcher'); diff --git a/src/components/structures/RoomStatusBar.js b/src/components/structures/RoomStatusBar.js index a10faa199a6..487ccecd310 100644 --- a/src/components/structures/RoomStatusBar.js +++ b/src/components/structures/RoomStatusBar.js @@ -21,7 +21,7 @@ import PropTypes from 'prop-types'; import Matrix from 'matrix-js-sdk'; import { _t, _td } from '../../languageHandler'; import * as sdk from '../../index'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import Resend from '../../Resend'; import * as cryptodevices from '../../cryptodevices'; import dis from '../../dispatcher'; diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index fbbc8b56ba1..198120428b4 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -32,7 +32,7 @@ import {Room} from "matrix-js-sdk"; import { _t } from '../../languageHandler'; import {RoomPermalinkCreator} from '../../utils/permalinks/Permalinks'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import ContentMessages from '../../ContentMessages'; import Modal from '../../Modal'; import * as sdk from '../../index'; diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index d8c2b964243..4763b4104ba 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -29,7 +29,7 @@ const EventTimeline = Matrix.EventTimeline; const sdk = require('../../index'); import { _t } from '../../languageHandler'; -const MatrixClientPeg = require("../../MatrixClientPeg"); +import {MatrixClientPeg} from "../../MatrixClientPeg"; const dis = require("../../dispatcher"); import * as ObjectUtils from "../../ObjectUtils"; const Modal = require("../../Modal"); diff --git a/src/components/structures/TopLeftMenuButton.js b/src/components/structures/TopLeftMenuButton.js index 0d7af81a07d..967805d0996 100644 --- a/src/components/structures/TopLeftMenuButton.js +++ b/src/components/structures/TopLeftMenuButton.js @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {TopLeftMenu} from '../views/context_menus/TopLeftMenu'; import BaseAvatar from '../views/avatars/BaseAvatar'; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import * as Avatar from '../../Avatar'; import { _t } from '../../languageHandler'; import dis from "../../dispatcher"; diff --git a/src/components/structures/UserView.js b/src/components/structures/UserView.js index 57235093f7e..94159a1da47 100644 --- a/src/components/structures/UserView.js +++ b/src/components/structures/UserView.js @@ -18,7 +18,7 @@ limitations under the License. import React from "react"; import PropTypes from "prop-types"; import Matrix from "matrix-js-sdk"; -import MatrixClientPeg from "../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../MatrixClientPeg"; import * as sdk from "../../index"; import Modal from '../../Modal'; import { _t } from '../../languageHandler'; diff --git a/src/components/structures/auth/PostRegistration.js b/src/components/structures/auth/PostRegistration.js index 0395cb8d356..706ab54de44 100644 --- a/src/components/structures/auth/PostRegistration.js +++ b/src/components/structures/auth/PostRegistration.js @@ -18,7 +18,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import AuthPage from "../../views/auth/AuthPage"; diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 20769be4cd3..bcdb1953ba5 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -29,7 +29,7 @@ import * as ServerType from '../../views/auth/ServerTypeSelector'; import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import classNames from "classnames"; import * as Lifecycle from '../../../Lifecycle'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import AuthPage from "../../views/auth/AuthPage"; // Phases diff --git a/src/components/structures/auth/SoftLogout.js b/src/components/structures/auth/SoftLogout.js index bdc34117d01..63f590da2ed 100644 --- a/src/components/structures/auth/SoftLogout.js +++ b/src/components/structures/auth/SoftLogout.js @@ -21,7 +21,7 @@ import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import * as Lifecycle from '../../../Lifecycle'; import Modal from '../../../Modal'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {sendLoginRequest} from "../../../Login"; import url from 'url'; import AuthPage from "../../views/auth/AuthPage"; diff --git a/src/components/views/avatars/GroupAvatar.js b/src/components/views/avatars/GroupAvatar.js index 27122052dd8..0da57bcb990 100644 --- a/src/components/views/avatars/GroupAvatar.js +++ b/src/components/views/avatars/GroupAvatar.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; export default createReactClass({ displayName: 'GroupAvatar', diff --git a/src/components/views/avatars/MemberStatusMessageAvatar.js b/src/components/views/avatars/MemberStatusMessageAvatar.js index ed73dd33b9b..18af80991a8 100644 --- a/src/components/views/avatars/MemberStatusMessageAvatar.js +++ b/src/components/views/avatars/MemberStatusMessageAvatar.js @@ -16,7 +16,7 @@ limitations under the License. import React, {createRef} from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {_t} from "../../../languageHandler"; import MemberAvatar from '../avatars/MemberAvatar'; import classNames from 'classnames'; diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index d1e2ed25bbc..55fe7e07b7e 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -17,7 +17,7 @@ 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 {MatrixClientPeg} from "../../../MatrixClientPeg"; import Modal from '../../../Modal'; import * as sdk from "../../../index"; import * as Avatar from '../../../Avatar'; diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index 876e3b10ace..3aec0e67522 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -22,7 +22,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import {EventStatus} from 'matrix-js-sdk'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import dis from '../../../dispatcher'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/context_menus/RoomTileContextMenu.js b/src/components/views/context_menus/RoomTileContextMenu.js index d9497d729e5..fa4f4f54ba2 100644 --- a/src/components/views/context_menus/RoomTileContextMenu.js +++ b/src/components/views/context_menus/RoomTileContextMenu.js @@ -23,7 +23,7 @@ import createReactClass from 'create-react-class'; import classNames from 'classnames'; import * as sdk from '../../../index'; import { _t, _td } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import dis from '../../../dispatcher'; import DMRoomMap from '../../../utils/DMRoomMap'; import * as Rooms from '../../../Rooms'; diff --git a/src/components/views/context_menus/StatusMessageContextMenu.js b/src/components/views/context_menus/StatusMessageContextMenu.js index e9dd42f1231..c7cf5607a16 100644 --- a/src/components/views/context_menus/StatusMessageContextMenu.js +++ b/src/components/views/context_menus/StatusMessageContextMenu.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import AccessibleButton from '../elements/AccessibleButton'; diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index b9aabdc6089..b75ec7ce36e 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -23,7 +23,7 @@ import LogoutDialog from "../dialogs/LogoutDialog"; import Modal from "../../../Modal"; import SdkConfig from '../../../SdkConfig'; import { getHostingLink } from '../../../utils/HostingLink'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {MenuItem} from "../../structures/ContextMenu"; export class TopLeftMenu extends React.Component { diff --git a/src/components/views/dialogs/AddressPickerDialog.js b/src/components/views/dialogs/AddressPickerDialog.js index a1cdb5d5bb2..d32833b1449 100644 --- a/src/components/views/dialogs/AddressPickerDialog.js +++ b/src/components/views/dialogs/AddressPickerDialog.js @@ -23,7 +23,7 @@ import createReactClass from 'create-react-class'; import { _t, _td } from '../../../languageHandler'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import dis from '../../../dispatcher'; import { addressTypes, getAddressType } from '../../../UserAddress.js'; import GroupStore from '../../../stores/GroupStore'; diff --git a/src/components/views/dialogs/BaseDialog.js b/src/components/views/dialogs/BaseDialog.js index d83ce463607..1a4523ad801 100644 --- a/src/components/views/dialogs/BaseDialog.js +++ b/src/components/views/dialogs/BaseDialog.js @@ -25,7 +25,7 @@ import { MatrixClient } from 'matrix-js-sdk'; import { KeyCode } from '../../../Keyboard'; import AccessibleButton from '../elements/AccessibleButton'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from "../../../languageHandler"; /** diff --git a/src/components/views/dialogs/CreateGroupDialog.js b/src/components/views/dialogs/CreateGroupDialog.js index b88639ba5aa..d465ef26a2e 100644 --- a/src/components/views/dialogs/CreateGroupDialog.js +++ b/src/components/views/dialogs/CreateGroupDialog.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; export default createReactClass({ displayName: 'CreateGroupDialog', diff --git a/src/components/views/dialogs/CreateRoomDialog.js b/src/components/views/dialogs/CreateRoomDialog.js index cdc63b7f88a..41b43af2872 100644 --- a/src/components/views/dialogs/CreateRoomDialog.js +++ b/src/components/views/dialogs/CreateRoomDialog.js @@ -21,7 +21,7 @@ import * as sdk from '../../../index'; import SdkConfig from '../../../SdkConfig'; import withValidation from '../elements/Validation'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {Key} from "../../../Keyboard"; export default createReactClass({ diff --git a/src/components/views/dialogs/DeactivateAccountDialog.js b/src/components/views/dialogs/DeactivateAccountDialog.js index bbf5dbe943e..cd284e3be4f 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.js +++ b/src/components/views/dialogs/DeactivateAccountDialog.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import Analytics from '../../../Analytics'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as Lifecycle from '../../../Lifecycle'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/dialogs/DeviceVerifyDialog.js b/src/components/views/dialogs/DeviceVerifyDialog.js index 8cf5a8536e9..afb623c08b8 100644 --- a/src/components/views/dialogs/DeviceVerifyDialog.js +++ b/src/components/views/dialogs/DeviceVerifyDialog.js @@ -19,7 +19,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import * as FormattingUtils from '../../../utils/FormattingUtils'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/dialogs/DevtoolsDialog.js b/src/components/views/dialogs/DevtoolsDialog.js index dfb15f0e0c0..61002f27a2f 100644 --- a/src/components/views/dialogs/DevtoolsDialog.js +++ b/src/components/views/dialogs/DevtoolsDialog.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import SyntaxHighlight from '../elements/SyntaxHighlight'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import Field from "../elements/Field"; class DevtoolsComponent extends React.Component { diff --git a/src/components/views/dialogs/IncomingSasDialog.js b/src/components/views/dialogs/IncomingSasDialog.js index d0a184f5434..76323b55ad6 100644 --- a/src/components/views/dialogs/IncomingSasDialog.js +++ b/src/components/views/dialogs/IncomingSasDialog.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/dialogs/LogoutDialog.js b/src/components/views/dialogs/LogoutDialog.js index 67d6574084a..64c0b776770 100644 --- a/src/components/views/dialogs/LogoutDialog.js +++ b/src/components/views/dialogs/LogoutDialog.js @@ -19,7 +19,7 @@ import Modal from '../../../Modal'; import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import SettingsStore from "../../../settings/SettingsStore"; export default class LogoutDialog extends React.Component { diff --git a/src/components/views/dialogs/MessageEditHistoryDialog.js b/src/components/views/dialogs/MessageEditHistoryDialog.js index 24c5d3b682a..2bdf2be35cc 100644 --- a/src/components/views/dialogs/MessageEditHistoryDialog.js +++ b/src/components/views/dialogs/MessageEditHistoryDialog.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import { _t } from '../../../languageHandler'; import * as sdk from "../../../index"; import {wantsDateSeparator} from '../../../DateUtils'; diff --git a/src/components/views/dialogs/ReportEventDialog.js b/src/components/views/dialogs/ReportEventDialog.js index dd5afeb4778..3320477557f 100644 --- a/src/components/views/dialogs/ReportEventDialog.js +++ b/src/components/views/dialogs/ReportEventDialog.js @@ -19,7 +19,7 @@ import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import PropTypes from "prop-types"; import {MatrixEvent} from "matrix-js-sdk"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; /* * A dialog for reporting an event. diff --git a/src/components/views/dialogs/RoomSettingsDialog.js b/src/components/views/dialogs/RoomSettingsDialog.js index 06a3f1301b4..67b30e19c80 100644 --- a/src/components/views/dialogs/RoomSettingsDialog.js +++ b/src/components/views/dialogs/RoomSettingsDialog.js @@ -25,7 +25,7 @@ import GeneralRoomSettingsTab from "../settings/tabs/room/GeneralRoomSettingsTab import SecurityRoomSettingsTab from "../settings/tabs/room/SecurityRoomSettingsTab"; import NotificationSettingsTab from "../settings/tabs/room/NotificationSettingsTab"; import * as sdk from "../../../index"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import dis from "../../../dispatcher"; export default class RoomSettingsDialog extends React.Component { diff --git a/src/components/views/dialogs/RoomUpgradeDialog.js b/src/components/views/dialogs/RoomUpgradeDialog.js index d81958c5f0c..dc734718d58 100644 --- a/src/components/views/dialogs/RoomUpgradeDialog.js +++ b/src/components/views/dialogs/RoomUpgradeDialog.js @@ -18,7 +18,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/dialogs/RoomUpgradeWarningDialog.js b/src/components/views/dialogs/RoomUpgradeWarningDialog.js index 1ee1bec9872..02534c5b359 100644 --- a/src/components/views/dialogs/RoomUpgradeWarningDialog.js +++ b/src/components/views/dialogs/RoomUpgradeWarningDialog.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import {_t} from "../../../languageHandler"; import * as sdk from "../../../index"; import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import Modal from "../../../Modal"; export default class RoomUpgradeWarningDialog extends React.Component { diff --git a/src/components/views/dialogs/SetMxIdDialog.js b/src/components/views/dialogs/SetMxIdDialog.js index dffb98443d8..d24715cac0b 100644 --- a/src/components/views/dialogs/SetMxIdDialog.js +++ b/src/components/views/dialogs/SetMxIdDialog.js @@ -19,7 +19,7 @@ import React, {createRef} from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import classnames from 'classnames'; import { KeyCode } from '../../../Keyboard'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/dialogs/UnknownDeviceDialog.js b/src/components/views/dialogs/UnknownDeviceDialog.js index 23e84bbe789..c70383061d0 100644 --- a/src/components/views/dialogs/UnknownDeviceDialog.js +++ b/src/components/views/dialogs/UnknownDeviceDialog.js @@ -19,7 +19,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import SettingsStore from "../../../settings/SettingsStore"; import { markAllDevicesKnown } from '../../../cryptodevices'; diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js index 99dd1184383..e8f98edc7c5 100644 --- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js +++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import * as sdk from '../../../../index'; -import MatrixClientPeg from '../../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import Modal from '../../../../Modal'; import { MatrixClient } from 'matrix-js-sdk'; diff --git a/src/components/views/dialogs/secretstorage/AccessSecretStorageDialog.js b/src/components/views/dialogs/secretstorage/AccessSecretStorageDialog.js index 64bf54ce8aa..c976eb81d0d 100644 --- a/src/components/views/dialogs/secretstorage/AccessSecretStorageDialog.js +++ b/src/components/views/dialogs/secretstorage/AccessSecretStorageDialog.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import PropTypes from "prop-types"; import * as sdk from '../../../../index'; -import MatrixClientPeg from '../../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import { _t } from '../../../../languageHandler'; import { Key } from "../../../../Keyboard"; diff --git a/src/components/views/directory/NetworkDropdown.js b/src/components/views/directory/NetworkDropdown.js index bae1ecd5c99..cb6a015d86b 100644 --- a/src/components/views/directory/NetworkDropdown.js +++ b/src/components/views/directory/NetworkDropdown.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {instanceForInstanceId} from '../../../utils/DirectoryUtils'; const DEFAULT_ICON_URL = require("../../../../res/img/network-matrix.svg"); diff --git a/src/components/views/elements/AddressTile.js b/src/components/views/elements/AddressTile.js index 5ea6ca110c9..36af5059fc4 100644 --- a/src/components/views/elements/AddressTile.js +++ b/src/components/views/elements/AddressTile.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import classNames from 'classnames'; import * as sdk from "../../../index"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import { _t } from '../../../languageHandler'; import { UserAddressType } from '../../../UserAddress.js'; diff --git a/src/components/views/elements/AppPermission.js b/src/components/views/elements/AppPermission.js index e08e008259c..b96001b106d 100644 --- a/src/components/views/elements/AppPermission.js +++ b/src/components/views/elements/AppPermission.js @@ -22,7 +22,7 @@ import url from 'url'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import WidgetUtils from "../../../utils/WidgetUtils"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; export default class AppPermission extends React.Component { static propTypes = { diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 05491cf4d8d..4b586b1553e 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -20,7 +20,7 @@ import url from 'url'; import qs from 'querystring'; import React, {createRef} from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import WidgetMessaging from '../../../WidgetMessaging'; import AccessibleButton from './AccessibleButton'; import Modal from '../../../Modal'; diff --git a/src/components/views/elements/DeviceVerifyButtons.js b/src/components/views/elements/DeviceVerifyButtons.js index 6867406a038..a9dd919a565 100644 --- a/src/components/views/elements/DeviceVerifyButtons.js +++ b/src/components/views/elements/DeviceVerifyButtons.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/elements/ErrorBoundary.js b/src/components/views/elements/ErrorBoundary.js index 12708863e59..a043b350ab0 100644 --- a/src/components/views/elements/ErrorBoundary.js +++ b/src/components/views/elements/ErrorBoundary.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import PlatformPeg from '../../../PlatformPeg'; import Modal from '../../../Modal'; diff --git a/src/components/views/elements/ImageView.js b/src/components/views/elements/ImageView.js index b2f6d0abbbe..d92638e0058 100644 --- a/src/components/views/elements/ImageView.js +++ b/src/components/views/elements/ImageView.js @@ -19,9 +19,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; - -const MatrixClientPeg = require('../../../MatrixClientPeg'); - +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {formatDate} from '../../../DateUtils'; const filesize = require('filesize'); const AccessibleButton = require('../../../components/views/elements/AccessibleButton'); diff --git a/src/components/views/elements/PersistentApp.js b/src/components/views/elements/PersistentApp.js index e0155d846b4..df1a3196d69 100644 --- a/src/components/views/elements/PersistentApp.js +++ b/src/components/views/elements/PersistentApp.js @@ -20,7 +20,7 @@ import RoomViewStore from '../../../stores/RoomViewStore'; import ActiveWidgetStore from '../../../stores/ActiveWidgetStore'; import WidgetUtils from '../../../utils/WidgetUtils'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; module.exports = createReactClass({ displayName: 'PersistentApp', diff --git a/src/components/views/elements/Pill.js b/src/components/views/elements/Pill.js index b8c8f433f29..d2d74347097 100644 --- a/src/components/views/elements/Pill.js +++ b/src/components/views/elements/Pill.js @@ -22,7 +22,7 @@ import dis from '../../../dispatcher'; import classNames from 'classnames'; import { Room, RoomMember, MatrixClient } from 'matrix-js-sdk'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { getDisplayAliasForRoom } from '../../../Rooms'; import FlairStore from "../../../stores/FlairStore"; import {getPrimaryPermalinkEntity} from "../../../utils/permalinks/Permalinks"; diff --git a/src/components/views/elements/RoomAliasField.js b/src/components/views/elements/RoomAliasField.js index 2f3ddcb9296..cacecb50059 100644 --- a/src/components/views/elements/RoomAliasField.js +++ b/src/components/views/elements/RoomAliasField.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import withValidation from './Validation'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; export default class RoomAliasField extends React.PureComponent { static propTypes = { diff --git a/src/components/views/emojipicker/ReactionPicker.js b/src/components/views/emojipicker/ReactionPicker.js index c051ab40bb0..96894e18d23 100644 --- a/src/components/views/emojipicker/ReactionPicker.js +++ b/src/components/views/emojipicker/ReactionPicker.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from "prop-types"; import EmojiPicker from "./EmojiPicker"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; class ReactionPicker extends React.Component { static propTypes = { diff --git a/src/components/views/groups/GroupInviteTile.js b/src/components/views/groups/GroupInviteTile.js index 68020c32281..0c484435a4a 100644 --- a/src/components/views/groups/GroupInviteTile.js +++ b/src/components/views/groups/GroupInviteTile.js @@ -24,7 +24,7 @@ import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import {_t} from '../../../languageHandler'; import classNames from 'classnames'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {ContextMenu, ContextMenuButton, toRightOf} from "../../structures/ContextMenu"; // XXX this class copies a lot from RoomTile.js diff --git a/src/components/views/messages/EditHistoryMessage.js b/src/components/views/messages/EditHistoryMessage.js index d4fc926f03d..a28f8e27d8b 100644 --- a/src/components/views/messages/EditHistoryMessage.js +++ b/src/components/views/messages/EditHistoryMessage.js @@ -23,7 +23,7 @@ import {MatrixEvent} from 'matrix-js-sdk'; import {pillifyLinks} from '../../../utils/pillify'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import Modal from '../../../Modal'; import classNames from 'classnames'; diff --git a/src/components/views/messages/MAudioBody.js b/src/components/views/messages/MAudioBody.js index e10b175bd71..a642936fec2 100644 --- a/src/components/views/messages/MAudioBody.js +++ b/src/components/views/messages/MAudioBody.js @@ -19,7 +19,7 @@ import React from 'react'; import MFileBody from './MFileBody'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { decryptFile } from '../../../utils/DecryptFile'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/messages/MFileBody.js b/src/components/views/messages/MFileBody.js index cc95bae64bc..2177b110a59 100644 --- a/src/components/views/messages/MFileBody.js +++ b/src/components/views/messages/MFileBody.js @@ -19,7 +19,7 @@ import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import filesize from 'filesize'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import {decryptFile} from '../../../utils/DecryptFile'; diff --git a/src/components/views/messages/MKeyVerificationConclusion.js b/src/components/views/messages/MKeyVerificationConclusion.js index 0bd8e2d3d87..f37f270a77c 100644 --- a/src/components/views/messages/MKeyVerificationConclusion.js +++ b/src/components/views/messages/MKeyVerificationConclusion.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import KeyVerificationStateObserver, {getNameForEventRoom, userLabelForEventRoom} from '../../../utils/KeyVerificationStateObserver'; diff --git a/src/components/views/messages/MKeyVerificationRequest.js b/src/components/views/messages/MKeyVerificationRequest.js index ca5b858f2f2..5f0a02e6e8e 100644 --- a/src/components/views/messages/MKeyVerificationRequest.js +++ b/src/components/views/messages/MKeyVerificationRequest.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {verificationMethods} from 'matrix-js-sdk/src/crypto'; import * as sdk from '../../../index'; import Modal from "../../../Modal"; diff --git a/src/components/views/messages/MVideoBody.js b/src/components/views/messages/MVideoBody.js index 8366d0dd01e..dfbe632e1c0 100644 --- a/src/components/views/messages/MVideoBody.js +++ b/src/components/views/messages/MVideoBody.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import MFileBody from './MFileBody'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { decryptFile } from '../../../utils/DecryptFile'; import { _t } from '../../../languageHandler'; import SettingsStore from "../../../settings/SettingsStore"; diff --git a/src/components/views/messages/ReactionsRow.js b/src/components/views/messages/ReactionsRow.js index e8c5563c6b3..3451cdbb2d9 100644 --- a/src/components/views/messages/ReactionsRow.js +++ b/src/components/views/messages/ReactionsRow.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import { isContentActionable } from '../../../utils/EventUtils'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; // The maximum number of reactions to initially show on a message. const MAX_ITEMS_WHEN_LIMITED = 8; diff --git a/src/components/views/messages/ReactionsRowButton.js b/src/components/views/messages/ReactionsRowButton.js index 22714e4fc72..a7ff7dce960 100644 --- a/src/components/views/messages/ReactionsRowButton.js +++ b/src/components/views/messages/ReactionsRowButton.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import { formatCommaSeparatedList } from '../../../utils/FormattingUtils'; diff --git a/src/components/views/messages/ReactionsRowButtonTooltip.js b/src/components/views/messages/ReactionsRowButtonTooltip.js index 2061a9ffc2e..59e9d2ad7fe 100644 --- a/src/components/views/messages/ReactionsRowButtonTooltip.js +++ b/src/components/views/messages/ReactionsRowButtonTooltip.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import { unicodeToShortcode } from '../../../HtmlUtils'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/messages/RoomAvatarEvent.js b/src/components/views/messages/RoomAvatarEvent.js index c72190ad1c1..4ba7083bd2b 100644 --- a/src/components/views/messages/RoomAvatarEvent.js +++ b/src/components/views/messages/RoomAvatarEvent.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; import Modal from '../../../Modal'; diff --git a/src/components/views/messages/RoomCreate.js b/src/components/views/messages/RoomCreate.js index 9bb6fcc0d8a..65539da7852 100644 --- a/src/components/views/messages/RoomCreate.js +++ b/src/components/views/messages/RoomCreate.js @@ -21,7 +21,7 @@ import createReactClass from 'create-react-class'; import dis from '../../../dispatcher'; import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; module.exports = createReactClass({ displayName: 'RoomCreate', diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js index 8201cc67959..dc4accea090 100644 --- a/src/components/views/right_panel/UserInfo.js +++ b/src/components/views/right_panel/UserInfo.js @@ -35,7 +35,7 @@ import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; import RoomViewStore from "../../../stores/RoomViewStore"; import MultiInviter from "../../../utils/MultiInviter"; import GroupStore from "../../../stores/GroupStore"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import E2EIcon from "../rooms/E2EIcon"; import withLegacyMatrixClient from "../../../utils/withLegacyMatrixClient"; import {useEventEmitter} from "../../../hooks/useEventEmitter"; diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index daf5c6edc21..2c43546c60b 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -17,7 +17,7 @@ limitations under the License. const React = require('react'); import PropTypes from 'prop-types'; -const MatrixClientPeg = require('../../../MatrixClientPeg'); +import {MatrixClientPeg} from "../../../MatrixClientPeg"; const sdk = require("../../../index"); import { _t } from '../../../languageHandler'; import Field from "../elements/Field"; diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index 76d2e5be84c..56732d425d3 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -17,7 +17,7 @@ limitations under the License. import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../languageHandler"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import Field from "../elements/Field"; import AccessibleButton from "../elements/AccessibleButton"; import classNames from 'classnames'; diff --git a/src/components/views/room_settings/UrlPreviewSettings.js b/src/components/views/room_settings/UrlPreviewSettings.js index 15a2d6ac63e..7e94ccad095 100644 --- a/src/components/views/room_settings/UrlPreviewSettings.js +++ b/src/components/views/room_settings/UrlPreviewSettings.js @@ -23,7 +23,7 @@ import * as sdk from "../../../index"; import { _t, _td } from '../../../languageHandler'; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; import dis from "../../../dispatcher"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; module.exports = createReactClass({ diff --git a/src/components/views/rooms/AppsDrawer.js b/src/components/views/rooms/AppsDrawer.js index 907d5bca506..d73fb633a08 100644 --- a/src/components/views/rooms/AppsDrawer.js +++ b/src/components/views/rooms/AppsDrawer.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import AppTile from '../elements/AppTile'; import Modal from '../../../Modal'; import dis from '../../../dispatcher'; diff --git a/src/components/views/rooms/AuxPanel.js b/src/components/views/rooms/AuxPanel.js index 7add29af49b..297e64b1527 100644 --- a/src/components/views/rooms/AuxPanel.js +++ b/src/components/views/rooms/AuxPanel.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import * as sdk from '../../../index'; import dis from "../../../dispatcher"; import * as ObjectUtils from '../../../ObjectUtils'; diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index c3e6eb6ccb2..b0a95e11888 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -33,7 +33,7 @@ import dis from '../../../dispatcher'; import SettingsStore from "../../../settings/SettingsStore"; import {EventStatus, MatrixClient} from 'matrix-js-sdk'; import {formatTime} from "../../../DateUtils"; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {ALL_RULE_TYPES} from "../../../mjolnir/BanList"; import * as ObjectUtils from "../../../ObjectUtils"; diff --git a/src/components/views/rooms/LinkPreviewWidget.js b/src/components/views/rooms/LinkPreviewWidget.js index 2e3a3915d00..1f1792f5d08 100644 --- a/src/components/views/rooms/LinkPreviewWidget.js +++ b/src/components/views/rooms/LinkPreviewWidget.js @@ -19,9 +19,9 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import { linkifyElement } from '../../../HtmlUtils'; import SettingsStore from "../../../settings/SettingsStore"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; const sdk = require('../../../index'); -const MatrixClientPeg = require('../../../MatrixClientPeg'); const ImageUtils = require('../../../ImageUtils'); const Modal = require('../../../Modal'); diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index f2656dddc5c..f2e85369c4a 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -47,7 +47,7 @@ import MultiInviter from "../../../utils/MultiInviter"; import SettingsStore from "../../../settings/SettingsStore"; import E2EIcon from "./E2EIcon"; import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {EventTimeline} from "matrix-js-sdk"; module.exports = createReactClass({ diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 05464b43c9c..eecfd6cf96f 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -24,7 +24,7 @@ import dis from '../../../dispatcher'; import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; import {isValid3pidInvite} from "../../../RoomInvite"; import rate_limited_func from "../../../ratelimitedfunc"; -const MatrixClientPeg = require("../../../MatrixClientPeg"); +import {MatrixClientPeg} from "../../../MatrixClientPeg"; const sdk = require('../../../index'); const CallHandler = require("../../../CallHandler"); diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index ae346cbc706..8a92175f77c 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -18,7 +18,7 @@ import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import CallHandler from '../../../CallHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import RoomViewStore from '../../../stores/RoomViewStore'; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c58fe677f55..5767309cc02 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -30,7 +30,7 @@ import PlainWithPillsSerializer from "../../../autocomplete/PlainWithPillsSerial import classNames from 'classnames'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import type {MatrixClient} from 'matrix-js-sdk/src/matrix'; import {processCommandInput} from '../../../SlashCommands'; import { KeyCode, isOnlyCtrlOrCmdKeyEvent } from '../../../Keyboard'; diff --git a/src/components/views/rooms/PinnedEventTile.js b/src/components/views/rooms/PinnedEventTile.js index 1279c010496..d2715c3e632 100644 --- a/src/components/views/rooms/PinnedEventTile.js +++ b/src/components/views/rooms/PinnedEventTile.js @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import dis from "../../../dispatcher"; import AccessibleButton from "../elements/AccessibleButton"; import MessageEvent from "../messages/MessageEvent"; diff --git a/src/components/views/rooms/PinnedEventsPanel.js b/src/components/views/rooms/PinnedEventsPanel.js index dd2febdf399..e06e8f95a00 100644 --- a/src/components/views/rooms/PinnedEventsPanel.js +++ b/src/components/views/rooms/PinnedEventsPanel.js @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import AccessibleButton from "../elements/AccessibleButton"; import PinnedEventTile from "./PinnedEventTile"; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/rooms/RoomBreadcrumbs.js b/src/components/views/rooms/RoomBreadcrumbs.js index 7611ff58ee4..5a15a7518bc 100644 --- a/src/components/views/rooms/RoomBreadcrumbs.js +++ b/src/components/views/rooms/RoomBreadcrumbs.js @@ -16,7 +16,7 @@ limitations under the License. import React, {createRef} from "react"; import dis from "../../../dispatcher"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; import AccessibleButton from '../elements/AccessibleButton'; import RoomAvatar from '../avatars/RoomAvatar'; diff --git a/src/components/views/rooms/RoomDetailRow.js b/src/components/views/rooms/RoomDetailRow.js index b3a8b68b0da..66ec7330618 100644 --- a/src/components/views/rooms/RoomDetailRow.js +++ b/src/components/views/rooms/RoomDetailRow.js @@ -19,7 +19,7 @@ import React, {createRef} from 'react'; import { _t } from '../../../languageHandler'; import { linkifyElement } from '../../../HtmlUtils'; import { ContentRepo } from 'matrix-js-sdk'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index 9b15cffcf56..4c1452a29c0 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -20,7 +20,7 @@ import createReactClass from 'create-react-class'; import classNames from 'classnames'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import Modal from "../../../Modal"; import RateLimitedFunc from '../../../ratelimitedfunc'; diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 210c9394dcb..a9b3849e795 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -23,7 +23,7 @@ import ReactDOM from "react-dom"; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; -const MatrixClientPeg = require("../../../MatrixClientPeg"); +import {MatrixClientPeg} from "../../../MatrixClientPeg"; const CallHandler = require('../../../CallHandler'); const dis = require("../../../dispatcher"); const sdk = require('../../../index'); diff --git a/src/components/views/rooms/RoomNameEditor.js b/src/components/views/rooms/RoomNameEditor.js index 375a4b42b15..94e7e3172b4 100644 --- a/src/components/views/rooms/RoomNameEditor.js +++ b/src/components/views/rooms/RoomNameEditor.js @@ -17,8 +17,8 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; const sdk = require('../../../index'); -const MatrixClientPeg = require('../../../MatrixClientPeg'); import { _t } from '../../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 80b552ea247..04139aa93df 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -20,7 +20,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import dis from '../../../dispatcher'; import classNames from 'classnames'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/rooms/RoomRecoveryReminder.js b/src/components/views/rooms/RoomRecoveryReminder.js index b45dd3a32c6..534d198611a 100644 --- a/src/components/views/rooms/RoomRecoveryReminder.js +++ b/src/components/views/rooms/RoomRecoveryReminder.js @@ -19,7 +19,7 @@ import PropTypes from "prop-types"; import * as sdk from "../../../index"; import { _t } from "../../../languageHandler"; import Modal from "../../../Modal"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; export default class RoomRecoveryReminder extends React.PureComponent { diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 0b8aae9d069..10ed3977275 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -22,7 +22,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import classNames from 'classnames'; import dis from '../../../dispatcher'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import DMRoomMap from '../../../utils/DMRoomMap'; import * as sdk from '../../../index'; import {ContextMenu, ContextMenuButton, toRightOf} from '../../structures/ContextMenu'; diff --git a/src/components/views/rooms/RoomUpgradeWarningBar.js b/src/components/views/rooms/RoomUpgradeWarningBar.js index f7e167b2530..dae5dbfa433 100644 --- a/src/components/views/rooms/RoomUpgradeWarningBar.js +++ b/src/components/views/rooms/RoomUpgradeWarningBar.js @@ -21,7 +21,7 @@ import * as sdk from '../../../index'; import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; module.exports = createReactClass({ displayName: 'RoomUpgradeWarningBar', diff --git a/src/components/views/rooms/SlateMessageComposer.js b/src/components/views/rooms/SlateMessageComposer.js index 77146765652..b1f7adbe321 100644 --- a/src/components/views/rooms/SlateMessageComposer.js +++ b/src/components/views/rooms/SlateMessageComposer.js @@ -18,7 +18,7 @@ import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import { _t, _td } from '../../../languageHandler'; import CallHandler from '../../../CallHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import RoomViewStore from '../../../stores/RoomViewStore'; diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index f1f11138361..67ee0d183cb 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import {_t, _td} from '../../../languageHandler'; import AppTile from '../elements/AppTile'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import * as sdk from '../../../index'; import dis from '../../../dispatcher'; import AccessibleButton from '../elements/AccessibleButton'; diff --git a/src/components/views/rooms/ThirdPartyMemberInfo.js b/src/components/views/rooms/ThirdPartyMemberInfo.js index 991b20f583a..f8d9069ca6b 100644 --- a/src/components/views/rooms/ThirdPartyMemberInfo.js +++ b/src/components/views/rooms/ThirdPartyMemberInfo.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {MatrixEvent} from "matrix-js-sdk"; import {_t} from "../../../languageHandler"; import dis from "../../../dispatcher"; diff --git a/src/components/views/rooms/WhoIsTypingTile.js b/src/components/views/rooms/WhoIsTypingTile.js index 03cc899977d..439ed67e40f 100644 --- a/src/components/views/rooms/WhoIsTypingTile.js +++ b/src/components/views/rooms/WhoIsTypingTile.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import * as WhoIsTyping from '../../../WhoIsTyping'; import Timer from '../../../utils/Timer'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import MemberAvatar from '../avatars/MemberAvatar'; module.exports = createReactClass({ diff --git a/src/components/views/settings/ChangeAvatar.js b/src/components/views/settings/ChangeAvatar.js index 03147bc06cd..7d088d9a40e 100644 --- a/src/components/views/settings/ChangeAvatar.js +++ b/src/components/views/settings/ChangeAvatar.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/settings/ChangeDisplayName.js b/src/components/views/settings/ChangeDisplayName.js index 946fe606e51..846fac6a6c2 100644 --- a/src/components/views/settings/ChangeDisplayName.js +++ b/src/components/views/settings/ChangeDisplayName.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js index a317c46cecb..37a8b1a1dcb 100644 --- a/src/components/views/settings/ChangePassword.js +++ b/src/components/views/settings/ChangePassword.js @@ -20,7 +20,7 @@ import Field from "../elements/Field"; import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -const MatrixClientPeg = require("../../../MatrixClientPeg"); +import {MatrixClientPeg} from "../../../MatrixClientPeg"; const Modal = require("../../../Modal"); const sdk = require("../../../index"); diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index 5c7f7a21fe9..2b191454f6e 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; import { accessSecretStorage } from '../../../CrossSigningManager'; diff --git a/src/components/views/settings/DevicesPanel.js b/src/components/views/settings/DevicesPanel.js index 2da0a969afc..8b76b26cb94 100644 --- a/src/components/views/settings/DevicesPanel.js +++ b/src/components/views/settings/DevicesPanel.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import Modal from '../../../Modal'; diff --git a/src/components/views/settings/DevicesPanelEntry.js b/src/components/views/settings/DevicesPanelEntry.js index 8702f1e553a..9ebce281efa 100644 --- a/src/components/views/settings/DevicesPanelEntry.js +++ b/src/components/views/settings/DevicesPanelEntry.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {formatDate} from '../../../DateUtils'; export default class DevicesPanelEntry extends React.Component { diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js index 3eb9d5ac720..9e55ad3f06b 100644 --- a/src/components/views/settings/KeyBackupPanel.js +++ b/src/components/views/settings/KeyBackupPanel.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import Modal from '../../../Modal'; import SettingsStore from '../../../../src/settings/SettingsStore'; diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 15899c850c9..f3448f7bb56 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -18,7 +18,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import SettingsStore, {SettingLevel} from '../../../settings/SettingsStore'; import Modal from '../../../Modal'; import { diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index a878a8cc3ff..7f7d2c8e8cc 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -16,7 +16,7 @@ limitations under the License. import React, {createRef} from 'react'; import {_t} from "../../../languageHandler"; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import Field from "../elements/Field"; import AccessibleButton from "../elements/AccessibleButton"; import classNames from 'classnames'; diff --git a/src/components/views/settings/SetIdServer.js b/src/components/views/settings/SetIdServer.js index 64a5ce751ca..995959dc90d 100644 --- a/src/components/views/settings/SetIdServer.js +++ b/src/components/views/settings/SetIdServer.js @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../languageHandler"; import * as sdk from '../../../index'; -import MatrixClientPeg from "../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; import Modal from '../../../Modal'; import dis from "../../../dispatcher"; import { getThreepidsWithBindStatus } from '../../../boundThreepids'; diff --git a/src/components/views/settings/account/EmailAddresses.js b/src/components/views/settings/account/EmailAddresses.js index b41fe13805d..5c7f9b24d3f 100644 --- a/src/components/views/settings/account/EmailAddresses.js +++ b/src/components/views/settings/account/EmailAddresses.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../languageHandler"; -import MatrixClientPeg from "../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../MatrixClientPeg"; import Field from "../../elements/Field"; import AccessibleButton from "../../elements/AccessibleButton"; import * as Email from "../../../../email"; diff --git a/src/components/views/settings/account/PhoneNumbers.js b/src/components/views/settings/account/PhoneNumbers.js index 57aa5781b11..a59fd60eca6 100644 --- a/src/components/views/settings/account/PhoneNumbers.js +++ b/src/components/views/settings/account/PhoneNumbers.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../languageHandler"; -import MatrixClientPeg from "../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../MatrixClientPeg"; import Field from "../../elements/Field"; import AccessibleButton from "../../elements/AccessibleButton"; import AddThreepid from "../../../../AddThreepid"; diff --git a/src/components/views/settings/discovery/EmailAddresses.js b/src/components/views/settings/discovery/EmailAddresses.js index 567d2b4374d..afc538bd33d 100644 --- a/src/components/views/settings/discovery/EmailAddresses.js +++ b/src/components/views/settings/discovery/EmailAddresses.js @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { _t } from "../../../../languageHandler"; -import MatrixClientPeg from "../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../MatrixClientPeg"; import * as sdk from '../../../../index'; import Modal from '../../../../Modal'; import AddThreepid from '../../../../AddThreepid'; diff --git a/src/components/views/settings/discovery/PhoneNumbers.js b/src/components/views/settings/discovery/PhoneNumbers.js index 84ad7d61e7c..17fc99458f7 100644 --- a/src/components/views/settings/discovery/PhoneNumbers.js +++ b/src/components/views/settings/discovery/PhoneNumbers.js @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { _t } from "../../../../languageHandler"; -import MatrixClientPeg from "../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../MatrixClientPeg"; import * as sdk from '../../../../index'; import Modal from '../../../../Modal'; import AddThreepid from '../../../../AddThreepid'; diff --git a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js index 4fa3fb8649a..6be868dc407 100644 --- a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../../languageHandler"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import Modal from "../../../../../Modal"; diff --git a/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js b/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js index 4423ef9ecb6..f0ebd2d7fd2 100644 --- a/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../../languageHandler"; import RoomProfileSettings from "../../../room_settings/RoomProfileSettings"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import {MatrixClient} from "matrix-js-sdk"; diff --git a/src/components/views/settings/tabs/room/NotificationSettingsTab.js b/src/components/views/settings/tabs/room/NotificationSettingsTab.js index 448963dacf9..9db27651c0e 100644 --- a/src/components/views/settings/tabs/room/NotificationSettingsTab.js +++ b/src/components/views/settings/tabs/room/NotificationSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../../languageHandler"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import AccessibleButton from "../../../elements/AccessibleButton"; import Notifier from "../../../../../Notifier"; import SettingsStore from '../../../../../settings/SettingsStore'; diff --git a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js index 0c53a13e966..42947d1fb2f 100644 --- a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t, _td} from "../../../../../languageHandler"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import Modal from "../../../../../Modal"; diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js index 6dea081d965..0c66503c436 100644 --- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../../languageHandler"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../.."; import LabelledToggleSwitch from "../../../elements/LabelledToggleSwitch"; import {SettingLevel} from "../../../../../settings/SettingsStore"; diff --git a/src/components/views/settings/tabs/user/FlairUserSettingsTab.js b/src/components/views/settings/tabs/user/FlairUserSettingsTab.js index 0063a9a981a..b5f3849729b 100644 --- a/src/components/views/settings/tabs/user/FlairUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/FlairUserSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import {_t} from "../../../../../languageHandler"; import GroupUserSettings from "../../../groups/GroupUserSettings"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import PropTypes from "prop-types"; import {MatrixClient} from "matrix-js-sdk"; diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index d4182a51d3d..908968b0518 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -29,7 +29,7 @@ import DeactivateAccountDialog from "../../../dialogs/DeactivateAccountDialog"; import PropTypes from "prop-types"; import {enumerateThemes, ThemeWatcher} from "../../../../../theme"; import PlatformPeg from "../../../../../PlatformPeg"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../.."; import Modal from "../../../../../Modal"; import dis from "../../../../../dispatcher"; diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.js b/src/components/views/settings/tabs/user/HelpUserSettingsTab.js index 875f0bfc106..0cf67a4db79 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t, getCurrentLanguage} from "../../../../../languageHandler"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import AccessibleButton from "../../../elements/AccessibleButton"; import SdkConfig from "../../../../../SdkConfig"; import createRoom from "../../../../../createRoom"; diff --git a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js index 608be0b1299..575221c780e 100644 --- a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js @@ -20,7 +20,7 @@ import {Mjolnir} from "../../../../../mjolnir/Mjolnir"; import {ListRule} from "../../../../../mjolnir/ListRule"; import {BanList, RULE_SERVER, RULE_USER} from "../../../../../mjolnir/BanList"; import Modal from "../../../../../Modal"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; const sdk = require("../../../../.."); diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index 8d0ec5bd69a..e816a03e90f 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../../languageHandler"; import SettingsStore, {SettingLevel} from "../../../../../settings/SettingsStore"; -import MatrixClientPeg from "../../../../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as FormattingUtils from "../../../../../utils/FormattingUtils"; import AccessibleButton from "../../../elements/AccessibleButton"; import Analytics from "../../../../../Analytics"; diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js index 18ea5a82be8..d0119ecbbf7 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js @@ -20,9 +20,9 @@ import CallMediaHandler from "../../../../../CallMediaHandler"; import Field from "../../../elements/Field"; import AccessibleButton from "../../../elements/AccessibleButton"; import {SettingLevel} from "../../../../../settings/SettingsStore"; +import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; const Modal = require("../../../../../Modal"); const sdk = require("../../../../.."); -const MatrixClientPeg = require("../../../../../MatrixClientPeg"); export default class VoiceUserSettingsTab extends React.Component { constructor() { diff --git a/src/components/views/toasts/VerificationRequestToast.js b/src/components/views/toasts/VerificationRequestToast.js index abc79c38d0d..f6923025d73 100644 --- a/src/components/views/toasts/VerificationRequestToast.js +++ b/src/components/views/toasts/VerificationRequestToast.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import * as sdk from "../../../index"; import { _t } from '../../../languageHandler'; import Modal from "../../../Modal"; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {verificationMethods} from 'matrix-js-sdk/src/crypto'; import KeyVerificationStateObserver, {userLabelForEventRoom} from "../../../utils/KeyVerificationStateObserver"; import dis from "../../../dispatcher"; diff --git a/src/components/views/voip/CallView.js b/src/components/views/voip/CallView.js index e76fbf397f5..5b3b1984722 100644 --- a/src/components/views/voip/CallView.js +++ b/src/components/views/voip/CallView.js @@ -19,7 +19,7 @@ import createReactClass from 'create-react-class'; import dis from '../../../dispatcher'; import CallHandler from '../../../CallHandler'; import * as sdk from '../../../index'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/voip/IncomingCallBox.js b/src/components/views/voip/IncomingCallBox.js index a7ad7bfdf68..4304cac912a 100644 --- a/src/components/views/voip/IncomingCallBox.js +++ b/src/components/views/voip/IncomingCallBox.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import MatrixClientPeg from '../../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; diff --git a/src/createRoom.js b/src/createRoom.js index e0c4922f484..ac943663ff0 100644 --- a/src/createRoom.js +++ b/src/createRoom.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from './MatrixClientPeg'; +import {MatrixClientPeg} from './MatrixClientPeg'; import Modal from './Modal'; import * as sdk from './index'; import { _t } from './languageHandler'; diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index cf7e2d8da29..c912e31fa59 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -15,7 +15,7 @@ limitations under the License. */ import PlatformPeg from "../PlatformPeg"; -import MatrixClientPeg from "../MatrixClientPeg"; +import {MatrixClientPeg} from "../MatrixClientPeg"; /* * Event indexing class that wraps the platform specific event indexing. diff --git a/src/integrations/IntegrationManagers.js b/src/integrations/IntegrationManagers.js index 8400b3dc947..b482ec73ced 100644 --- a/src/integrations/IntegrationManagers.js +++ b/src/integrations/IntegrationManagers.js @@ -20,7 +20,7 @@ import Modal from '../Modal'; import {IntegrationManagerInstance, KIND_ACCOUNT, KIND_CONFIG, KIND_HOMESERVER} from "./IntegrationManagerInstance"; import type {MatrixClient, MatrixEvent, Room} from "matrix-js-sdk"; import WidgetUtils from "../utils/WidgetUtils"; -import MatrixClientPeg from "../MatrixClientPeg"; +import {MatrixClientPeg} from "../MatrixClientPeg"; import {AutoDiscovery} from "matrix-js-sdk"; import SettingsStore from "../settings/SettingsStore"; diff --git a/src/mjolnir/BanList.js b/src/mjolnir/BanList.js index 60a924a52b3..21cd5d4cf7f 100644 --- a/src/mjolnir/BanList.js +++ b/src/mjolnir/BanList.js @@ -17,7 +17,7 @@ limitations under the License. // Inspiration largely taken from Mjolnir itself import {ListRule, RECOMMENDATION_BAN, recommendationToStable} from "./ListRule"; -import MatrixClientPeg from "../MatrixClientPeg"; +import {MatrixClientPeg} from "../MatrixClientPeg"; export const RULE_USER = "m.room.rule.user"; export const RULE_ROOM = "m.room.rule.room"; diff --git a/src/mjolnir/Mjolnir.js b/src/mjolnir/Mjolnir.js index 7539dfafb06..4970d8e8af6 100644 --- a/src/mjolnir/Mjolnir.js +++ b/src/mjolnir/Mjolnir.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from "../MatrixClientPeg"; +import {MatrixClientPeg} from "../MatrixClientPeg"; import {ALL_RULE_TYPES, BanList} from "./BanList"; import SettingsStore, {SettingLevel} from "../settings/SettingsStore"; import {_t} from "../languageHandler"; diff --git a/src/rageshake/submit-rageshake.js b/src/rageshake/submit-rageshake.js index 457958eb827..019da10d522 100644 --- a/src/rageshake/submit-rageshake.js +++ b/src/rageshake/submit-rageshake.js @@ -18,7 +18,7 @@ limitations under the License. import pako from 'pako'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import PlatformPeg from '../PlatformPeg'; import { _t } from '../languageHandler'; diff --git a/src/settings/controllers/NotificationControllers.js b/src/settings/controllers/NotificationControllers.js index 37d318eb1d7..ada41552062 100644 --- a/src/settings/controllers/NotificationControllers.js +++ b/src/settings/controllers/NotificationControllers.js @@ -15,7 +15,7 @@ limitations under the License. */ import SettingController from "./SettingController"; -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; // XXX: This feels wrong. import {PushProcessor} from "matrix-js-sdk/src/pushprocessor"; diff --git a/src/settings/handlers/AccountSettingsHandler.js b/src/settings/handlers/AccountSettingsHandler.js index 7b05ad0c1ba..fea2e92c62c 100644 --- a/src/settings/handlers/AccountSettingsHandler.js +++ b/src/settings/handlers/AccountSettingsHandler.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import MatrixClientBackedSettingsHandler from "./MatrixClientBackedSettingsHandler"; import {SettingLevel} from "../SettingsStore"; diff --git a/src/settings/handlers/DeviceSettingsHandler.js b/src/settings/handlers/DeviceSettingsHandler.js index ed61e9f3bec..44f89b90862 100644 --- a/src/settings/handlers/DeviceSettingsHandler.js +++ b/src/settings/handlers/DeviceSettingsHandler.js @@ -17,7 +17,7 @@ limitations under the License. */ import SettingsHandler from "./SettingsHandler"; -import MatrixClientPeg from "../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../MatrixClientPeg"; import {SettingLevel} from "../SettingsStore"; /** diff --git a/src/settings/handlers/RoomAccountSettingsHandler.js b/src/settings/handlers/RoomAccountSettingsHandler.js index 0206711db21..1e9d3f7bede 100644 --- a/src/settings/handlers/RoomAccountSettingsHandler.js +++ b/src/settings/handlers/RoomAccountSettingsHandler.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import MatrixClientBackedSettingsHandler from "./MatrixClientBackedSettingsHandler"; import {SettingLevel} from "../SettingsStore"; diff --git a/src/settings/handlers/RoomSettingsHandler.js b/src/settings/handlers/RoomSettingsHandler.js index 79626e21860..64078184506 100644 --- a/src/settings/handlers/RoomSettingsHandler.js +++ b/src/settings/handlers/RoomSettingsHandler.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../../MatrixClientPeg'; +import {MatrixClientPeg} from '../../MatrixClientPeg'; import MatrixClientBackedSettingsHandler from "./MatrixClientBackedSettingsHandler"; import {SettingLevel} from "../SettingsStore"; diff --git a/src/stores/ActiveWidgetStore.js b/src/stores/ActiveWidgetStore.js index 82a7f7932c8..60ea3f91066 100644 --- a/src/stores/ActiveWidgetStore.js +++ b/src/stores/ActiveWidgetStore.js @@ -16,7 +16,7 @@ limitations under the License. import EventEmitter from 'events'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; /** * Stores information about the widgets active in the app right now: diff --git a/src/stores/GroupStore.js b/src/stores/GroupStore.js index 637e87b7282..f691a33e6f8 100644 --- a/src/stores/GroupStore.js +++ b/src/stores/GroupStore.js @@ -17,7 +17,7 @@ limitations under the License. import EventEmitter from 'events'; import { groupMemberFromApiObject, groupRoomFromApiObject } from '../groups'; import FlairStore from './FlairStore'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; function parseMembersResponse(response) { return response.chunk.map((apiMember) => groupMemberFromApiObject(apiMember)); diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index 8b25eba356c..a96174234a0 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -16,7 +16,7 @@ limitations under the License. */ import dis from '../dispatcher'; import {Store} from 'flux/utils'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import * as sdk from '../index'; import Modal from '../Modal'; import { _t } from '../languageHandler'; diff --git a/src/stores/TagOrderStore.js b/src/stores/TagOrderStore.js index 48a88172708..3ca9e395603 100644 --- a/src/stores/TagOrderStore.js +++ b/src/stores/TagOrderStore.js @@ -18,7 +18,7 @@ import dis from '../dispatcher'; import GroupStore from './GroupStore'; import Analytics from '../Analytics'; import * as RoomNotifs from "../RoomNotifs"; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; const INITIAL_STATE = { orderedTags: null, diff --git a/src/stores/TypingStore.js b/src/stores/TypingStore.js index 71ae4f55a31..e86d698eac8 100644 --- a/src/stores/TypingStore.js +++ b/src/stores/TypingStore.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from "../MatrixClientPeg"; +import {MatrixClientPeg} from "../MatrixClientPeg"; import SettingsStore from "../settings/SettingsStore"; import Timer from "../utils/Timer"; diff --git a/src/utils/DMRoomMap.js b/src/utils/DMRoomMap.js index af65b6f0016..de6d42e4a27 100644 --- a/src/utils/DMRoomMap.js +++ b/src/utils/DMRoomMap.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import _uniq from 'lodash/uniq'; /** diff --git a/src/utils/DecryptFile.js b/src/utils/DecryptFile.js index f193bd77092..b87b723ed74 100644 --- a/src/utils/DecryptFile.js +++ b/src/utils/DecryptFile.js @@ -20,7 +20,7 @@ import encrypt from 'browser-encrypt-attachment'; // Pull in a fetch polyfill so we can download encrypted attachments. import 'isomorphic-fetch'; // Grab the client so that we can turn mxc:// URLs into https:// URLS. -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; // WARNING: We have to be very careful about what mime-types we allow into blobs, // as for performance reasons these are now rendered via URL.createObjectURL() diff --git a/src/utils/EventUtils.js b/src/utils/EventUtils.js index 29af5ca9b58..8acf5ae3960 100644 --- a/src/utils/EventUtils.js +++ b/src/utils/EventUtils.js @@ -15,7 +15,7 @@ limitations under the License. */ import { EventStatus } from 'matrix-js-sdk'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import shouldHideEvent from "../shouldHideEvent"; /** * Returns whether an event should allow actions like reply, reactions, edit, etc. diff --git a/src/utils/HostingLink.js b/src/utils/HostingLink.js index ff1ac3d063d..580ed00de5a 100644 --- a/src/utils/HostingLink.js +++ b/src/utils/HostingLink.js @@ -18,7 +18,7 @@ import url from 'url'; import qs from 'qs'; import SdkConfig from '../SdkConfig'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; export function getHostingLink(campaign) { const hostingLink = SdkConfig.get().hosting_signup_link; diff --git a/src/utils/IdentityServerUtils.js b/src/utils/IdentityServerUtils.js index cf180e3026a..093d4eeabf3 100644 --- a/src/utils/IdentityServerUtils.js +++ b/src/utils/IdentityServerUtils.js @@ -16,7 +16,7 @@ limitations under the License. import { SERVICE_TYPES } from 'matrix-js-sdk'; import SdkConfig from '../SdkConfig'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; export function getDefaultIdentityServerUrl() { return SdkConfig.get()['validated_server_config']['isUrl']; diff --git a/src/utils/KeyVerificationStateObserver.js b/src/utils/KeyVerificationStateObserver.js index 2f7c0367ad1..d84a5f584e7 100644 --- a/src/utils/KeyVerificationStateObserver.js +++ b/src/utils/KeyVerificationStateObserver.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import { _t } from '../languageHandler'; const SUB_EVENT_TYPES_OF_INTEREST = ["start", "cancel", "done"]; diff --git a/src/utils/MultiInviter.js b/src/utils/MultiInviter.js index 2ea1da5bcce..7d1c900360c 100644 --- a/src/utils/MultiInviter.js +++ b/src/utils/MultiInviter.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import {getAddressType} from '../UserAddress'; import GroupStore from '../stores/GroupStore'; import {_t} from "../languageHandler"; diff --git a/src/utils/PasswordScorer.js b/src/utils/PasswordScorer.js index 3c366a73f80..9d89942bf54 100644 --- a/src/utils/PasswordScorer.js +++ b/src/utils/PasswordScorer.js @@ -16,7 +16,7 @@ limitations under the License. import zxcvbn from 'zxcvbn'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import { _t, _td } from '../languageHandler'; const ZXCVBN_USER_INPUTS = [ diff --git a/src/utils/WidgetUtils.js b/src/utils/WidgetUtils.js index 9bab78dee49..c09cd8a8582 100644 --- a/src/utils/WidgetUtils.js +++ b/src/utils/WidgetUtils.js @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import SdkConfig from "../SdkConfig"; import dis from '../dispatcher'; import * as url from "url"; diff --git a/src/utils/permalinks/Permalinks.js b/src/utils/permalinks/Permalinks.js index 4b97d1664ff..591cdbb5766 100644 --- a/src/utils/permalinks/Permalinks.js +++ b/src/utils/permalinks/Permalinks.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import MatrixClientPeg from "../../MatrixClientPeg"; +import {MatrixClientPeg} from "../../MatrixClientPeg"; import isIp from "is-ip"; import * as utils from 'matrix-js-sdk/src/utils'; import SpecPermalinkConstructor, {baseUrl as matrixtoBaseUrl} from "./SpecPermalinkConstructor"; diff --git a/src/utils/pillify.js b/src/utils/pillify.js index 044b04181e2..8c2eda5f71c 100644 --- a/src/utils/pillify.js +++ b/src/utils/pillify.js @@ -15,7 +15,7 @@ limitations under the License. */ import ReactDOM from 'react-dom'; -import MatrixClientPeg from '../MatrixClientPeg'; +import {MatrixClientPeg} from '../MatrixClientPeg'; import SettingsStore from "../settings/SettingsStore"; import {PushProcessor} from 'matrix-js-sdk/src/pushprocessor'; import * as sdk from '../index'; diff --git a/test/ScalarAuthClient-test.js b/test/ScalarAuthClient-test.js index 7e944189a69..a3a95c70531 100644 --- a/test/ScalarAuthClient-test.js +++ b/test/ScalarAuthClient-test.js @@ -19,7 +19,7 @@ import expect from 'expect'; import sinon from 'sinon'; import ScalarAuthClient from '../src/ScalarAuthClient'; -import MatrixClientPeg from '../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../src/MatrixClientPeg'; import { stubClient } from './test-utils'; describe('ScalarAuthClient', function() { diff --git a/test/Terms-test.js b/test/Terms-test.js index 3fc7b56e426..6b102a5eda0 100644 --- a/test/Terms-test.js +++ b/test/Terms-test.js @@ -22,7 +22,7 @@ import * as Matrix from 'matrix-js-sdk'; import { startTermsFlow, Service } from '../src/Terms'; import { stubClient } from './test-utils'; -import MatrixClientPeg from '../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../src/MatrixClientPeg'; const POLICY_ONE = { version: "six", diff --git a/test/components/structures/GroupView-test.js b/test/components/structures/GroupView-test.js index b0768d3911c..45b524c4ed5 100644 --- a/test/components/structures/GroupView-test.js +++ b/test/components/structures/GroupView-test.js @@ -20,7 +20,7 @@ import ReactTestUtils from 'react-dom/test-utils'; import expect from 'expect'; import MockHttpBackend from 'matrix-mock-request'; -import MatrixClientPeg from '../../../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../../../src/MatrixClientPeg'; import sdk from 'matrix-react-sdk'; import Matrix from 'matrix-js-sdk'; diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index 7c52512bc2c..60a392047b9 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -29,7 +29,7 @@ import { EventEmitter } from "events"; const sdk = require('matrix-react-sdk'); const MessagePanel = sdk.getComponent('structures.MessagePanel'); -import MatrixClientPeg from '../../../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../../../src/MatrixClientPeg'; import Matrix from 'matrix-js-sdk'; const test_utils = require('test-utils'); diff --git a/test/components/views/dialogs/InteractiveAuthDialog-test.js b/test/components/views/dialogs/InteractiveAuthDialog-test.js index 5f90e0f21c8..850e4e94d55 100644 --- a/test/components/views/dialogs/InteractiveAuthDialog-test.js +++ b/test/components/views/dialogs/InteractiveAuthDialog-test.js @@ -22,7 +22,7 @@ import sinon from 'sinon'; import MatrixReactTestUtils from 'matrix-react-test-utils'; import sdk from 'matrix-react-sdk'; -import MatrixClientPeg from '../../../../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../src/MatrixClientPeg'; import * as test_utils from '../../../test-utils'; import {sleep} from "../../../../src/utils/promise"; diff --git a/test/components/views/groups/GroupMemberList-test.js b/test/components/views/groups/GroupMemberList-test.js index 39226106447..32bf25f5702 100644 --- a/test/components/views/groups/GroupMemberList-test.js +++ b/test/components/views/groups/GroupMemberList-test.js @@ -20,7 +20,7 @@ import ReactTestUtils from "react-dom/test-utils"; import expect from "expect"; import MockHttpBackend from "matrix-mock-request"; -import MatrixClientPeg from "../../../../src/MatrixClientPeg"; +import {MatrixClientPeg} from "../../../../src/MatrixClientPeg"; import sdk from "matrix-react-sdk"; import Matrix from "matrix-js-sdk"; diff --git a/test/components/views/rooms/MemberList-test.js b/test/components/views/rooms/MemberList-test.js index 9a1439c2f7f..635d0753fd2 100644 --- a/test/components/views/rooms/MemberList-test.js +++ b/test/components/views/rooms/MemberList-test.js @@ -7,7 +7,7 @@ import lolex from 'lolex'; import * as TestUtils from 'test-utils'; import sdk from '../../../../src/index'; -import MatrixClientPeg from '../../../../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../src/MatrixClientPeg'; import {Room, RoomMember, User} from 'matrix-js-sdk'; diff --git a/test/components/views/rooms/MessageComposerInput-test.js b/test/components/views/rooms/MessageComposerInput-test.js index 60380eecd23..6adae13181a 100644 --- a/test/components/views/rooms/MessageComposerInput-test.js +++ b/test/components/views/rooms/MessageComposerInput-test.js @@ -6,7 +6,7 @@ import sinon from 'sinon'; import * as testUtils from '../../../test-utils'; import sdk from 'matrix-react-sdk'; const MessageComposerInput = sdk.getComponent('views.rooms.MessageComposerInput'); -import MatrixClientPeg from '../../../../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../src/MatrixClientPeg'; import {sleep} from "../../../../src/utils/promise"; function addTextToDraft(text) { diff --git a/test/components/views/rooms/RoomList-test.js b/test/components/views/rooms/RoomList-test.js index 68168fcf29d..0df968824d9 100644 --- a/test/components/views/rooms/RoomList-test.js +++ b/test/components/views/rooms/RoomList-test.js @@ -7,7 +7,7 @@ import lolex from 'lolex'; import * as TestUtils from 'test-utils'; import sdk from '../../../../src/index'; -import MatrixClientPeg from '../../../../src/MatrixClientPeg'; +import {MatrixClientPeg} from '../../../../src/MatrixClientPeg'; import { DragDropContext } from 'react-beautiful-dnd'; import dis from '../../../../src/dispatcher'; diff --git a/test/components/views/rooms/RoomSettings-test.js b/test/components/views/rooms/RoomSettings-test.js index 1c0bfd95dca..b0ed832c6d2 100644 --- a/test/components/views/rooms/RoomSettings-test.js +++ b/test/components/views/rooms/RoomSettings-test.js @@ -6,7 +6,7 @@ // import * as testUtils from '../../../test-utils'; // import sdk from 'matrix-react-sdk'; // const WrappedRoomSettings = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.rooms.RoomSettings')); -// import MatrixClientPeg from '../../../../src/MatrixClientPeg'; +// import {MatrixClientPeg} from '../../../../src/MatrixClientPeg'; // import SettingsStore from '../../../../src/settings/SettingsStore'; // // From f1ac3d2f646007946d5a8ce440ec630833c6a5f6 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 20 Dec 2019 14:41:07 -0700 Subject: [PATCH 05/15] Convert imports to ES6 from CommonJS This is needed because `require()` means something different in webpack - it ends up importing the module as something we didn't expect (and is occasionally async) --- src/ScalarAuthClient.js | 2 +- src/Unread.js | 2 +- src/Velociraptor.js | 6 +++--- src/VelocityBounce.js | 2 +- src/actions/RoomListActions.js | 1 - .../views/dialogs/EncryptedEventDialog.js | 2 +- .../dialogs/keybackup/CreateKeyBackupDialog.js | 1 - src/autocomplete/CommunityProvider.js | 2 +- src/autocomplete/DuckDuckGoProvider.js | 2 +- src/autocomplete/NotifProvider.js | 2 +- src/autocomplete/RoomProvider.js | 2 +- src/autocomplete/UserProvider.js | 2 +- src/components/structures/InteractiveAuth.js | 4 +--- src/components/structures/MatrixChat.js | 2 +- src/components/structures/NotificationPanel.js | 3 +-- src/components/structures/RoomDirectory.js | 8 +++----- src/components/structures/TimelinePanel.js | 15 ++++++--------- src/components/structures/UploadBar.js | 4 ++-- src/components/views/avatars/MemberAvatar.js | 4 ++-- src/components/views/elements/ImageView.js | 8 ++++---- .../views/room_settings/AliasSettings.js | 6 +++--- src/components/views/rooms/EventTile.js | 9 +++------ src/components/views/rooms/LinkPreviewWidget.js | 7 +++---- src/components/views/rooms/MemberList.js | 4 ++-- src/components/views/rooms/MemberTile.js | 6 ++---- src/components/views/rooms/ReadReceiptMarker.js | 9 +++------ src/components/views/rooms/RoomList.js | 11 +++++------ src/components/views/rooms/RoomNameEditor.js | 2 +- src/components/views/rooms/SearchBar.js | 4 ++-- src/components/views/rooms/UserTile.js | 3 +-- src/components/views/settings/ChangePassword.js | 6 ++---- .../settings/tabs/user/LabsUserSettingsTab.js | 2 +- .../settings/tabs/user/MjolnirUserSettingsTab.js | 3 +-- .../tabs/user/NotificationUserSettingsTab.js | 2 +- .../settings/tabs/user/VoiceUserSettingsTab.js | 4 ++-- src/dispatcher.js | 2 +- src/utils/createMatrixClient.js | 2 +- src/utils/permalinks/Permalinks.js | 3 +-- 38 files changed, 67 insertions(+), 92 deletions(-) diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index 99d6c533a94..819fe3c998b 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -19,7 +19,7 @@ import url from 'url'; import SettingsStore from "./settings/SettingsStore"; import { Service, startTermsFlow, TermsNotSignedError } from './Terms'; import {MatrixClientPeg} from "./MatrixClientPeg"; -const request = require('browser-request'); +import request from "browser-request"; import * as Matrix from 'matrix-js-sdk'; import SdkConfig from "./SdkConfig"; diff --git a/src/Unread.js b/src/Unread.js index 8b859a07feb..6aaa733f204 100644 --- a/src/Unread.js +++ b/src/Unread.js @@ -16,7 +16,7 @@ limitations under the License. import {MatrixClientPeg} from "./MatrixClientPeg"; import shouldHideEvent from './shouldHideEvent'; -const sdk = require('./index'); +import * as sdk from "./index"; module.exports = { /** diff --git a/src/Velociraptor.js b/src/Velociraptor.js index 245ca6648b7..ce52f60dbd5 100644 --- a/src/Velociraptor.js +++ b/src/Velociraptor.js @@ -1,7 +1,7 @@ -const React = require('react'); -const ReactDom = require('react-dom'); +import React from "react"; +import ReactDom from "react-dom"; +import Velocity from "velocity-animate"; import PropTypes from 'prop-types'; -const Velocity = require('velocity-animate'); /** * The Velociraptor contains components and animates transitions with velocity. diff --git a/src/VelocityBounce.js b/src/VelocityBounce.js index db216f81fbe..ffbf7de8296 100644 --- a/src/VelocityBounce.js +++ b/src/VelocityBounce.js @@ -1,4 +1,4 @@ -const Velocity = require('velocity-animate'); +import Velocity from "velocity-animate"; // courtesy of https://github.com/julianshapiro/velocity/issues/283 // We only use easeOutBounce (easeInBounce is just sort of nonsensical) diff --git a/src/actions/RoomListActions.js b/src/actions/RoomListActions.js index 854fa1b367f..d534fe5d1d3 100644 --- a/src/actions/RoomListActions.js +++ b/src/actions/RoomListActions.js @@ -16,7 +16,6 @@ limitations under the License. import { asyncAction } from './actionCreators'; import RoomListStore from '../stores/RoomListStore'; - import Modal from '../Modal'; import * as Rooms from '../Rooms'; import { _t } from '../languageHandler'; diff --git a/src/async-components/views/dialogs/EncryptedEventDialog.js b/src/async-components/views/dialogs/EncryptedEventDialog.js index 64c36962c4a..45cc1549067 100644 --- a/src/async-components/views/dialogs/EncryptedEventDialog.js +++ b/src/async-components/views/dialogs/EncryptedEventDialog.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -const React = require("react"); +import React from "react"; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; diff --git a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js index 56d3c805496..aec9162c973 100644 --- a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js +++ b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js @@ -17,7 +17,6 @@ limitations under the License. import React from 'react'; import FileSaver from 'file-saver'; - import * as sdk from '../../../../index'; import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import { scorePassword } from '../../../../utils/PasswordScorer'; diff --git a/src/autocomplete/CommunityProvider.js b/src/autocomplete/CommunityProvider.js index e67c53b3f48..b863603aaeb 100644 --- a/src/autocomplete/CommunityProvider.js +++ b/src/autocomplete/CommunityProvider.js @@ -46,7 +46,7 @@ export default class CommunityProvider extends AutocompleteProvider { }); } - async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array { + async getCompletions(query: string, selection: SelectionRange, force: boolean = false): Array { const BaseAvatar = sdk.getComponent('views.avatars.BaseAvatar'); // Disable autocompletions when composing commands because of various issues diff --git a/src/autocomplete/DuckDuckGoProvider.js b/src/autocomplete/DuckDuckGoProvider.js index 49ef7dfb43b..ca1b1478cc9 100644 --- a/src/autocomplete/DuckDuckGoProvider.js +++ b/src/autocomplete/DuckDuckGoProvider.js @@ -37,7 +37,7 @@ export default class DuckDuckGoProvider extends AutocompleteProvider { + `&format=json&no_redirect=1&no_html=1&t=${encodeURIComponent(REFERRER)}`; } - async getCompletions(query: string, selection: SelectionRange, force?: boolean = false) { + async getCompletions(query: string, selection: SelectionRange, force: boolean = false) { const {command, range} = this.getCurrentCommand(query, selection); if (!query || !command) { return []; diff --git a/src/autocomplete/NotifProvider.js b/src/autocomplete/NotifProvider.js index b433e91b05c..e7c8f6f70db 100644 --- a/src/autocomplete/NotifProvider.js +++ b/src/autocomplete/NotifProvider.js @@ -30,7 +30,7 @@ export default class NotifProvider extends AutocompleteProvider { this.room = room; } - async getCompletions(query: string, selection: SelectionRange, force?:boolean = false): Array { + async getCompletions(query: string, selection: SelectionRange, force:boolean = false): Array { const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar'); const client = MatrixClientPeg.get(); diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index bb7f8ae0c90..b28c79ac54d 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -48,7 +48,7 @@ export default class RoomProvider extends AutocompleteProvider { }); } - async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array { + async getCompletions(query: string, selection: SelectionRange, force: boolean = false): Array { const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar'); const client = MatrixClientPeg.get(); diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 59075b0752c..7fd600b1366 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -91,7 +91,7 @@ export default class UserProvider extends AutocompleteProvider { this.users = null; } - async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array { + async getCompletions(query: string, selection: SelectionRange, force: boolean = false): Array { const MemberAvatar = sdk.getComponent('views.avatars.MemberAvatar'); // lazy-load user list into matcher diff --git a/src/components/structures/InteractiveAuth.js b/src/components/structures/InteractiveAuth.js index e7194e9fa43..53bb990e260 100644 --- a/src/components/structures/InteractiveAuth.js +++ b/src/components/structures/InteractiveAuth.js @@ -15,9 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Matrix from 'matrix-js-sdk'; -const InteractiveAuth = Matrix.InteractiveAuth; - +import {InteractiveAuth} from "matrix-js-sdk"; import React, {createRef} from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 8dfb3dd74b6..0713290a26e 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -20,7 +20,7 @@ limitations under the License. import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; -import Matrix from "matrix-js-sdk"; +import * as Matrix from "matrix-js-sdk"; // focus-visible is a Polyfill for the :focus-visible CSS pseudo-attribute used by _AccessibleButton.scss import 'focus-visible'; diff --git a/src/components/structures/NotificationPanel.js b/src/components/structures/NotificationPanel.js index eb46fbe1dc3..70ea24ad17d 100644 --- a/src/components/structures/NotificationPanel.js +++ b/src/components/structures/NotificationPanel.js @@ -19,8 +19,7 @@ import React from 'react'; import createReactClass from 'create-react-class'; import { _t } from '../../languageHandler'; import {MatrixClientPeg} from "../../MatrixClientPeg"; - -const sdk = require('../../index'); +import * as sdk from "../../index"; /* * Component which shows the global notification list using a TimelinePanel diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index f88be944d73..94a6d04b556 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -20,11 +20,9 @@ import React from 'react'; import createReactClass from 'create-react-class'; import {ContentRepo} from "matrix-js-sdk"; import {MatrixClientPeg} from "../../MatrixClientPeg"; - -const Modal = require('../../Modal'); -const sdk = require('../../index'); -const dis = require('../../dispatcher'); - +import * as sdk from "../../index"; +import dis from "../../dispatcher"; +import Modal from "../../Modal"; import { linkifyAndSanitizeHtml } from '../../HtmlUtils'; import PropTypes from 'prop-types'; import { _t } from '../../languageHandler'; diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 4763b4104ba..3996b74922b 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -18,22 +18,19 @@ limitations under the License. */ import SettingsStore from "../../settings/SettingsStore"; - import React, {createRef} from 'react'; import createReactClass from 'create-react-class'; import ReactDOM from "react-dom"; import PropTypes from 'prop-types'; - -const Matrix = require("matrix-js-sdk"); -const EventTimeline = Matrix.EventTimeline; - -const sdk = require('../../index'); +import {EventTimeline} from "matrix-js-sdk"; +import * as Matrix from "matrix-js-sdk"; import { _t } from '../../languageHandler'; import {MatrixClientPeg} from "../../MatrixClientPeg"; -const dis = require("../../dispatcher"); import * as ObjectUtils from "../../ObjectUtils"; -const Modal = require("../../Modal"); -const UserActivity = require("../../UserActivity"); +import UserActivity from "../../UserActivity"; +import Modal from "../../Modal"; +import dis from "../../dispatcher"; +import * as sdk from "../../index"; import { KeyCode } from '../../Keyboard'; import Timer from '../../utils/Timer'; import shouldHideEvent from '../../shouldHideEvent'; diff --git a/src/components/structures/UploadBar.js b/src/components/structures/UploadBar.js index da0ca7fe99f..adaf8824fcb 100644 --- a/src/components/structures/UploadBar.js +++ b/src/components/structures/UploadBar.js @@ -18,8 +18,8 @@ import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import ContentMessages from '../../ContentMessages'; -const dis = require('../../dispatcher'); -const filesize = require('filesize'); +import dis from "../../dispatcher"; +import filesize from "filesize"; import { _t } from '../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/avatars/MemberAvatar.js b/src/components/views/avatars/MemberAvatar.js index cb9ef701684..6961a00d6dd 100644 --- a/src/components/views/avatars/MemberAvatar.js +++ b/src/components/views/avatars/MemberAvatar.js @@ -18,8 +18,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import * as Avatar from '../../../Avatar'; -const sdk = require("../../../index"); -const dispatcher = require("../../../dispatcher"); +import * as sdk from "../../../index"; +import dis from "../../../dispatcher"; module.exports = createReactClass({ displayName: 'MemberAvatar', diff --git a/src/components/views/elements/ImageView.js b/src/components/views/elements/ImageView.js index d92638e0058..e12a15766ee 100644 --- a/src/components/views/elements/ImageView.js +++ b/src/components/views/elements/ImageView.js @@ -21,11 +21,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {formatDate} from '../../../DateUtils'; -const filesize = require('filesize'); -const AccessibleButton = require('../../../components/views/elements/AccessibleButton'); -const Modal = require('../../../Modal'); -const sdk = require('../../../index'); import { _t } from '../../../languageHandler'; +import filesize from "filesize"; +import AccessibleButton from "./AccessibleButton"; +import Modal from "../../../Modal"; +import * as sdk from "../../../index"; export default class ImageView extends React.Component { static propTypes = { diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index 2c43546c60b..b0d291ac108 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -15,14 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -const React = require('react'); +import React from "react"; import PropTypes from 'prop-types'; import {MatrixClientPeg} from "../../../MatrixClientPeg"; -const sdk = require("../../../index"); +import * as sdk from "../../../index"; import { _t } from '../../../languageHandler'; import Field from "../elements/Field"; import ErrorDialog from "../dialogs/ErrorDialog"; -const Modal = require("../../../Modal"); +import Modal from "../../../Modal"; export default class AliasSettings extends React.Component { static propTypes = { diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index b0a95e11888..de3af779462 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -18,17 +18,14 @@ limitations under the License. */ import ReplyThread from "../elements/ReplyThread"; - import React, {createRef} from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -const classNames = require("classnames"); +import classNames from "classnames"; import { _t, _td } from '../../../languageHandler'; import * as TextForEvent from "../../../TextForEvent"; -const Modal = require('../../../Modal'); - -const sdk = require('../../../index'); - +import Modal from "../../../Modal"; +import * as sdk from "../../../index"; import dis from '../../../dispatcher'; import SettingsStore from "../../../settings/SettingsStore"; import {EventStatus, MatrixClient} from 'matrix-js-sdk'; diff --git a/src/components/views/rooms/LinkPreviewWidget.js b/src/components/views/rooms/LinkPreviewWidget.js index 1f1792f5d08..f0b51ff299d 100644 --- a/src/components/views/rooms/LinkPreviewWidget.js +++ b/src/components/views/rooms/LinkPreviewWidget.js @@ -20,10 +20,9 @@ import createReactClass from 'create-react-class'; import { linkifyElement } from '../../../HtmlUtils'; import SettingsStore from "../../../settings/SettingsStore"; import {MatrixClientPeg} from "../../../MatrixClientPeg"; - -const sdk = require('../../../index'); -const ImageUtils = require('../../../ImageUtils'); -const Modal = require('../../../Modal'); +import * as sdk from "../../../index"; +import Modal from "../../../Modal"; +import * as ImageUtils from "../../../ImageUtils"; module.exports = createReactClass({ displayName: 'LinkPreviewWidget', diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index eecfd6cf96f..7d47bdb4b8c 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -25,8 +25,8 @@ import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; import {isValid3pidInvite} from "../../../RoomInvite"; import rate_limited_func from "../../../ratelimitedfunc"; import {MatrixClientPeg} from "../../../MatrixClientPeg"; -const sdk = require('../../../index'); -const CallHandler = require("../../../CallHandler"); +import * as sdk from "../../../index"; +import CallHandler from "../../../CallHandler"; const INITIAL_LOAD_NUM_MEMBERS = 30; const INITIAL_LOAD_NUM_INVITED = 5; diff --git a/src/components/views/rooms/MemberTile.js b/src/components/views/rooms/MemberTile.js index c002849450f..c992b9d4f3a 100644 --- a/src/components/views/rooms/MemberTile.js +++ b/src/components/views/rooms/MemberTile.js @@ -15,13 +15,11 @@ limitations under the License. */ import SettingsStore from "../../../settings/SettingsStore"; - import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; - -const sdk = require('../../../index'); -const dis = require('../../../dispatcher'); +import * as sdk from "../../../index"; +import dis from "../../../dispatcher"; import { _t } from '../../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/rooms/ReadReceiptMarker.js b/src/components/views/rooms/ReadReceiptMarker.js index 27c5e8c20ea..d8ce58342a6 100644 --- a/src/components/views/rooms/ReadReceiptMarker.js +++ b/src/components/views/rooms/ReadReceiptMarker.js @@ -18,14 +18,11 @@ import React from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; - -const sdk = require('../../../index'); - -const Velociraptor = require('../../../Velociraptor'); -require('../../../VelocityBounce'); +import('../../../VelocityBounce'); import { _t } from '../../../languageHandler'; - import {formatDate} from '../../../DateUtils'; +import Velociraptor from "../../../Velociraptor"; +import * as sdk from "../../../index"; let bounce = false; try { diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index a9b3849e795..ab15ab5a836 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -17,29 +17,28 @@ limitations under the License. import SettingsStore from "../../../settings/SettingsStore"; import Timer from "../../../utils/Timer"; - import React from "react"; import ReactDOM from "react-dom"; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import {MatrixClientPeg} from "../../../MatrixClientPeg"; -const CallHandler = require('../../../CallHandler'); -const dis = require("../../../dispatcher"); -const sdk = require('../../../index'); import rate_limited_func from "../../../ratelimitedfunc"; import * as Rooms from '../../../Rooms'; import DMRoomMap from '../../../utils/DMRoomMap'; -const Receipt = require('../../../utils/Receipt'); import TagOrderStore from '../../../stores/TagOrderStore'; import RoomListStore from '../../../stores/RoomListStore'; import CustomRoomTagStore from '../../../stores/CustomRoomTagStore'; import GroupStore from '../../../stores/GroupStore'; import RoomSubList from '../../structures/RoomSubList'; import ResizeHandle from '../elements/ResizeHandle'; - +import CallHandler from "../../../CallHandler"; +import dis from "../../../dispatcher"; +import * as sdk from "../../../index"; +import * as Receipt from "../../../utils/Receipt"; import {Resizer} from '../../../resizer'; import {Layout, Distributor} from '../../../resizer/distributors/roomsublist2'; + const HIDE_CONFERENCE_CHANS = true; const STANDARD_TAGS_REGEX = /^(m\.(favourite|lowpriority|server_notice)|im\.vector\.fake\.(invite|recent|direct|archived))$/; const HOVER_MOVE_TIMEOUT = 1000; diff --git a/src/components/views/rooms/RoomNameEditor.js b/src/components/views/rooms/RoomNameEditor.js index 94e7e3172b4..0789da27249 100644 --- a/src/components/views/rooms/RoomNameEditor.js +++ b/src/components/views/rooms/RoomNameEditor.js @@ -18,7 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import {MatrixClientPeg} from "../../../MatrixClientPeg"; -const sdk = require('../../../index'); +import * as sdk from "../../../index"; import { _t } from '../../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/rooms/SearchBar.js b/src/components/views/rooms/SearchBar.js index 492c29a6217..c9a9308544c 100644 --- a/src/components/views/rooms/SearchBar.js +++ b/src/components/views/rooms/SearchBar.js @@ -16,8 +16,8 @@ limitations under the License. import React, {createRef} from 'react'; import createReactClass from 'create-react-class'; -const classNames = require('classnames'); -const AccessibleButton = require('../../../components/views/elements/AccessibleButton'); +import AccessibleButton from "../elements/AccessibleButton"; +import classNames from "classnames"; import { _t } from '../../../languageHandler'; module.exports = createReactClass({ diff --git a/src/components/views/rooms/UserTile.js b/src/components/views/rooms/UserTile.js index 006bd81c984..9fea1a3ad26 100644 --- a/src/components/views/rooms/UserTile.js +++ b/src/components/views/rooms/UserTile.js @@ -18,8 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import * as Avatar from '../../../Avatar'; - -const sdk = require('../../../index'); +import * as sdk from "../../../index"; module.exports = createReactClass({ displayName: 'UserTile', diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js index 37a8b1a1dcb..dc41e5e2c83 100644 --- a/src/components/views/settings/ChangePassword.js +++ b/src/components/views/settings/ChangePassword.js @@ -16,17 +16,15 @@ limitations under the License. */ import Field from "../elements/Field"; - import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import {MatrixClientPeg} from "../../../MatrixClientPeg"; -const Modal = require("../../../Modal"); -const sdk = require("../../../index"); - import dis from "../../../dispatcher"; import AccessibleButton from '../elements/AccessibleButton'; import { _t } from '../../../languageHandler'; +import * as sdk from "../../../index"; +import Modal from "../../../Modal"; import sessionStore from '../../../stores/SessionStore'; diff --git a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js index 5f7d75c5c37..ec5f984d46d 100644 --- a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js @@ -19,7 +19,7 @@ import {_t} from "../../../../../languageHandler"; import PropTypes from "prop-types"; import SettingsStore, {SettingLevel} from "../../../../../settings/SettingsStore"; import LabelledToggleSwitch from "../../../elements/LabelledToggleSwitch"; -const sdk = require("../../../../.."); +import * as sdk from "../../../../../index"; export class LabsSettingToggle extends React.Component { static propTypes = { diff --git a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js index 575221c780e..7f3a2c401d7 100644 --- a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js @@ -21,8 +21,7 @@ import {ListRule} from "../../../../../mjolnir/ListRule"; import {BanList, RULE_SERVER, RULE_USER} from "../../../../../mjolnir/BanList"; import Modal from "../../../../../Modal"; import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; - -const sdk = require("../../../../.."); +import * as sdk from "../../../../../index"; export default class MjolnirUserSettingsTab extends React.Component { constructor() { diff --git a/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js b/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js index 970659af6ed..2e649cb7f8e 100644 --- a/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import {_t} from "../../../../../languageHandler"; -const sdk = require("../../../../.."); +import * as sdk from "../../../../../index"; export default class NotificationUserSettingsTab extends React.Component { constructor() { diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js index d0119ecbbf7..f4fbcada3a3 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js @@ -21,8 +21,8 @@ import Field from "../../../elements/Field"; import AccessibleButton from "../../../elements/AccessibleButton"; import {SettingLevel} from "../../../../../settings/SettingsStore"; import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; -const Modal = require("../../../../../Modal"); -const sdk = require("../../../../.."); +import * as sdk from "../../../../../index"; +import Modal from "../../../../../Modal"; export default class VoiceUserSettingsTab extends React.Component { constructor() { diff --git a/src/dispatcher.js b/src/dispatcher.js index 48c8dc86e94..5abdb296042 100644 --- a/src/dispatcher.js +++ b/src/dispatcher.js @@ -17,7 +17,7 @@ limitations under the License. 'use strict'; -const flux = require("flux"); +import flux from "flux"; class MatrixDispatcher extends flux.Dispatcher { /** diff --git a/src/utils/createMatrixClient.js b/src/utils/createMatrixClient.js index dee93244606..c8ff35a584d 100644 --- a/src/utils/createMatrixClient.js +++ b/src/utils/createMatrixClient.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Matrix from 'matrix-js-sdk'; +import * as Matrix from 'matrix-js-sdk'; const localStorage = window.localStorage; diff --git a/src/utils/permalinks/Permalinks.js b/src/utils/permalinks/Permalinks.js index 591cdbb5766..1174e59da69 100644 --- a/src/utils/permalinks/Permalinks.js +++ b/src/utils/permalinks/Permalinks.js @@ -21,8 +21,7 @@ import SpecPermalinkConstructor, {baseUrl as matrixtoBaseUrl} from "./SpecPermal import PermalinkConstructor, {PermalinkParts} from "./PermalinkConstructor"; import RiotPermalinkConstructor from "./RiotPermalinkConstructor"; import matrixLinkify from "../../linkify-matrix"; - -const SdkConfig = require("../../SdkConfig"); +import SdkConfig from "../../SdkConfig"; // The maximum number of servers to pick when working out which servers // to add to permalinks. The servers are appended as ?via=example.org From 0d2cb6e73150b1a9255cff1d7ddda34fb900320e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 20 Dec 2019 14:43:06 -0700 Subject: [PATCH 06/15] 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 d199991dc56..f82c0899b56 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 54b910732a9..4ad75eb7009 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 1cb9e7db5ef..d3309a1f43c 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 54539b63fb5..06be5af41cc 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 bf34a56de3f..57856a3a5b9 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( Date: Sun, 22 Dec 2019 19:47:10 -0700 Subject: [PATCH 07/15] Fix tabbed view export for component index --- src/components/structures/TabbedView.js | 2 +- src/components/views/dialogs/RoomSettingsDialog.js | 2 +- src/components/views/dialogs/UserSettingsDialog.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/TabbedView.js b/src/components/structures/TabbedView.js index ae5f9e3ee10..20af183af88 100644 --- a/src/components/structures/TabbedView.js +++ b/src/components/structures/TabbedView.js @@ -38,7 +38,7 @@ export class Tab { } } -export class TabbedView extends React.Component { +export default class TabbedView extends React.Component { static propTypes = { // The tabs to show tabs: PropTypes.arrayOf(PropTypes.instanceOf(Tab)).isRequired, diff --git a/src/components/views/dialogs/RoomSettingsDialog.js b/src/components/views/dialogs/RoomSettingsDialog.js index 67b30e19c80..2f01204c847 100644 --- a/src/components/views/dialogs/RoomSettingsDialog.js +++ b/src/components/views/dialogs/RoomSettingsDialog.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import {Tab, TabbedView} from "../../structures/TabbedView"; +import TabbedView, {Tab} from "../../structures/TabbedView"; import {_t, _td} from "../../../languageHandler"; import AdvancedRoomSettingsTab from "../settings/tabs/room/AdvancedRoomSettingsTab"; import RolesRoomSettingsTab from "../settings/tabs/room/RolesRoomSettingsTab"; diff --git a/src/components/views/dialogs/UserSettingsDialog.js b/src/components/views/dialogs/UserSettingsDialog.js index a3f586cdea8..b135d5f5f64 100644 --- a/src/components/views/dialogs/UserSettingsDialog.js +++ b/src/components/views/dialogs/UserSettingsDialog.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -import {Tab, TabbedView} from "../../structures/TabbedView"; +import TabbedView, {Tab} from "../../structures/TabbedView"; import {_t, _td} from "../../../languageHandler"; import GeneralUserSettingsTab from "../settings/tabs/user/GeneralUserSettingsTab"; import SettingsStore from "../../../settings/SettingsStore"; From 18ac2db2ea5c44de4153efbf133b8085ba613075 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 20 Dec 2019 14:47:49 -0700 Subject: [PATCH 08/15] Fix Notifier imports in NotificationControllers require() is a bit weird for riot-web's webpack, so we fork it out to its own function to reduce the weirdness. The added weirdness is that require() is sync though exports a module instead. If we use import(), we get a promise which doesn't help us here. We therefore have to require() and pull out the default export, though this is only a problem for webpack - babel (our chosen compiler for exporting ES6) doesn't need this, hence the if statement. --- .../controllers/NotificationControllers.js | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/settings/controllers/NotificationControllers.js b/src/settings/controllers/NotificationControllers.js index ada41552062..395da765a1d 100644 --- a/src/settings/controllers/NotificationControllers.js +++ b/src/settings/controllers/NotificationControllers.js @@ -34,10 +34,15 @@ function isMasterRuleEnabled() { return !masterRule.enabled; } +function getNotifier() { + let Notifier = require('../../Notifier'); // avoids cyclical references + if (Notifier.default) Notifier = Notifier.default; // correct for webpack require() weirdness + return Notifier; +} + export class NotificationsEnabledController extends SettingController { getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) { - const Notifier = require('../../Notifier'); // avoids cyclical references - if (!Notifier.isPossible()) return false; + if (!getNotifier().isPossible()) return false; if (calculatedValue === null || calculatedAtLevel === "default") { return isMasterRuleEnabled(); @@ -47,18 +52,15 @@ export class NotificationsEnabledController extends SettingController { } onChange(level, roomId, newValue) { - const Notifier = require('../../Notifier'); // avoids cyclical references - - if (Notifier.supportsDesktopNotifications()) { - Notifier.setEnabled(newValue); + if (getNotifier().supportsDesktopNotifications()) { + getNotifier().setEnabled(newValue); } } } export class NotificationBodyEnabledController extends SettingController { getValueOverride(level, roomId, calculatedValue) { - const Notifier = require('../../Notifier'); // avoids cyclical references - if (!Notifier.isPossible()) return false; + if (!getNotifier().isPossible()) return false; if (calculatedValue === null) { return isMasterRuleEnabled(); @@ -70,8 +72,7 @@ export class NotificationBodyEnabledController extends SettingController { export class AudioNotificationsEnabledController extends SettingController { getValueOverride(level, roomId, calculatedValue) { - const Notifier = require('../../Notifier'); // avoids cyclical references - if (!Notifier.isPossible()) return false; + if (!getNotifier().isPossible()) return false; // Note: Audio notifications are *not* enabled by default. return calculatedValue; From 539a33c722997b22e1dbfe95eb98eaae1b45a81d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 19 Dec 2019 18:02:36 -0700 Subject: [PATCH 09/15] Fix naming conflict in VectorConferenceHandler --- src/VectorConferenceHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VectorConferenceHandler.js b/src/VectorConferenceHandler.js index d0120136e1a..180dad876bb 100644 --- a/src/VectorConferenceHandler.js +++ b/src/VectorConferenceHandler.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {createNewMatrixCall, Room} from "matrix-js-sdk"; +import {createNewMatrixCall as jsCreateNewMatrixCall, Room} from "matrix-js-sdk"; import CallHandler from './CallHandler'; import {MatrixClientPeg} from "./MatrixClientPeg"; @@ -43,7 +43,7 @@ ConferenceCall.prototype.setup = function() { // return a call for *this* room to be placed. We also tack on // confUserId to speed up lookups (else we'd need to loop every room // looking for a 1:1 room with this conf user ID!) - const call = createNewMatrixCall(self.client, room.roomId); + const call = jsCreateNewMatrixCall(self.client, room.roomId); call.confUserId = self.confUserId; call.groupRoomId = self.groupRoomId; return call; From d8da634c8b811a9cde47f44dc74fa0ffc2f0701e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 19 Dec 2019 18:01:43 -0700 Subject: [PATCH 10/15] Cosmetic updates to package.json --- package.json | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 99e4983d604..2899d9fdb77 100644 --- a/package.json +++ b/package.json @@ -9,27 +9,25 @@ }, "license": "Apache-2.0", "files": [ + "lib", + "res", + "src", + "scripts", + "git-revision.txt", + "header", "CHANGELOG.md", "CONTRIBUTING.rst", "LICENSE", "README.md", - "code_style.md", - "git-revision.txt", - "header", - "lib", - "package.json", - "scripts", - "docs", - "src", - "res" + "package.json" ], "bin": { "reskindex": "scripts/reskindex.js", "matrix-gen-i18n": "scripts/gen-i18n.js", "matrix-prune-i18n": "scripts/prune-i18n.js" }, - "main": "lib/index.js", - "typings": "lib/index.d.ts", + "main": "./lib/index.js", + "typings": "./lib/index.d.ts", "scripts": { "i18n": "matrix-gen-i18n", "prunei18n": "matrix-prune-i18n", @@ -40,7 +38,7 @@ "rethemendex": "res/css/rethemendex.sh", "clean": "rimraf lib", "build": "yarn clean && git rev-parse HEAD > git-revision.txt && yarn build:compile && yarn build:types", - "build:compile": "yarn reskindex && babel src -s -d lib --verbose --extensions \".ts,.js\"", + "build:compile": "yarn reskindex && babel -d lib --verbose --extensions \".ts,.js\" src", "build:types": "tsc --emitDeclarationOnly", "start": "echo THIS IS FOR LEGACY PURPOSES ONLY. && yarn start:all", "start:all": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n build,reskindex \"yarn start:build\" \"yarn reskindex:watch\"", From 69424f4b4286fb2d6e6358d6aebe7c9e20639500 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 19 Dec 2019 19:08:18 -0700 Subject: [PATCH 11/15] Add package.json fields for riot-web's webpack See https://github.com/vector-im/riot-web/commit/a1c9551bc8a1a6d61afed7e87ff7cebb3042a5ac --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 2899d9fdb77..3104ab1ac46 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ }, "main": "./lib/index.js", "typings": "./lib/index.d.ts", + "matrix_src_main": "./src/index.js", "scripts": { "i18n": "matrix-gen-i18n", "prunei18n": "matrix-prune-i18n", From 3eb3be45d18e6292c7bbddcae8cb1942d3a7b8a4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 20 Dec 2019 13:58:46 -0700 Subject: [PATCH 12/15] Fix import of language index This is a similar fix to https://github.com/matrix-org/matrix-react-sdk/pull/3766/commits/18ac2db2ea5c44de4153efbf133b8085ba613075 --- src/languageHandler.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/languageHandler.js b/src/languageHandler.js index c56e5378df5..4aa22f3e651 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -410,11 +410,12 @@ export function pickBestLanguage(langs) { } function getLangsJson() { - return new Promise((resolve, reject) => { + return new Promise(async (resolve, reject) => { let url; try { // $webapp is a webpack resolve alias pointing to the output directory, see webpack config - url = require('$webapp/i18n/languages.json'); + url = import('$webapp/i18n/languages.json'); + if (url.then) url = (await url).default; // webpack resolves to a Module through a promise. } catch (e) { url = i18nFolder + 'languages.json'; } From 9edc361afc283961be02abc7b139a66e062d5ad5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 3 Jan 2020 12:29:22 -0700 Subject: [PATCH 13/15] 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 6d31959718c..1039ab1bb1e 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 e06c00902b1..d783c8cc3f2 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 3b51fae4b3d..c79e1827dad 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 66ec7330618..2210406c186 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({ From 206d4c78d2a3c943fd3d1ab6980061e4fb38a1ce Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 3 Jan 2020 12:32:29 -0700 Subject: [PATCH 14/15] Fix references to 'this' in Avatar and Unread --- src/Avatar.js | 2 +- src/Unread.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avatar.js b/src/Avatar.js index 3377849eca5..70be0a46845 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -32,7 +32,7 @@ export function avatarUrlForMember(member, width, height, resizeMethod) { // member can be null here currently since on invites, the JS SDK // does not have enough info to build a RoomMember object for // the inviter. - url = this.defaultAvatarUrlForString(member ? member.userId : ''); + url = defaultAvatarUrlForString(member ? member.userId : ''); } return url; } diff --git a/src/Unread.js b/src/Unread.js index c2eaa468f5e..dba8be492de 100644 --- a/src/Unread.js +++ b/src/Unread.js @@ -77,7 +77,7 @@ export function doesRoomHaveUnreadMessages(room) { // that counts and we can stop looking because the user's read // this and everything before. return false; - } else if (!shouldHideEvent(ev) && this.eventTriggersUnreadCount(ev)) { + } else if (!shouldHideEvent(ev) && eventTriggersUnreadCount(ev)) { // We've found a message that counts before we hit // the user's read receipt, so this room is definitely unread. return true; From 9213f88180ebb7109fe416efca485242c7c7fb89 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 7 Jan 2020 15:13:42 -0700 Subject: [PATCH 15/15] Re-add docs --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 3104ab1ac46..221155f70ff 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "src", "scripts", "git-revision.txt", + "docs", "header", "CHANGELOG.md", "CONTRIBUTING.rst",