diff --git a/src/ContentMessages.js b/src/ContentMessages.js index fd21977108..a0bf75bccf 100644 --- a/src/ContentMessages.js +++ b/src/ContentMessages.js @@ -153,24 +153,17 @@ function loadVideoElement(videoFile) { // Load the file into an html element const video = document.createElement("video"); - const reader = new FileReader(); - reader.onload = function(e) { - video.src = e.target.result; - - // Once ready, returns its size - // Wait until we have enough data to thumbnail the first frame. - video.onloadeddata = function() { - deferred.resolve(video); - }; - video.onerror = function(e) { - deferred.reject(e); - }; + // Wait until we have enough data to thumbnail the first frame. + video.onloadeddata = function() { + URL.revokeObjectURL(video.src); + deferred.resolve(video); }; - reader.onerror = function(e) { + video.onerror = function(e) { deferred.reject(e); }; - reader.readAsDataURL(videoFile); - + + // We don't use readAsDataURL because massive files and b64 don't mix. + video.src = URL.createObjectURL(videoFile); return deferred.promise; } diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index f5872812de..9865044717 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -109,7 +109,7 @@ class MatrixClientPeg { await promise; } catch (err) { // log any errors when starting up the database (if one exists) - console.error(`Error starting matrixclient store: ${err}`); + console.error('Error starting matrixclient store', err); } // regardless of errors, start the client. If we did error out, we'll diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 38d3b63e1a..96cccf07fb 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -248,8 +248,7 @@ function textForCanonicalAliasEvent(ev) { senderName: senderName, address: ev.getContent().alias, }); - } - else if (oldAlias) { + } else if (oldAlias) { return _t('%(senderName)s removed the main address for this room.', { senderName: senderName, }); diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 156aac2eb8..e9cbf7945b 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -105,11 +105,11 @@ export default class UserProvider extends AutocompleteProvider { // Don't search if the query is a single "@" if (fullMatch && fullMatch !== '@') { completions = this.matcher.match(fullMatch).map((user) => { - const displayName = (user.name || user.userId || '').replace(' (IRC)', ''); // FIXME when groups are done + const displayName = (user.name || user.userId || ''); return { // Length of completion should equal length of text in decorator. draft-js // relies on the length of the entity === length of the text in the decoration. - completion: user.rawDisplayName.replace(' (IRC)', ''), + completion: user.rawDisplayName, completionId: user.userId, suffix: (selection.beginning && range.start === 0) ? ': ' : ' ', href: makeUserPermalink(user.userId), diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 0c4688a411..180a348434 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -319,7 +319,7 @@ const LoggedInView = React.createClass({ ), true); }, - _onClick: function(ev) { + _onMouseDown: function(ev) { // When the panels are disabled, clicking on them results in a mouse event // which bubbles to certain elements in the tree. When this happens, close // any settings page that is currently open (user/room/group). @@ -330,11 +330,37 @@ const LoggedInView = React.createClass({ targetClasses.has('mx_MatrixChat_middlePanel') || targetClasses.has('mx_RoomView') ) { - dis.dispatch({ action: 'close_settings' }); + this.setState({ + mouseDown: { + x: ev.pageX, + y: ev.pageY, + }, + }); } } }, + _onMouseUp: function(ev) { + if (!this.state.mouseDown) return; + + const deltaX = ev.pageX - this.state.mouseDown.x; + const deltaY = ev.pageY - this.state.mouseDown.y; + const distance = Math.sqrt((deltaX * deltaX) + (deltaY + deltaY)); + const maxRadius = 5; // People shouldn't be straying too far, hopefully + + // Note: we track how far the user moved their mouse to help + // combat against https://github.com/vector-im/riot-web/issues/7158 + + if (distance < maxRadius) { + // This is probably a real click, and not a drag + dis.dispatch({ action: 'close_settings' }); + } + + // Always clear the mouseDown state to ensure we don't accidentally + // use stale values due to the mouseDown checks. + this.setState({mouseDown: null}); + }, + render: function() { const LeftPanel = sdk.getComponent('structures.LeftPanel'); const RightPanel = sdk.getComponent('structures.RightPanel'); @@ -478,7 +504,7 @@ const LoggedInView = React.createClass({ } return ( -
+
{ topBar }
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 4d24c429b0..9d7198d5f5 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -48,6 +48,10 @@ import SettingsStore, {SettingLevel} from "../../settings/SettingsStore"; import { startAnyRegistrationFlow } from "../../Registration.js"; import { messageForSyncError } from '../../utils/ErrorUtils'; +// Disable warnings for now: we use deprecated bluebird functions +// and need to migrate, but they spam the console with warnings. +Promise.config({warnings: false}); + /** constants for MatrixChat.state.view */ const VIEWS = { // a special initial state which is only used at startup, while we are diff --git a/src/components/views/elements/Pill.js b/src/components/views/elements/Pill.js index e06ed5a22f..af7e8c4ae3 100644 --- a/src/components/views/elements/Pill.js +++ b/src/components/views/elements/Pill.js @@ -234,7 +234,7 @@ const Pill = React.createClass({ if (member) { userId = member.userId; member.rawDisplayName = member.rawDisplayName || ''; - linkText = member.rawDisplayName.replace(' (IRC)', ''); // FIXME when groups are done + linkText = member.rawDisplayName; if (this.props.shouldShowPillAvatar) { avatar = ; } diff --git a/src/components/views/messages/SenderProfile.js b/src/components/views/messages/SenderProfile.js index 70c9c711fc..be40db50a1 100644 --- a/src/components/views/messages/SenderProfile.js +++ b/src/components/views/messages/SenderProfile.js @@ -109,9 +109,6 @@ export default React.createClass({ this.state.userGroups, this.state.relatedGroups, ); - // Backwards-compatible replacing of "(IRC)" with AS user flair - name = displayedGroups.length > 0 ? name.replace(' (IRC)', '') : name; - flair =