Merge branch 'travis/sourcemaps-es6' into travis/babel7-wp-es6-fixes

pull/21833/head
Travis Ralston 2019-12-22 21:22:52 -07:00
commit 2461993ad1
413 changed files with 1286 additions and 1291 deletions

View File

@ -16,8 +16,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import sdk from './index'; import * as sdk from './index';
import Modal from './Modal'; import Modal from './Modal';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import IdentityAuthClient from './IdentityAuthClient'; import IdentityAuthClient from './IdentityAuthClient';

View File

@ -18,7 +18,7 @@ import { getCurrentLanguage, _t, _td } from './languageHandler';
import PlatformPeg from './PlatformPeg'; import PlatformPeg from './PlatformPeg';
import SdkConfig from './SdkConfig'; import SdkConfig from './SdkConfig';
import Modal from './Modal'; import Modal from './Modal';
import sdk from './index'; import * as sdk from './index';
const hashRegex = /#\/(groups?|room|user|settings|register|login|forgot_password|home|directory)/; const hashRegex = /#\/(groups?|room|user|settings|register|login|forgot_password|home|directory)/;
const hashVarRegex = /#\/(group|room|user)\/.*$/; const hashVarRegex = /#\/(group|room|user)\/.*$/;
@ -306,4 +306,4 @@ class Analytics {
if (!global.mxAnalytics) { if (!global.mxAnalytics) {
global.mxAnalytics = new Analytics(); global.mxAnalytics = new Analytics();
} }
module.exports = global.mxAnalytics; export default global.mxAnalytics;

View File

@ -16,11 +16,10 @@ limitations under the License.
'use strict'; 'use strict';
import {ContentRepo} from 'matrix-js-sdk'; import {ContentRepo} from 'matrix-js-sdk';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import DMRoomMap from './utils/DMRoomMap'; import DMRoomMap from './utils/DMRoomMap';
module.exports = { export function avatarUrlForMember(member, width, height, resizeMethod) {
avatarUrlForMember: function(member, width, height, resizeMethod) {
let url = member.getAvatarUrl( let url = member.getAvatarUrl(
MatrixClientPeg.get().getHomeserverUrl(), MatrixClientPeg.get().getHomeserverUrl(),
Math.floor(width * window.devicePixelRatio), Math.floor(width * window.devicePixelRatio),
@ -36,9 +35,9 @@ module.exports = {
url = this.defaultAvatarUrlForString(member ? member.userId : ''); url = this.defaultAvatarUrlForString(member ? member.userId : '');
} }
return url; return url;
}, }
avatarUrlForUser: function(user, width, height, resizeMethod) { export function avatarUrlForUser(user, width, height, resizeMethod) {
const url = ContentRepo.getHttpUriForMxc( const url = ContentRepo.getHttpUriForMxc(
MatrixClientPeg.get().getHomeserverUrl(), user.avatarUrl, MatrixClientPeg.get().getHomeserverUrl(), user.avatarUrl,
Math.floor(width * window.devicePixelRatio), Math.floor(width * window.devicePixelRatio),
@ -49,16 +48,16 @@ module.exports = {
return null; return null;
} }
return url; return url;
}, }
defaultAvatarUrlForString: function(s) { export function defaultAvatarUrlForString(s) {
const images = ['03b381', '368bd6', 'ac3ba8']; const images = ['03b381', '368bd6', 'ac3ba8'];
let total = 0; let total = 0;
for (let i = 0; i < s.length; ++i) { for (let i = 0; i < s.length; ++i) {
total += s.charCodeAt(i); total += s.charCodeAt(i);
} }
return require('../res/img/' + images[total % images.length] + '.png'); return require('../res/img/' + images[total % images.length] + '.png');
}, }
/** /**
* returns the first (non-sigil) character of 'name', * returns the first (non-sigil) character of 'name',
@ -66,7 +65,7 @@ module.exports = {
* @param {string} name * @param {string} name
* @return {string} the first letter * @return {string} the first letter
*/ */
getInitialLetter(name) { export function getInitialLetter(name) {
if (!name) { if (!name) {
// XXX: We should find out what causes the name to sometimes be falsy. // XXX: We should find out what causes the name to sometimes be falsy.
console.trace("`name` argument to `getInitialLetter` not supplied"); console.trace("`name` argument to `getInitialLetter` not supplied");
@ -97,9 +96,9 @@ module.exports = {
const firstChar = name.substring(idx, idx+chars); const firstChar = name.substring(idx, idx+chars);
return firstChar.toUpperCase(); return firstChar.toUpperCase();
}, }
avatarUrlForRoom(room, width, height, resizeMethod) { export function avatarUrlForRoom(room, width, height, resizeMethod) {
const explicitRoomAvatar = room.getAvatarUrl( const explicitRoomAvatar = room.getAvatarUrl(
MatrixClientPeg.get().getHomeserverUrl(), MatrixClientPeg.get().getHomeserverUrl(),
width, width,
@ -130,5 +129,4 @@ module.exports = {
); );
} }
return null; return null;
}, }
};

View File

@ -53,10 +53,10 @@ limitations under the License.
* } * }
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import PlatformPeg from './PlatformPeg'; import PlatformPeg from './PlatformPeg';
import Modal from './Modal'; import Modal from './Modal';
import sdk from './index'; import * as sdk from './index';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import dis from './dispatcher'; import dis from './dispatcher';
@ -302,7 +302,7 @@ function _onAction(payload) {
switch (payload.action) { switch (payload.action) {
case 'place_call': case 'place_call':
{ {
if (module.exports.getAnyActiveCall()) { if (callHandler.getAnyActiveCall()) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, { Modal.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, {
title: _t('Existing Call'), title: _t('Existing Call'),
@ -355,7 +355,7 @@ function _onAction(payload) {
break; break;
case 'incoming_call': 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. // 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. // 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. // in future we could signal a "local busy" as a warning to the caller.
@ -523,7 +523,7 @@ if (!global.mxCallHandler) {
const callHandler = { const callHandler = {
getCallForRoom: function(roomId) { getCallForRoom: function(roomId) {
let call = module.exports.getCall(roomId); let call = callHandler.getCall(roomId);
if (call) return call; if (call) return call;
if (ConferenceHandler) { if (ConferenceHandler) {
@ -583,4 +583,4 @@ if (global.mxCallHandler === undefined) {
global.mxCallHandler = callHandler; global.mxCallHandler = callHandler;
} }
module.exports = global.mxCallHandler; export default global.mxCallHandler;

View File

@ -19,8 +19,8 @@ limitations under the License.
import extend from './extend'; import extend from './extend';
import dis from './dispatcher'; import dis from './dispatcher';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import sdk from './index'; import * as sdk from './index';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import Modal from './Modal'; import Modal from './Modal';
import RoomViewStore from './stores/RoomViewStore'; import RoomViewStore from './stores/RoomViewStore';

View File

@ -15,10 +15,10 @@ limitations under the License.
*/ */
import Modal from './Modal'; import Modal from './Modal';
import sdk from './index'; import * as sdk from './index';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import { deriveKey } from 'matrix-js-sdk/lib/crypto/key_passphrase'; import { deriveKey } from 'matrix-js-sdk/src/crypto/key_passphrase';
import { decodeRecoveryKey } from 'matrix-js-sdk/lib/crypto/recoverykey'; import { decodeRecoveryKey } from 'matrix-js-sdk/src/crypto/recoverykey';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
// This stores the secret storage private keys in memory for the JS SDK. This is // This stores the secret storage private keys in memory for the JS SDK. This is

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import sdk from './index'; import * as sdk from './index';
function isMatch(query, name, uid) { function isMatch(query, name, uid) {
query = query.toLowerCase(); query = query.toLowerCase();
@ -105,26 +105,24 @@ class UserEntity extends Entity {
} }
} }
export function newEntity(jsx, matchFn) {
module.exports = {
newEntity: function(jsx, matchFn) {
const entity = new Entity(); const entity = new Entity();
entity.getJsx = function() { entity.getJsx = function() {
return jsx; return jsx;
}; };
entity.matches = matchFn; entity.matches = matchFn;
return entity; return entity;
}, }
/** /**
* @param {RoomMember[]} members * @param {RoomMember[]} members
* @return {Entity[]} * @return {Entity[]}
*/ */
fromRoomMembers: function(members) { export function fromRoomMembers(members) {
return members.map(function(m) { return members.map(function(m) {
return new MemberEntity(m); return new MemberEntity(m);
}); });
}, }
/** /**
* @param {User[]} users * @param {User[]} users
@ -132,9 +130,8 @@ module.exports = {
* @param {Function} inviteFn Called with the user ID. * @param {Function} inviteFn Called with the user ID.
* @return {Entity[]} * @return {Entity[]}
*/ */
fromUsers: function(users, showInviteButton, inviteFn) { export function fromUsers(users, showInviteButton, inviteFn) {
return users.map(function(u) { return users.map(function(u) {
return new UserEntity(u, showInviteButton, inviteFn); return new UserEntity(u, showInviteButton, inviteFn);
}); });
}, }
};

View File

@ -20,7 +20,7 @@ import URL from 'url';
import dis from './dispatcher'; import dis from './dispatcher';
import WidgetMessagingEndpoint from './WidgetMessagingEndpoint'; import WidgetMessagingEndpoint from './WidgetMessagingEndpoint';
import ActiveWidgetStore from './stores/ActiveWidgetStore'; import ActiveWidgetStore from './stores/ActiveWidgetStore';
import MatrixClientPeg from "./MatrixClientPeg"; import {MatrixClientPeg} from "./MatrixClientPeg";
import RoomViewStore from "./stores/RoomViewStore"; import RoomViewStore from "./stores/RoomViewStore";
import {IntegrationManagers} from "./integrations/IntegrationManagers"; import {IntegrationManagers} from "./integrations/IntegrationManagers";
import SettingsStore from "./settings/SettingsStore"; import SettingsStore from "./settings/SettingsStore";

View File

@ -16,10 +16,10 @@ limitations under the License.
import React from 'react'; import React from 'react';
import Modal from './Modal'; import Modal from './Modal';
import sdk from './'; import * as sdk from './';
import MultiInviter from './utils/MultiInviter'; import MultiInviter from './utils/MultiInviter';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import GroupStore from './stores/GroupStore'; import GroupStore from './stores/GroupStore';
import {allSettled} from "./utils/promise"; import {allSettled} from "./utils/promise";

View File

@ -29,7 +29,7 @@ import linkifyMatrix from './linkify-matrix';
import _linkifyElement from 'linkifyjs/element'; import _linkifyElement from 'linkifyjs/element';
import _linkifyString from 'linkifyjs/string'; import _linkifyString from 'linkifyjs/string';
import classNames from 'classnames'; import classNames from 'classnames';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import url from 'url'; import url from 'url';
import EMOJIBASE from 'emojibase-data/en/compact.json'; import EMOJIBASE from 'emojibase-data/en/compact.json';

View File

@ -16,9 +16,9 @@ limitations under the License.
import { createClient, SERVICE_TYPES } from 'matrix-js-sdk'; import { createClient, SERVICE_TYPES } from 'matrix-js-sdk';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import Modal from './Modal'; import Modal from './Modal';
import sdk from './index'; import * as sdk from './index';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import { Service, startTermsFlow, TermsNotSignedError } from './Terms'; import { Service, startTermsFlow, TermsNotSignedError } from './Terms';
import { import {

View File

@ -16,8 +16,6 @@ limitations under the License.
'use strict'; 'use strict';
module.exports = {
/** /**
* Returns the actual height that an image of dimensions (fullWidth, 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 * will occupy if resized to fit inside a thumbnail bounding box of size
@ -32,7 +30,7 @@ module.exports = {
* consume in the timeline, when performing scroll offset calcuations * consume in the timeline, when performing scroll offset calcuations
* (e.g. scroll locking) * (e.g. scroll locking)
*/ */
thumbHeight: function(fullWidth, fullHeight, thumbWidth, thumbHeight) { export function thumbHeight(fullWidth, fullHeight, thumbWidth, thumbHeight) {
if (!fullWidth || !fullHeight) { if (!fullWidth || !fullHeight) {
// Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even // Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even
// log this because it's spammy // log this because it's spammy
@ -51,6 +49,5 @@ module.exports = {
// height is the dominant dimension so scaling will be fixed on that // height is the dominant dimension so scaling will be fixed on that
return Math.floor(heightMulti * fullHeight); return Math.floor(heightMulti * fullHeight);
} }
}, }
};

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import sdk from './index'; import * as sdk from './index';
import Modal from './Modal'; import Modal from './Modal';
export default class KeyRequestHandler { export default class KeyRequestHandler {

View File

@ -18,7 +18,7 @@ limitations under the License.
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import EventIndexPeg from './indexing/EventIndexPeg'; import EventIndexPeg from './indexing/EventIndexPeg';
import createMatrixClient from './utils/createMatrixClient'; import createMatrixClient from './utils/createMatrixClient';
import Analytics from './Analytics'; import Analytics from './Analytics';
@ -28,7 +28,7 @@ import Presence from './Presence';
import dis from './dispatcher'; import dis from './dispatcher';
import DMRoomMap from './utils/DMRoomMap'; import DMRoomMap from './utils/DMRoomMap';
import Modal from './Modal'; import Modal from './Modal';
import sdk from './index'; import * as sdk from './index';
import ActiveWidgetStore from './stores/ActiveWidgetStore'; import ActiveWidgetStore from './stores/ActiveWidgetStore';
import PlatformPeg from "./PlatformPeg"; import PlatformPeg from "./PlatformPeg";
import { sendLoginRequest } from "./Login"; import { sendLoginRequest } from "./Login";

View File

@ -19,15 +19,15 @@ limitations under the License.
import {MatrixClient, MemoryStore} from 'matrix-js-sdk'; import {MatrixClient, MemoryStore} from 'matrix-js-sdk';
import utils from 'matrix-js-sdk/lib/utils'; import * as utils from 'matrix-js-sdk/src/utils';
import EventTimeline from 'matrix-js-sdk/lib/models/event-timeline'; import {EventTimeline} from 'matrix-js-sdk/src/models/event-timeline';
import EventTimelineSet from 'matrix-js-sdk/lib/models/event-timeline-set'; import {EventTimelineSet} from 'matrix-js-sdk/src/models/event-timeline-set';
import sdk from './index'; import * as sdk from './index';
import createMatrixClient from './utils/createMatrixClient'; import createMatrixClient from './utils/createMatrixClient';
import SettingsStore from './settings/SettingsStore'; import SettingsStore from './settings/SettingsStore';
import MatrixActionCreators from './actions/MatrixActionCreators'; import MatrixActionCreators from './actions/MatrixActionCreators';
import Modal from './Modal'; import Modal from './Modal';
import {verificationMethods} from 'matrix-js-sdk/lib/crypto'; import {verificationMethods} from 'matrix-js-sdk/src/crypto';
import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler"; import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler";
import * as StorageManager from './utils/StorageManager'; import * as StorageManager from './utils/StorageManager';
import IdentityAuthClient from './IdentityAuthClient'; import IdentityAuthClient from './IdentityAuthClient';
@ -248,9 +248,4 @@ if (!global.mxMatrixClientPeg) {
global.mxMatrixClientPeg = new _MatrixClientPeg(); 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; export const MatrixClientPeg = global.mxMatrixClientPeg;

View File

@ -20,7 +20,7 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import Analytics from './Analytics'; import Analytics from './Analytics';
import sdk from './index'; import * as sdk from './index';
import dis from './dispatcher'; import dis from './dispatcher';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import {defer} from "./utils/promise"; import {defer} from "./utils/promise";

View File

@ -16,13 +16,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import PlatformPeg from './PlatformPeg'; import PlatformPeg from './PlatformPeg';
import TextForEvent from './TextForEvent'; import * as TextForEvent from './TextForEvent';
import Analytics from './Analytics'; import Analytics from './Analytics';
import Avatar from './Avatar'; import * as Avatar from './Avatar';
import dis from './dispatcher'; import dis from './dispatcher';
import sdk from './index'; import * as sdk from './index';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import Modal from './Modal'; import Modal from './Modal';
import SettingsStore, {SettingLevel} from "./settings/SettingsStore"; import SettingsStore, {SettingLevel} from "./settings/SettingsStore";
@ -364,4 +364,4 @@ if (!global.mxNotifier) {
global.mxNotifier = Notifier; global.mxNotifier = Notifier;
} }
module.exports = global.mxNotifier; export default global.mxNotifier;

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2016 OpenMarket Ltd Copyright 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with 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: * @return {Object[]} An array of objects with the form:
* { key: $KEY, val: $VALUE, place: "add|del" } * { key: $KEY, val: $VALUE, place: "add|del" }
*/ */
module.exports.getKeyValueArrayDiffs = function(before, after) { export function getKeyValueArrayDiffs(before, after) {
const results = []; const results = [];
const delta = {}; const delta = {};
Object.keys(before).forEach(function(beforeKey) { Object.keys(before).forEach(function(beforeKey) {
@ -76,7 +77,7 @@ module.exports.getKeyValueArrayDiffs = function(before, after) {
}); });
return results; return results;
}; }
/** /**
* Shallow-compare two objects for equality: each key and value must be identical * 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 * @param {Object} objB Second object to compare against the first
* @return {boolean} whether the two objects have same key=values * @return {boolean} whether the two objects have same key=values
*/ */
module.exports.shallowEqual = function(objA, objB) { export function shallowEqual(objA, objB) {
if (objA === objB) { if (objA === objB) {
return true; return true;
} }
@ -109,4 +110,4 @@ module.exports.shallowEqual = function(objA, objB) {
} }
return true; return true;
}; }

View File

@ -25,7 +25,7 @@ import { _t } from './languageHandler';
* the client owns the given email address, which is then passed to the password * the client owns the given email address, which is then passed to the password
* API on the homeserver in question with the new password. * API on the homeserver in question with the new password.
*/ */
class PasswordReset { export default class PasswordReset {
/** /**
* Configure the endpoints for password resetting. * Configure the endpoints for password resetting.
* @param {string} homeserverUrl The URL to the HS which has the account to reset. * @param {string} homeserverUrl The URL to the HS which has the account to reset.
@ -101,4 +101,3 @@ class PasswordReset {
} }
} }
module.exports = PasswordReset;

View File

@ -47,4 +47,4 @@ class PlatformPeg {
if (!global.mxPlatformPeg) { if (!global.mxPlatformPeg) {
global.mxPlatformPeg = new PlatformPeg(); global.mxPlatformPeg = new PlatformPeg();
} }
module.exports = global.mxPlatformPeg; export default global.mxPlatformPeg;

View File

@ -1,6 +1,7 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2018 New Vector 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from "./MatrixClientPeg"; import {MatrixClientPeg} from "./MatrixClientPeg";
import dis from "./dispatcher"; import dis from "./dispatcher";
import Timer from './utils/Timer'; import Timer from './utils/Timer';
@ -104,4 +105,4 @@ class Presence {
} }
} }
module.exports = new Presence(); export default new Presence();

View File

@ -21,10 +21,10 @@ limitations under the License.
*/ */
import dis from './dispatcher'; import dis from './dispatcher';
import sdk from './index'; import * as sdk from './index';
import Modal from './Modal'; import Modal from './Modal';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
// import MatrixClientPeg from './MatrixClientPeg'; // import {MatrixClientPeg} from './MatrixClientPeg';
// Regex for what a "safe" or "Matrix-looking" localpart would be. // 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 // TODO: Update as needed for https://github.com/matrix-org/matrix-doc/issues/1514

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -14,26 +15,28 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import dis from './dispatcher'; import dis from './dispatcher';
import { EventStatus } from 'matrix-js-sdk'; import { EventStatus } from 'matrix-js-sdk';
module.exports = { export default class Resend {
resendUnsentEvents: function(room) { static resendUnsentEvents(room) {
room.getPendingEvents().filter(function (ev) { room.getPendingEvents().filter(function (ev) {
return ev.status === EventStatus.NOT_SENT; return ev.status === EventStatus.NOT_SENT;
}).forEach(function (event) { }).forEach(function (event) {
module.exports.resend(event); Resend.resend(event);
}); });
}, }
cancelUnsentEvents: function(room) {
static cancelUnsentEvents(room) {
room.getPendingEvents().filter(function (ev) { room.getPendingEvents().filter(function (ev) {
return ev.status === EventStatus.NOT_SENT; return ev.status === EventStatus.NOT_SENT;
}).forEach(function (event) { }).forEach(function (event) {
module.exports.removeFromQueue(event); Resend.removeFromQueue(event);
}); });
}, }
resend: function(event) {
static resend(event) {
const room = MatrixClientPeg.get().getRoom(event.getRoomId()); 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({ dis.dispatch({
@ -50,8 +53,9 @@ module.exports = {
event: event, event: event,
}); });
}); });
}, }
removeFromQueue: function(event) {
static removeFromQueue(event) {
MatrixClientPeg.get().cancelPendingEvent(event); MatrixClientPeg.get().cancelPendingEvent(event);
}, }
}; }

View File

@ -16,12 +16,12 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import MultiInviter from './utils/MultiInviter'; import MultiInviter from './utils/MultiInviter';
import Modal from './Modal'; import Modal from './Modal';
import { getAddressType } from './UserAddress'; import { getAddressType } from './UserAddress';
import createRoom from './createRoom'; import createRoom from './createRoom';
import sdk from './'; import * as sdk from './';
import dis from './dispatcher'; import dis from './dispatcher';
import DMRoomMap from './utils/DMRoomMap'; import DMRoomMap from './utils/DMRoomMap';
import { _t } from './languageHandler'; import { _t } from './languageHandler';

View File

@ -24,12 +24,8 @@ function tsOfNewestEvent(room) {
} }
} }
function mostRecentActivityFirst(roomList) { export function mostRecentActivityFirst(roomList) {
return roomList.sort(function(a, b) { return roomList.sort(function(a, b) {
return tsOfNewestEvent(b) - tsOfNewestEvent(a); return tsOfNewestEvent(b) - tsOfNewestEvent(a);
}); });
} }
module.exports = {
mostRecentActivityFirst,
};

View File

@ -15,8 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import PushProcessor from 'matrix-js-sdk/lib/pushprocessor'; import {PushProcessor} from 'matrix-js-sdk/src/pushprocessor';
export const ALL_MESSAGES_LOUD = 'all_messages_loud'; export const ALL_MESSAGES_LOUD = 'all_messages_loud';
export const ALL_MESSAGES = 'all_messages'; export const ALL_MESSAGES = 'all_messages';

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
/** /**
* Given a room object, return the alias we should use for it, * Given a room object, return the alias we should use for it,

View File

@ -18,9 +18,8 @@ limitations under the License.
import url from 'url'; import url from 'url';
import SettingsStore from "./settings/SettingsStore"; import SettingsStore from "./settings/SettingsStore";
import { Service, startTermsFlow, TermsNotSignedError } from './Terms'; import { Service, startTermsFlow, TermsNotSignedError } from './Terms';
const request = require('browser-request'); import {MatrixClientPeg} from "./MatrixClientPeg";
import request from "browser-request";
const MatrixClientPeg = require('./MatrixClientPeg');
import * as Matrix from 'matrix-js-sdk'; import * as Matrix from 'matrix-js-sdk';
import SdkConfig from "./SdkConfig"; import SdkConfig from "./SdkConfig";

View File

@ -232,7 +232,7 @@ Example:
} }
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import { MatrixEvent } from 'matrix-js-sdk'; import { MatrixEvent } from 'matrix-js-sdk';
import dis from './dispatcher'; import dis from './dispatcher';
import WidgetUtils from './utils/WidgetUtils'; import WidgetUtils from './utils/WidgetUtils';
@ -658,15 +658,15 @@ const onMessage = function(event) {
let listenerCount = 0; let listenerCount = 0;
let openManagerUrl = null; let openManagerUrl = null;
module.exports = {
startListening: function() { export function startListening() {
if (listenerCount === 0) { if (listenerCount === 0) {
window.addEventListener("message", onMessage, false); window.addEventListener("message", onMessage, false);
} }
listenerCount += 1; listenerCount += 1;
}, }
stopListening: function() { export function stopListening() {
listenerCount -= 1; listenerCount -= 1;
if (listenerCount === 0) { if (listenerCount === 0) {
window.removeEventListener("message", onMessage); window.removeEventListener("message", onMessage);
@ -679,9 +679,8 @@ module.exports = {
); );
console.error(e); console.error(e);
} }
}, }
setOpenManagerUrl: function(url) { export function setOpenManagerUrl(url) {
openManagerUrl = url; openManagerUrl = url;
}, }
};

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import EventIndexPeg from "./indexing/EventIndexPeg"; import EventIndexPeg from "./indexing/EventIndexPeg";
import MatrixClientPeg from "./MatrixClientPeg"; import {MatrixClientPeg} from "./MatrixClientPeg";
function serverSideSearch(term, roomId = undefined) { function serverSideSearch(term, roomId = undefined) {
let filter; let filter;

View File

@ -106,5 +106,5 @@ class Skinner {
if (global.mxSkinner === undefined) { if (global.mxSkinner === undefined) {
global.mxSkinner = new Skinner(); global.mxSkinner = new Skinner();
} }
module.exports = global.mxSkinner; export default global.mxSkinner;

View File

@ -18,9 +18,9 @@ limitations under the License.
import React from 'react'; import React from 'react';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import dis from './dispatcher'; import dis from './dispatcher';
import sdk from './index'; import * as sdk from './index';
import {_t, _td} from './languageHandler'; import {_t, _td} from './languageHandler';
import Modal from './Modal'; import Modal from './Modal';
import MultiInviter from './utils/MultiInviter'; import MultiInviter from './utils/MultiInviter';

View File

@ -16,8 +16,8 @@ limitations under the License.
import classNames from 'classnames'; import classNames from 'classnames';
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import sdk from './'; import * as sdk from './';
import Modal from './Modal'; import Modal from './Modal';
export class TermsNotSignedError extends Error {} export class TermsNotSignedError extends Error {}

View File

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from './MatrixClientPeg'; import {MatrixClientPeg} from './MatrixClientPeg';
import CallHandler from './CallHandler'; import CallHandler from './CallHandler';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import * as Roles from './Roles'; import * as Roles from './Roles';
@ -620,10 +620,8 @@ for (const evType of ALL_RULE_TYPES) {
stateHandlers[evType] = textForMjolnirEvent; stateHandlers[evType] = textForMjolnirEvent;
} }
module.exports = { export function textForEvent(ev) {
textForEvent: function(ev) {
const handler = (ev.isState() ? stateHandlers : handlers)[ev.getType()]; const handler = (ev.isState() ? stateHandlers : handlers)[ev.getType()];
if (handler) return handler(ev); if (handler) return handler(ev);
return ''; return '';
}, }
};

View File

@ -14,16 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const MatrixClientPeg = require('./MatrixClientPeg'); import {MatrixClientPeg} from "./MatrixClientPeg";
import shouldHideEvent from './shouldHideEvent'; import shouldHideEvent from './shouldHideEvent';
const sdk = require('./index'); import * as sdk from "./index";
module.exports = {
/** /**
* Returns true iff this event arriving in a room should affect the room's * Returns true iff this event arriving in a room should affect the room's
* count of unread messages * count of unread messages
*/ */
eventTriggersUnreadCount: function(ev) { export function eventTriggersUnreadCount(ev) {
if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) { if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) {
return false; return false;
} else if (ev.getType() == 'm.room.member') { } else if (ev.getType() == 'm.room.member') {
@ -41,9 +40,9 @@ module.exports = {
} }
const EventTile = sdk.getComponent('rooms.EventTile'); const EventTile = sdk.getComponent('rooms.EventTile');
return EventTile.haveTileForEvent(ev); return EventTile.haveTileForEvent(ev);
}, }
doesRoomHaveUnreadMessages: function(room) { export function doesRoomHaveUnreadMessages(room) {
const myUserId = MatrixClientPeg.get().credentials.userId; const myUserId = MatrixClientPeg.get().credentials.userId;
// get the most recent read receipt sent by our account. // get the most recent read receipt sent by our account.
@ -89,5 +88,4 @@ module.exports = {
// unread on the theory that false positives are better than false // unread on the theory that false positives are better than false
// negatives here. // negatives here.
return true; return true;
}, }
};

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -16,7 +17,7 @@ limitations under the License.
import {createNewMatrixCall, Room} from "matrix-js-sdk"; import {createNewMatrixCall, Room} from "matrix-js-sdk";
import CallHandler from './CallHandler'; 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 // FIXME: this is Riot (Vector) specific code, but will be removed shortly when
// we switch over to jitsi entirely for video conferencing. // we switch over to jitsi entirely for video conferencing.
@ -28,10 +29,10 @@ import MatrixClientPeg from "./MatrixClientPeg";
const USER_PREFIX = "fs_"; const USER_PREFIX = "fs_";
const DOMAIN = "matrix.org"; const DOMAIN = "matrix.org";
function ConferenceCall(matrixClient, groupChatRoomId) { export function ConferenceCall(matrixClient, groupChatRoomId) {
this.client = matrixClient; this.client = matrixClient;
this.groupRoomId = groupChatRoomId; this.groupRoomId = groupChatRoomId;
this.confUserId = module.exports.getConferenceUserIdForRoom(this.groupRoomId); this.confUserId = getConferenceUserIdForRoom(this.groupRoomId);
} }
ConferenceCall.prototype.setup = function() { ConferenceCall.prototype.setup = function() {
@ -90,7 +91,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() {
* @param {string} userId The user ID to check. * @param {string} userId The user ID to check.
* @return {boolean} True if it is a conference bot. * @return {boolean} True if it is a conference bot.
*/ */
module.exports.isConferenceUser = function(userId) { export function isConferenceUser(userId) {
if (userId.indexOf("@" + USER_PREFIX) !== 0) { if (userId.indexOf("@" + USER_PREFIX) !== 0) {
return false; return false;
} }
@ -101,26 +102,26 @@ module.exports.isConferenceUser = function(userId) {
return /^!.+:.+/.test(decoded); return /^!.+:.+/.test(decoded);
} }
return false; return false;
}; }
module.exports.getConferenceUserIdForRoom = function(roomId) { export function getConferenceUserIdForRoom(roomId) {
// abuse browserify's core node Buffer support (strip padding ='s) // abuse browserify's core node Buffer support (strip padding ='s)
const base64RoomId = new Buffer(roomId).toString("base64").replace(/=/g, ""); const base64RoomId = new Buffer(roomId).toString("base64").replace(/=/g, "");
return "@" + USER_PREFIX + base64RoomId + ":" + DOMAIN; return "@" + USER_PREFIX + base64RoomId + ":" + DOMAIN;
}; }
module.exports.createNewMatrixCall = function(client, roomId) { export function createNewMatrixCall(client, roomId) {
const confCall = new ConferenceCall( const confCall = new ConferenceCall(
client, roomId, client, roomId,
); );
return confCall.setup(); 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 // search for a conference 1:1 call for this group chat room ID
const activeCall = CallHandler.getAnyActiveCall(); const activeCall = CallHandler.getAnyActiveCall();
if (activeCall && activeCall.confUserId) { if (activeCall && activeCall.confUserId) {
const thisRoomConfUserId = module.exports.getConferenceUserIdForRoom( const thisRoomConfUserId = getConferenceUserIdForRoom(
roomId, roomId,
); );
if (thisRoomConfUserId === activeCall.confUserId) { if (thisRoomConfUserId === activeCall.confUserId) {
@ -128,8 +129,7 @@ module.exports.getConferenceCallForRoom = function(roomId) {
} }
} }
return null; return null;
}; }
module.exports.ConferenceCall = ConferenceCall; // TODO: Document this.
export const slot = 'conference';
module.exports.slot = 'conference';

View File

@ -1,7 +1,7 @@
const React = require('react'); import React from "react";
const ReactDom = require('react-dom'); import ReactDom from "react-dom";
import Velocity from "velocity-animate";
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const Velocity = require('velocity-animate');
/** /**
* The Velociraptor contains components and animates transitions with velocity. * The Velociraptor contains components and animates transitions with velocity.

View File

@ -1,4 +1,4 @@
const Velocity = require('velocity-animate'); import Velocity from "velocity-animate";
// courtesy of https://github.com/julianshapiro/velocity/issues/283 // courtesy of https://github.com/julianshapiro/velocity/issues/283
// We only use easeOutBounce (easeInBounce is just sort of nonsensical) // We only use easeOutBounce (easeInBounce is just sort of nonsensical)

View File

@ -14,21 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import MatrixClientPeg from "./MatrixClientPeg"; import {MatrixClientPeg} from "./MatrixClientPeg";
import { _t } from './languageHandler'; import { _t } from './languageHandler';
module.exports = { export function usersTypingApartFromMeAndIgnored(room) {
usersTypingApartFromMeAndIgnored: function(room) { return usersTyping(
return this.usersTyping(
room, [MatrixClientPeg.get().credentials.userId].concat(MatrixClientPeg.get().getIgnoredUsers()), room, [MatrixClientPeg.get().credentials.userId].concat(MatrixClientPeg.get().getIgnoredUsers()),
); );
}, }
usersTypingApartFromMe: function(room) { export function usersTypingApartFromMe(room) {
return this.usersTyping( return usersTyping(
room, [MatrixClientPeg.get().credentials.userId], room, [MatrixClientPeg.get().credentials.userId],
); );
}, }
/** /**
* Given a Room object and, optionally, a list of userID strings * Given a Room object and, optionally, a list of userID strings
@ -37,7 +36,7 @@ module.exports = {
* @param {string[]} exclude: list of user mxids to exclude. * @param {string[]} exclude: list of user mxids to exclude.
* @returns {string[]} list of user objects who are typing. * @returns {string[]} list of user objects who are typing.
*/ */
usersTyping: function(room, exclude) { export function usersTyping(room, exclude) {
const whoIsTyping = []; const whoIsTyping = [];
if (exclude === undefined) { if (exclude === undefined) {
@ -56,9 +55,9 @@ module.exports = {
} }
return whoIsTyping; return whoIsTyping;
}, }
whoIsTypingString: function(whoIsTyping, limit) { export function whoIsTypingString(whoIsTyping, limit) {
let othersCount = 0; let othersCount = 0;
if (whoIsTyping.length > limit) { if (whoIsTyping.length > limit) {
othersCount = whoIsTyping.length - limit + 1; othersCount = whoIsTyping.length - limit + 1;
@ -80,5 +79,4 @@ module.exports = {
const lastPerson = names.pop(); const lastPerson = names.pop();
return _t('%(names)s and %(lastPerson)s are typing …', {names: names.join(', '), lastPerson: lastPerson}); return _t('%(names)s and %(lastPerson)s are typing …', {names: names.join(', '), lastPerson: lastPerson});
} }
}, }
};

View File

@ -23,7 +23,7 @@ limitations under the License.
import FromWidgetPostMessageApi from './FromWidgetPostMessageApi'; import FromWidgetPostMessageApi from './FromWidgetPostMessageApi';
import ToWidgetPostMessageApi from './ToWidgetPostMessageApi'; import ToWidgetPostMessageApi from './ToWidgetPostMessageApi';
import Modal from "./Modal"; import Modal from "./Modal";
import MatrixClientPeg from "./MatrixClientPeg"; import {MatrixClientPeg} from "./MatrixClientPeg";
import SettingsStore from "./settings/SettingsStore"; import SettingsStore from "./settings/SettingsStore";
import WidgetOpenIDPermissionsDialog from "./components/views/dialogs/WidgetOpenIDPermissionsDialog"; import WidgetOpenIDPermissionsDialog from "./components/views/dialogs/WidgetOpenIDPermissionsDialog";
import WidgetUtils from "./utils/WidgetUtils"; import WidgetUtils from "./utils/WidgetUtils";

View File

@ -16,11 +16,10 @@ limitations under the License.
import { asyncAction } from './actionCreators'; import { asyncAction } from './actionCreators';
import RoomListStore from '../stores/RoomListStore'; import RoomListStore from '../stores/RoomListStore';
import Modal from '../Modal'; import Modal from '../Modal';
import * as Rooms from '../Rooms'; import * as Rooms from '../Rooms';
import { _t } from '../languageHandler'; import { _t } from '../languageHandler';
import sdk from '../index'; import * as sdk from '../index';
const RoomListActions = {}; const RoomListActions = {};

View File

@ -14,14 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const React = require("react"); import React from "react";
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
const sdk = require('../../../index'); import {MatrixClientPeg} from "../../../MatrixClientPeg";
const MatrixClientPeg = require("../../../MatrixClientPeg");
module.exports = createReactClass({ const sdk = require('../../../index');
export default createReactClass({
displayName: 'EncryptedEventDialog', displayName: 'EncryptedEventDialog',
propTypes: { propTypes: {

View File

@ -22,7 +22,7 @@ import { _t } from '../../../languageHandler';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import * as MegolmExportEncryption from '../../../utils/MegolmExportEncryption'; import * as MegolmExportEncryption from '../../../utils/MegolmExportEncryption';
import sdk from '../../../index'; import * as sdk from '../../../index';
const PHASE_EDIT = 1; const PHASE_EDIT = 1;
const PHASE_EXPORTING = 2; const PHASE_EXPORTING = 2;

View File

@ -20,7 +20,7 @@ import createReactClass from 'create-react-class';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import * as MegolmExportEncryption from '../../../utils/MegolmExportEncryption'; import * as MegolmExportEncryption from '../../../utils/MegolmExportEncryption';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
function readFileAsArrayBuffer(file) { function readFileAsArrayBuffer(file) {

View File

@ -17,9 +17,8 @@ limitations under the License.
import React from 'react'; import React from 'react';
import FileSaver from 'file-saver'; import FileSaver from 'file-saver';
import * as sdk from '../../../../index';
import sdk from '../../../../index'; import {MatrixClientPeg} from '../../../../MatrixClientPeg';
import MatrixClientPeg from '../../../../MatrixClientPeg';
import { scorePassword } from '../../../../utils/PasswordScorer'; import { scorePassword } from '../../../../utils/PasswordScorer';
import { _t } from '../../../../languageHandler'; import { _t } from '../../../../languageHandler';

View File

@ -16,7 +16,7 @@ limitations under the License.
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import sdk from "../../../../index"; import * as sdk from "../../../../index";
import { _t } from "../../../../languageHandler"; import { _t } from "../../../../languageHandler";
export default class IgnoreRecoveryReminderDialog extends React.PureComponent { export default class IgnoreRecoveryReminderDialog extends React.PureComponent {

View File

@ -16,8 +16,8 @@ limitations under the License.
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import sdk from "../../../../index"; import * as sdk from "../../../../index";
import MatrixClientPeg from '../../../../MatrixClientPeg'; import {MatrixClientPeg} from '../../../../MatrixClientPeg';
import dis from "../../../../dispatcher"; import dis from "../../../../dispatcher";
import { _t } from "../../../../languageHandler"; import { _t } from "../../../../languageHandler";
import Modal from "../../../../Modal"; import Modal from "../../../../Modal";

View File

@ -16,7 +16,7 @@ limitations under the License.
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import sdk from "../../../../index"; import * as sdk from "../../../../index";
import dis from "../../../../dispatcher"; import dis from "../../../../dispatcher";
import { _t } from "../../../../languageHandler"; import { _t } from "../../../../languageHandler";
import Modal from "../../../../Modal"; import Modal from "../../../../Modal";

View File

@ -16,8 +16,8 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import sdk from '../../../../index'; import * as sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg'; import {MatrixClientPeg} from '../../../../MatrixClientPeg';
import { scorePassword } from '../../../../utils/PasswordScorer'; import { scorePassword } from '../../../../utils/PasswordScorer';
import FileSaver from 'file-saver'; import FileSaver from 'file-saver';
import { _t } from '../../../../languageHandler'; import { _t } from '../../../../languageHandler';

View File

@ -18,10 +18,10 @@ limitations under the License.
import React from 'react'; import React from 'react';
import { _t } from '../languageHandler'; import { _t } from '../languageHandler';
import AutocompleteProvider from './AutocompleteProvider'; import AutocompleteProvider from './AutocompleteProvider';
import MatrixClientPeg from '../MatrixClientPeg'; import {MatrixClientPeg} from '../MatrixClientPeg';
import QueryMatcher from './QueryMatcher'; import QueryMatcher from './QueryMatcher';
import {PillCompletion} from './Components'; import {PillCompletion} from './Components';
import sdk from '../index'; import * as sdk from '../index';
import _sortBy from 'lodash/sortBy'; import _sortBy from 'lodash/sortBy';
import {makeGroupPermalink} from "../utils/permalinks/Permalinks"; import {makeGroupPermalink} from "../utils/permalinks/Permalinks";
import type {Completion, SelectionRange} from "./Autocompleter"; import type {Completion, SelectionRange} from "./Autocompleter";
@ -46,7 +46,7 @@ export default class CommunityProvider extends AutocompleteProvider {
}); });
} }
async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array<Completion> { async getCompletions(query: string, selection: SelectionRange, force: boolean = false): Array<Completion> {
const BaseAvatar = sdk.getComponent('views.avatars.BaseAvatar'); const BaseAvatar = sdk.getComponent('views.avatars.BaseAvatar');
// Disable autocompletions when composing commands because of various issues // Disable autocompletions when composing commands because of various issues

View File

@ -37,7 +37,7 @@ export default class DuckDuckGoProvider extends AutocompleteProvider {
+ `&format=json&no_redirect=1&no_html=1&t=${encodeURIComponent(REFERRER)}`; + `&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); const {command, range} = this.getCurrentCommand(query, selection);
if (!query || !command) { if (!query || !command) {
return []; return [];

View File

@ -17,9 +17,9 @@ limitations under the License.
import React from 'react'; import React from 'react';
import AutocompleteProvider from './AutocompleteProvider'; import AutocompleteProvider from './AutocompleteProvider';
import { _t } from '../languageHandler'; import { _t } from '../languageHandler';
import MatrixClientPeg from '../MatrixClientPeg'; import {MatrixClientPeg} from '../MatrixClientPeg';
import {PillCompletion} from './Components'; import {PillCompletion} from './Components';
import sdk from '../index'; import * as sdk from '../index';
import type {Completion, SelectionRange} from "./Autocompleter"; import type {Completion, SelectionRange} from "./Autocompleter";
const AT_ROOM_REGEX = /@\S*/g; const AT_ROOM_REGEX = /@\S*/g;
@ -30,7 +30,7 @@ export default class NotifProvider extends AutocompleteProvider {
this.room = room; this.room = room;
} }
async getCompletions(query: string, selection: SelectionRange, force?:boolean = false): Array<Completion> { async getCompletions(query: string, selection: SelectionRange, force:boolean = false): Array<Completion> {
const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar'); const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar');
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();

View File

@ -20,11 +20,11 @@ limitations under the License.
import React from 'react'; import React from 'react';
import { _t } from '../languageHandler'; import { _t } from '../languageHandler';
import AutocompleteProvider from './AutocompleteProvider'; import AutocompleteProvider from './AutocompleteProvider';
import MatrixClientPeg from '../MatrixClientPeg'; import {MatrixClientPeg} from '../MatrixClientPeg';
import QueryMatcher from './QueryMatcher'; import QueryMatcher from './QueryMatcher';
import {PillCompletion} from './Components'; import {PillCompletion} from './Components';
import {getDisplayAliasForRoom} from '../Rooms'; import {getDisplayAliasForRoom} from '../Rooms';
import sdk from '../index'; import * as sdk from '../index';
import _sortBy from 'lodash/sortBy'; import _sortBy from 'lodash/sortBy';
import {makeRoomPermalink} from "../utils/permalinks/Permalinks"; import {makeRoomPermalink} from "../utils/permalinks/Permalinks";
import type {Completion, SelectionRange} from "./Autocompleter"; import type {Completion, SelectionRange} from "./Autocompleter";
@ -48,7 +48,7 @@ export default class RoomProvider extends AutocompleteProvider {
}); });
} }
async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array<Completion> { async getCompletions(query: string, selection: SelectionRange, force: boolean = false): Array<Completion> {
const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar'); const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar');
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();

View File

@ -22,10 +22,10 @@ import React from 'react';
import { _t } from '../languageHandler'; import { _t } from '../languageHandler';
import AutocompleteProvider from './AutocompleteProvider'; import AutocompleteProvider from './AutocompleteProvider';
import {PillCompletion} from './Components'; import {PillCompletion} from './Components';
import sdk from '../index'; import * as sdk from '../index';
import QueryMatcher from './QueryMatcher'; import QueryMatcher from './QueryMatcher';
import _sortBy from 'lodash/sortBy'; import _sortBy from 'lodash/sortBy';
import MatrixClientPeg from '../MatrixClientPeg'; import {MatrixClientPeg} from '../MatrixClientPeg';
import type {MatrixEvent, Room, RoomMember, RoomState} from 'matrix-js-sdk'; import type {MatrixEvent, Room, RoomMember, RoomState} from 'matrix-js-sdk';
import {makeUserPermalink} from "../utils/permalinks/Permalinks"; import {makeUserPermalink} from "../utils/permalinks/Permalinks";
@ -91,7 +91,7 @@ export default class UserProvider extends AutocompleteProvider {
this.users = null; this.users = null;
} }
async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array<Completion> { async getCompletions(query: string, selection: SelectionRange, force: boolean = false): Array<Completion> {
const MemberAvatar = sdk.getComponent('views.avatars.MemberAvatar'); const MemberAvatar = sdk.getComponent('views.avatars.MemberAvatar');
// lazy-load user list into matcher // lazy-load user list into matcher

View File

@ -1,6 +1,7 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with 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 PropTypes from 'prop-types';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
module.exports = createReactClass({ export default createReactClass({
displayName: 'CompatibilityPage', displayName: 'CompatibilityPage',
propTypes: { propTypes: {
onAccept: PropTypes.func, onAccept: PropTypes.func,

View File

@ -21,7 +21,7 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import {Key} from "../../Keyboard"; import {Key} from "../../Keyboard";
import sdk from "../../index"; import * as sdk from "../../index";
import AccessibleButton from "../views/elements/AccessibleButton"; import AccessibleButton from "../views/elements/AccessibleButton";
// Shamelessly ripped off Modal.js. There's probably a better way // Shamelessly ripped off Modal.js. There's probably a better way

View File

@ -17,7 +17,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import CustomRoomTagStore from '../../stores/CustomRoomTagStore'; import CustomRoomTagStore from '../../stores/CustomRoomTagStore';
import AutoHideScrollbar from './AutoHideScrollbar'; import AutoHideScrollbar from './AutoHideScrollbar';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import classNames from 'classnames'; import classNames from 'classnames';
import * as FormattingUtils from '../../utils/FormattingUtils'; import * as FormattingUtils from '../../utils/FormattingUtils';

View File

@ -23,9 +23,9 @@ import PropTypes from 'prop-types';
import request from 'browser-request'; import request from 'browser-request';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
import sanitizeHtml from 'sanitize-html'; import sanitizeHtml from 'sanitize-html';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import classnames from 'classnames'; import classnames from 'classnames';

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2016 OpenMarket Ltd Copyright 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -19,8 +20,8 @@ import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import sdk from '../../index'; import * as sdk from '../../index';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
/* /*
@ -126,4 +127,4 @@ const FilePanel = createReactClass({
}, },
}); });
module.exports = FilePanel; export default FilePanel;

View File

@ -19,8 +19,8 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import { getHostingLink } from '../../utils/HostingLink'; import { getHostingLink } from '../../utils/HostingLink';
import { sanitizedHtmlNode } from '../../HtmlUtils'; import { sanitizedHtmlNode } from '../../HtmlUtils';

View File

@ -15,16 +15,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import Matrix from 'matrix-js-sdk'; import {InteractiveAuth} from "matrix-js-sdk";
const InteractiveAuth = Matrix.InteractiveAuth;
import React, {createRef} from 'react'; import React, {createRef} from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {getEntryComponentForLoginType} from '../views/auth/InteractiveAuthEntryComponents'; import {getEntryComponentForLoginType} from '../views/auth/InteractiveAuthEntryComponents';
import sdk from '../../index'; import * as sdk from '../../index';
export default createReactClass({ export default createReactClass({
displayName: 'InteractiveAuth', displayName: 'InteractiveAuth',

View File

@ -21,9 +21,9 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import { Key } from '../../Keyboard'; import { Key } from '../../Keyboard';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import VectorConferenceHandler from '../../VectorConferenceHandler'; import * as VectorConferenceHandler from '../../VectorConferenceHandler';
import TagPanelButtons from './TagPanelButtons'; import TagPanelButtons from './TagPanelButtons';
import SettingsStore from '../../settings/SettingsStore'; import SettingsStore from '../../settings/SettingsStore';
import {_t} from "../../languageHandler"; import {_t} from "../../languageHandler";
@ -308,4 +308,4 @@ const LeftPanel = createReactClass({
}, },
}); });
module.exports = LeftPanel; export default LeftPanel;

View File

@ -26,10 +26,10 @@ import { Key, isOnlyCtrlOrCmdKeyEvent } from '../../Keyboard';
import PageTypes from '../../PageTypes'; import PageTypes from '../../PageTypes';
import CallMediaHandler from '../../CallMediaHandler'; import CallMediaHandler from '../../CallMediaHandler';
import { fixupColorFonts } from '../../utils/FontManager'; import { fixupColorFonts } from '../../utils/FontManager';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import sessionStore from '../../stores/SessionStore'; import sessionStore from '../../stores/SessionStore';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import RoomListStore from "../../stores/RoomListStore"; import RoomListStore from "../../stores/RoomListStore";
import { getHomePageUrl } from '../../utils/pages'; import { getHomePageUrl } from '../../utils/pages';

View File

@ -20,7 +20,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; 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 // focus-visible is a Polyfill for the :focus-visible CSS pseudo-attribute used by _AccessibleButton.scss
import 'focus-visible'; import 'focus-visible';
@ -29,7 +29,7 @@ import 'what-input';
import Analytics from "../../Analytics"; import Analytics from "../../Analytics";
import { DecryptionFailureTracker } from "../../DecryptionFailureTracker"; import { DecryptionFailureTracker } from "../../DecryptionFailureTracker";
import MatrixClientPeg from "../../MatrixClientPeg"; import {MatrixClientPeg} from "../../MatrixClientPeg";
import PlatformPeg from "../../PlatformPeg"; import PlatformPeg from "../../PlatformPeg";
import SdkConfig from "../../SdkConfig"; import SdkConfig from "../../SdkConfig";
import * as RoomListSorter from "../../RoomListSorter"; import * as RoomListSorter from "../../RoomListSorter";
@ -38,7 +38,7 @@ import Notifier from '../../Notifier';
import Modal from "../../Modal"; import Modal from "../../Modal";
import Tinter from "../../Tinter"; import Tinter from "../../Tinter";
import sdk from '../../index'; import * as sdk from '../../index';
import { showStartChatInviteDialog, showRoomInviteDialog } from '../../RoomInvite'; import { showStartChatInviteDialog, showRoomInviteDialog } from '../../RoomInvite';
import * as Rooms from '../../Rooms'; import * as Rooms from '../../Rooms';
import linkifyMatrix from "../../linkify-matrix"; import linkifyMatrix from "../../linkify-matrix";

View File

@ -22,9 +22,9 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import shouldHideEvent from '../../shouldHideEvent'; import shouldHideEvent from '../../shouldHideEvent';
import {wantsDateSeparator} from '../../DateUtils'; import {wantsDateSeparator} from '../../DateUtils';
import sdk from '../../index'; import * as sdk from '../../index';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import SettingsStore from '../../settings/SettingsStore'; import SettingsStore from '../../settings/SettingsStore';
import {_t} from "../../languageHandler"; import {_t} from "../../languageHandler";

View File

@ -19,7 +19,7 @@ import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import sdk from '../../index'; import * as sdk from '../../index';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import AccessibleButton from '../views/elements/AccessibleButton'; import AccessibleButton from '../views/elements/AccessibleButton';

View File

@ -1,6 +1,7 @@
/* /*
Copyright 2016 OpenMarket Ltd Copyright 2016 OpenMarket Ltd
Copyright 2019 New Vector 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -18,8 +19,8 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
const sdk = require('../../index'); import {MatrixClientPeg} from "../../MatrixClientPeg";
const MatrixClientPeg = require("../../MatrixClientPeg"); import * as sdk from "../../index";
/* /*
* Component which shows the global notification list using a TimelinePanel * Component which shows the global notification list using a TimelinePanel
@ -60,4 +61,4 @@ const NotificationPanel = createReactClass({
}, },
}); });
module.exports = NotificationPanel; export default NotificationPanel;

View File

@ -21,7 +21,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import RateLimitedFunc from '../../ratelimitedfunc'; import RateLimitedFunc from '../../ratelimitedfunc';

View File

@ -18,13 +18,11 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import {ContentRepo} from "matrix-js-sdk";
const MatrixClientPeg = require('../../MatrixClientPeg'); import {MatrixClientPeg} from "../../MatrixClientPeg";
const ContentRepo = require("matrix-js-sdk").ContentRepo; import * as sdk from "../../index";
const Modal = require('../../Modal'); import dis from "../../dispatcher";
const sdk = require('../../index'); import Modal from "../../Modal";
const dis = require('../../dispatcher');
import { linkifyAndSanitizeHtml } from '../../HtmlUtils'; import { linkifyAndSanitizeHtml } from '../../HtmlUtils';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
@ -38,7 +36,7 @@ function track(action) {
Analytics.trackEvent('RoomDirectory', action); Analytics.trackEvent('RoomDirectory', action);
} }
module.exports = createReactClass({ export default createReactClass({
displayName: 'RoomDirectory', displayName: 'RoomDirectory',
propTypes: { propTypes: {

View File

@ -1,6 +1,7 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017, 2018 New Vector 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,8 +21,8 @@ import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import { _t, _td } from '../../languageHandler'; import { _t, _td } from '../../languageHandler';
import sdk from '../../index'; import * as sdk from '../../index';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import Resend from '../../Resend'; import Resend from '../../Resend';
import * as cryptodevices from '../../cryptodevices'; import * as cryptodevices from '../../cryptodevices';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
@ -38,7 +39,7 @@ function getUnsentMessages(room) {
}); });
} }
module.exports = createReactClass({ export default createReactClass({
displayName: 'RoomStatusBar', displayName: 'RoomStatusBar',
propTypes: { propTypes: {

View File

@ -19,9 +19,9 @@ limitations under the License.
import React, {createRef} from 'react'; import React, {createRef} from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import Unread from '../../Unread'; import * as Unread from '../../Unread';
import * as RoomNotifs from '../../RoomNotifs'; import * as RoomNotifs from '../../RoomNotifs';
import * as FormattingUtils from '../../utils/FormattingUtils'; import * as FormattingUtils from '../../utils/FormattingUtils';
import IndicatorScrollbar from './IndicatorScrollbar'; import IndicatorScrollbar from './IndicatorScrollbar';

View File

@ -32,15 +32,15 @@ import {Room} from "matrix-js-sdk";
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
import {RoomPermalinkCreator} from '../../utils/permalinks/Permalinks'; import {RoomPermalinkCreator} from '../../utils/permalinks/Permalinks';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import ContentMessages from '../../ContentMessages'; import ContentMessages from '../../ContentMessages';
import Modal from '../../Modal'; import Modal from '../../Modal';
import sdk from '../../index'; import * as sdk from '../../index';
import CallHandler from '../../CallHandler'; import CallHandler from '../../CallHandler';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import Tinter from '../../Tinter'; import Tinter from '../../Tinter';
import rate_limited_func from '../../ratelimitedfunc'; import rate_limited_func from '../../ratelimitedfunc';
import ObjectUtils from '../../ObjectUtils'; import * as ObjectUtils from '../../ObjectUtils';
import * as Rooms from '../../Rooms'; import * as Rooms from '../../Rooms';
import eventSearch from '../../Searching'; import eventSearch from '../../Searching';
@ -66,13 +66,13 @@ if (DEBUG) {
debuglog = console.log.bind(console); debuglog = console.log.bind(console);
} }
const RoomContext = PropTypes.shape({ export const RoomContext = PropTypes.shape({
canReact: PropTypes.bool.isRequired, canReact: PropTypes.bool.isRequired,
canReply: PropTypes.bool.isRequired, canReply: PropTypes.bool.isRequired,
room: PropTypes.instanceOf(Room), room: PropTypes.instanceOf(Room),
}); });
module.exports = createReactClass({ export default createReactClass({
displayName: 'RoomView', displayName: 'RoomView',
propTypes: { propTypes: {
ConferenceHandler: PropTypes.any, ConferenceHandler: PropTypes.any,
@ -2002,5 +2002,3 @@ module.exports = createReactClass({
); );
}, },
}); });
module.exports.RoomContext = RoomContext;

View File

@ -84,7 +84,7 @@ if (DEBUG_SCROLL) {
* offset as normal. * offset as normal.
*/ */
module.exports = createReactClass({ export default createReactClass({
displayName: 'ScrollPanel', displayName: 'ScrollPanel',
propTypes: { propTypes: {

View File

@ -24,7 +24,7 @@ import { throttle } from 'lodash';
import AccessibleButton from '../../components/views/elements/AccessibleButton'; import AccessibleButton from '../../components/views/elements/AccessibleButton';
import classNames from 'classnames'; import classNames from 'classnames';
module.exports = createReactClass({ export default createReactClass({
displayName: 'SearchBox', displayName: 'SearchBox',
propTypes: { propTypes: {

View File

@ -19,7 +19,7 @@ limitations under the License.
import * as React from "react"; import * as React from "react";
import {_t} from '../../languageHandler'; import {_t} from '../../languageHandler';
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import sdk from "../../index"; import * as sdk from "../../index";
/** /**
* Represents a tab for the TabbedView. * Represents a tab for the TabbedView.

View File

@ -22,7 +22,7 @@ import TagOrderStore from '../../stores/TagOrderStore';
import GroupActions from '../../actions/GroupActions'; import GroupActions from '../../actions/GroupActions';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';

View File

@ -16,7 +16,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher'; import dis from '../../dispatcher';
import Modal from '../../Modal'; import Modal from '../../Modal';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';

View File

@ -18,22 +18,19 @@ limitations under the License.
*/ */
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import React, {createRef} from 'react'; import React, {createRef} from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {EventTimeline} from "matrix-js-sdk";
const Matrix = require("matrix-js-sdk"); import * as Matrix from "matrix-js-sdk";
const EventTimeline = Matrix.EventTimeline;
const sdk = require('../../index');
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
const MatrixClientPeg = require("../../MatrixClientPeg"); import {MatrixClientPeg} from "../../MatrixClientPeg";
const dis = require("../../dispatcher"); import * as ObjectUtils from "../../ObjectUtils";
const ObjectUtils = require('../../ObjectUtils'); import UserActivity from "../../UserActivity";
const Modal = require("../../Modal"); import Modal from "../../Modal";
const UserActivity = require("../../UserActivity"); import dis from "../../dispatcher";
import * as sdk from "../../index";
import { KeyCode } from '../../Keyboard'; import { KeyCode } from '../../Keyboard';
import Timer from '../../utils/Timer'; import Timer from '../../utils/Timer';
import shouldHideEvent from '../../shouldHideEvent'; import shouldHideEvent from '../../shouldHideEvent';
@ -1347,4 +1344,4 @@ const TimelinePanel = createReactClass({
}, },
}); });
module.exports = TimelinePanel; export default TimelinePanel;

View File

@ -19,8 +19,8 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {TopLeftMenu} from '../views/context_menus/TopLeftMenu'; import {TopLeftMenu} from '../views/context_menus/TopLeftMenu';
import BaseAvatar from '../views/avatars/BaseAvatar'; import BaseAvatar from '../views/avatars/BaseAvatar';
import MatrixClientPeg from '../../MatrixClientPeg'; import {MatrixClientPeg} from '../../MatrixClientPeg';
import Avatar from '../../Avatar'; import * as Avatar from '../../Avatar';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
import dis from "../../dispatcher"; import dis from "../../dispatcher";
import {ContextMenu, ContextMenuButton} from "./ContextMenu"; import {ContextMenu, ContextMenuButton} from "./ContextMenu";

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -18,11 +19,11 @@ import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ContentMessages from '../../ContentMessages'; import ContentMessages from '../../ContentMessages';
const dis = require('../../dispatcher'); import dis from "../../dispatcher";
const filesize = require('filesize'); import filesize from "filesize";
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
module.exports = createReactClass({ export default createReactClass({
displayName: 'UploadBar', displayName: 'UploadBar',
propTypes: { propTypes: {
room: PropTypes.object, room: PropTypes.object,

View File

@ -18,8 +18,8 @@ limitations under the License.
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import Matrix from "matrix-js-sdk"; import Matrix from "matrix-js-sdk";
import MatrixClientPeg from "../../MatrixClientPeg"; import {MatrixClientPeg} from "../../MatrixClientPeg";
import sdk from "../../index"; import * as sdk from "../../index";
import Modal from '../../Modal'; import Modal from '../../Modal';
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';

View File

@ -1,6 +1,7 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,10 +21,10 @@ import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import SyntaxHighlight from '../views/elements/SyntaxHighlight'; import SyntaxHighlight from '../views/elements/SyntaxHighlight';
import {_t} from "../../languageHandler"; import {_t} from "../../languageHandler";
import sdk from "../../index"; import * as sdk from "../../index";
module.exports = createReactClass({ export default createReactClass({
displayName: 'ViewSource', displayName: 'ViewSource',
propTypes: { propTypes: {

View File

@ -20,7 +20,7 @@ import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import sdk from '../../../index'; import * as sdk from '../../../index';
import Modal from "../../../Modal"; import Modal from "../../../Modal";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import PasswordReset from "../../../PasswordReset"; import PasswordReset from "../../../PasswordReset";
@ -40,7 +40,7 @@ const PHASE_EMAIL_SENT = 3;
// User has clicked the link in email and completed reset // User has clicked the link in email and completed reset
const PHASE_DONE = 4; const PHASE_DONE = 4;
module.exports = createReactClass({ export default createReactClass({
displayName: 'ForgotPassword', displayName: 'ForgotPassword',
propTypes: { propTypes: {

View File

@ -20,7 +20,7 @@ import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {_t, _td} from '../../../languageHandler'; import {_t, _td} from '../../../languageHandler';
import sdk from '../../../index'; import * as sdk from '../../../index';
import Login from '../../../Login'; import Login from '../../../Login';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import { messageForResourceLimitError } from '../../../utils/ErrorUtils'; import { messageForResourceLimitError } from '../../../utils/ErrorUtils';
@ -54,7 +54,7 @@ _td("General failure");
/** /**
* A wire component which glues together login UI components and Login logic * A wire component which glues together login UI components and Login logic
*/ */
module.exports = createReactClass({ export default createReactClass({
displayName: 'Login', displayName: 'Login',
propTypes: { propTypes: {

View File

@ -17,12 +17,12 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import * as sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg'; import {MatrixClientPeg} from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import AuthPage from "../../views/auth/AuthPage"; import AuthPage from "../../views/auth/AuthPage";
module.exports = createReactClass({ export default createReactClass({
displayName: 'PostRegistration', displayName: 'PostRegistration',
propTypes: { propTypes: {

View File

@ -21,7 +21,7 @@ import Matrix from 'matrix-js-sdk';
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { _t, _td } from '../../../languageHandler'; import { _t, _td } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import { messageForResourceLimitError } from '../../../utils/ErrorUtils'; import { messageForResourceLimitError } from '../../../utils/ErrorUtils';
@ -29,7 +29,7 @@ import * as ServerType from '../../views/auth/ServerTypeSelector';
import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
import classNames from "classnames"; import classNames from "classnames";
import * as Lifecycle from '../../../Lifecycle'; import * as Lifecycle from '../../../Lifecycle';
import MatrixClientPeg from "../../../MatrixClientPeg"; import {MatrixClientPeg} from "../../../MatrixClientPeg";
import AuthPage from "../../views/auth/AuthPage"; import AuthPage from "../../views/auth/AuthPage";
// Phases // Phases
@ -41,7 +41,7 @@ const PHASE_REGISTRATION = 1;
// Enable phases for registration // Enable phases for registration
const PHASES_ENABLED = true; const PHASES_ENABLED = true;
module.exports = createReactClass({ export default createReactClass({
displayName: 'Registration', displayName: 'Registration',
propTypes: { propTypes: {

View File

@ -17,11 +17,11 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {_t} from '../../../languageHandler'; import {_t} from '../../../languageHandler';
import sdk from '../../../index'; import * as sdk from '../../../index';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
import * as Lifecycle from '../../../Lifecycle'; import * as Lifecycle from '../../../Lifecycle';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import MatrixClientPeg from "../../../MatrixClientPeg"; import {MatrixClientPeg} from "../../../MatrixClientPeg";
import {sendLoginRequest} from "../../../Login"; import {sendLoginRequest} from "../../../Login";
import url from 'url'; import url from 'url';
import AuthPage from "../../views/auth/AuthPage"; import AuthPage from "../../views/auth/AuthPage";

View File

@ -1,6 +1,7 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 New Vector 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with 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 React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
module.exports = createReactClass({ export default createReactClass({
displayName: 'AuthFooter', displayName: 'AuthFooter',
render: function() { render: function() {

View File

@ -17,9 +17,9 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import sdk from '../../../index'; import * as sdk from '../../../index';
module.exports = createReactClass({ export default createReactClass({
displayName: 'AuthHeader', displayName: 'AuthHeader',
render: function() { render: function() {

View File

@ -17,7 +17,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import sdk from '../../../index'; import * as sdk from '../../../index';
import {replaceableComponent} from "../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../utils/replaceableComponent";
@replaceableComponent("views.auth.AuthPage") @replaceableComponent("views.auth.AuthPage")

View File

@ -24,7 +24,7 @@ const DIV_ID = 'mx_recaptcha';
/** /**
* A pure UI component which displays a captcha form. * A pure UI component which displays a captcha form.
*/ */
module.exports = createReactClass({ export default createReactClass({
displayName: 'CaptchaForm', displayName: 'CaptchaForm',
propTypes: { propTypes: {

View File

@ -17,7 +17,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { COUNTRIES } from '../../../phonenumber'; import { COUNTRIES } from '../../../phonenumber';
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";

View File

@ -19,7 +19,7 @@ import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
module.exports = createReactClass({ export default createReactClass({
displayName: 'CustomServerDialog', displayName: 'CustomServerDialog',
render: function() { render: function() {

View File

@ -22,7 +22,7 @@ import PropTypes from 'prop-types';
import url from 'url'; import url from 'url';
import classnames from 'classnames'; import classnames from 'classnames';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";

View File

@ -18,7 +18,7 @@ import SdkConfig from "../../../SdkConfig";
import {getCurrentLanguage} from "../../../languageHandler"; import {getCurrentLanguage} from "../../../languageHandler";
import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore";
import PlatformPeg from "../../../PlatformPeg"; import PlatformPeg from "../../../PlatformPeg";
import sdk from '../../../index'; import * as sdk from '../../../index';
import React from 'react'; import React from 'react';
function onChange(newLang) { function onChange(newLang) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";

View File

@ -19,7 +19,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";

View File

@ -20,8 +20,8 @@ limitations under the License.
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import * as sdk from '../../../index';
import Email from '../../../email'; import * as Email from '../../../email';
import { looksValid as phoneNumberLooksValid } from '../../../phonenumber'; import { looksValid as phoneNumberLooksValid } from '../../../phonenumber';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
@ -41,7 +41,7 @@ const PASSWORD_MIN_SCORE = 3; // safely unguessable: moderate protection from of
/** /**
* A pure UI component which displays a registration form. * A pure UI component which displays a registration form.
*/ */
module.exports = createReactClass({ export default createReactClass({
displayName: 'RegistrationForm', displayName: 'RegistrationForm',
propTypes: { propTypes: {

View File

@ -19,12 +19,12 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import sdk from '../../../index'; import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils"; import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import { createClient } from 'matrix-js-sdk/lib/matrix'; import { createClient } from 'matrix-js-sdk/src/matrix';
import classNames from 'classnames'; import classNames from 'classnames';
/* /*

View File

@ -17,7 +17,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import sdk from '../../../index'; import * as sdk from '../../../index';
import classnames from 'classnames'; import classnames from 'classnames';
import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
import {makeType} from "../../../utils/TypeUtils"; import {makeType} from "../../../utils/TypeUtils";

Some files were not shown because too many files have changed in this diff Show More