Merge remote-tracking branch 'origin/develop' into dbkr/e2e_backups

This commit is contained in:
David Baker 2018-10-05 14:01:50 +01:00
commit 387128ed1e
10 changed files with 47 additions and 31 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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,
});

View file

@ -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),

View file

@ -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 (
<div className='mx_MatrixChat_wrapper' aria-hidden={this.props.hideToSRUsers} onClick={this._onClick}>
<div className='mx_MatrixChat_wrapper' aria-hidden={this.props.hideToSRUsers} onMouseDown={this._onMouseDown} onMouseUp={this._onMouseUp}>
{ topBar }
<DragDropContext onDragEnd={this._onDragEnd}>
<div className={bodyClasses}>

View file

@ -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

View file

@ -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 = <MemberAvatar member={member} width={16} height={16} />;
}

View file

@ -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 = <Flair key='flair'
userId={mxEvent.getSender()}
groups={displayedGroups}

View file

@ -361,7 +361,7 @@ export default class MessageComposerInput extends React.Component {
const selection = this.getSelectionRange(this.state.editorState);
const member = this.props.room.getMember(payload.user_id);
const completion = member ?
member.rawDisplayName.replace(' (IRC)', '') : payload.user_id;
member.rawDisplayName : payload.user_id;
this.setDisplayedCompletion({
completion,
completionId: payload.user_id,

View file

@ -48,9 +48,6 @@ export default function createMatrixClient(opts) {
}
if (indexedDB && localStorage) {
// FIXME: bodge to remove old database. Remove this after a few weeks.
indexedDB.deleteDatabase("matrix-js-sdk:default");
storeOpts.store = new Matrix.IndexedDBStore({
indexedDB: indexedDB,
dbName: "riot-web-sync",