mirror of
https://github.com/element-hq/element-web
synced 2024-11-22 09:15:41 +03:00
Merge branch 'develop' into fix-leave-space-at-bottom
This commit is contained in:
commit
d744de04c1
5 changed files with 27 additions and 30 deletions
|
@ -64,7 +64,7 @@ interface IProps {
|
||||||
continueText?: string;
|
continueText?: string;
|
||||||
continueKind?: string;
|
continueKind?: string;
|
||||||
// callback
|
// callback
|
||||||
makeRequest(auth: IAuthData): Promise<IAuthData>;
|
makeRequest(auth: IAuthData | null): Promise<IAuthData>;
|
||||||
// callback called when the auth process has finished,
|
// callback called when the auth process has finished,
|
||||||
// successfully or unsuccessfully.
|
// successfully or unsuccessfully.
|
||||||
// @param {boolean} status True if the operation requiring
|
// @param {boolean} status True if the operation requiring
|
||||||
|
@ -199,7 +199,7 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
private requestCallback = (auth: IAuthData, background: boolean): Promise<IAuthData> => {
|
private requestCallback = (auth: IAuthData | null, background: boolean): Promise<IAuthData> => {
|
||||||
// This wrapper just exists because the js-sdk passes a second
|
// This wrapper just exists because the js-sdk passes a second
|
||||||
// 'busy' param for backwards compat. This throws the tests off
|
// 'busy' param for backwards compat. This throws the tests off
|
||||||
// so discard it here.
|
// so discard it here.
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AuthType, createClient } from 'matrix-js-sdk/src/matrix';
|
import { AuthType, createClient, IAuthData } from 'matrix-js-sdk/src/matrix';
|
||||||
import React, { Fragment, ReactNode } from 'react';
|
import React, { Fragment, ReactNode } from 'react';
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
@ -443,7 +443,7 @@ export default class Registration extends React.Component<IProps, IState> {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
private makeRegisterRequest = auth => {
|
private makeRegisterRequest = (auth: IAuthData | null) => {
|
||||||
const registerParams = {
|
const registerParams = {
|
||||||
username: this.state.formVals.username,
|
username: this.state.formVals.username,
|
||||||
password: this.state.formVals.password,
|
password: this.state.formVals.password,
|
||||||
|
|
|
@ -115,7 +115,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
|
||||||
this.setState({ errStr: _t("There was a problem communicating with the server. Please try again.") });
|
this.setState({ errStr: _t("There was a problem communicating with the server. Please try again.") });
|
||||||
};
|
};
|
||||||
|
|
||||||
private onUIAuthComplete = (auth: IAuthData): void => {
|
private onUIAuthComplete = (auth: IAuthData | null): void => {
|
||||||
// XXX: this should be returning a promise to maintain the state inside the state machine correct
|
// XXX: this should be returning a promise to maintain the state inside the state machine correct
|
||||||
// but given that a deactivation is followed by a local logout and all object instances being thrown away
|
// but given that a deactivation is followed by a local logout and all object instances being thrown away
|
||||||
// this isn't done.
|
// this isn't done.
|
||||||
|
|
|
@ -221,8 +221,8 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
private zoom(zoomLevel: number, anchorX?: number, anchorY?: number) {
|
private zoom(zoomLevel: number, anchorX?: number, anchorY?: number) {
|
||||||
const oldZoom = this.state.zoom;
|
const oldZoom = this.state.zoom;
|
||||||
const newZoom = Math.min(zoomLevel, this.state.maxZoom);
|
const maxZoom = this.state.maxZoom === this.state.minZoom ? 2 * this.state.maxZoom : this.state.maxZoom;
|
||||||
|
const newZoom = Math.min(zoomLevel, maxZoom);
|
||||||
if (newZoom <= this.state.minZoom) {
|
if (newZoom <= this.state.minZoom) {
|
||||||
// Zoom out fully
|
// Zoom out fully
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -355,9 +355,12 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
// other button than the left one
|
// other button than the left one
|
||||||
if (ev.button !== 0) return;
|
if (ev.button !== 0) return;
|
||||||
|
|
||||||
// Zoom in if we are completely zoomed out
|
// Zoom in if we are completely zoomed out and increase the zoom factor for images
|
||||||
|
// smaller than the viewport size
|
||||||
if (this.state.zoom === this.state.minZoom) {
|
if (this.state.zoom === this.state.minZoom) {
|
||||||
this.zoom(this.state.maxZoom, ev.nativeEvent.offsetX, ev.nativeEvent.offsetY);
|
this.zoom(this.state.maxZoom === this.state.minZoom
|
||||||
|
? 2 * this.state.maxZoom
|
||||||
|
: this.state.maxZoom, ev.nativeEvent.offsetX, ev.nativeEvent.offsetY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +420,6 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const showEventMeta = !!this.props.mxEvent;
|
const showEventMeta = !!this.props.mxEvent;
|
||||||
const zoomingDisabled = this.state.maxZoom === this.state.minZoom;
|
|
||||||
|
|
||||||
let transitionClassName;
|
let transitionClassName;
|
||||||
if (this.animatingLoading) transitionClassName = "mx_ImageView_image_animatingLoading";
|
if (this.animatingLoading) transitionClassName = "mx_ImageView_image_animatingLoading";
|
||||||
|
@ -426,7 +428,6 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
let cursor;
|
let cursor;
|
||||||
if (this.state.moving) cursor = "grabbing";
|
if (this.state.moving) cursor = "grabbing";
|
||||||
else if (zoomingDisabled) cursor = "default";
|
|
||||||
else if (this.state.zoom === this.state.minZoom) cursor = "zoom-in";
|
else if (this.state.zoom === this.state.minZoom) cursor = "zoom-in";
|
||||||
else cursor = "zoom-out";
|
else cursor = "zoom-out";
|
||||||
|
|
||||||
|
@ -516,24 +517,20 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let zoomOutButton;
|
const zoomOutButton = (
|
||||||
let zoomInButton;
|
<AccessibleTooltipButton
|
||||||
if (!zoomingDisabled) {
|
className="mx_ImageView_button mx_ImageView_button_zoomOut"
|
||||||
zoomOutButton = (
|
title={_t("Zoom out")}
|
||||||
<AccessibleTooltipButton
|
onClick={this.onZoomOutClick}
|
||||||
className="mx_ImageView_button mx_ImageView_button_zoomOut"
|
/>
|
||||||
title={_t("Zoom out")}
|
);
|
||||||
onClick={this.onZoomOutClick}
|
const zoomInButton = (
|
||||||
/>
|
<AccessibleTooltipButton
|
||||||
);
|
className="mx_ImageView_button mx_ImageView_button_zoomIn"
|
||||||
zoomInButton = (
|
title={_t("Zoom in")}
|
||||||
<AccessibleTooltipButton
|
onClick={this.onZoomInClick}
|
||||||
className="mx_ImageView_button mx_ImageView_button_zoomIn"
|
/>
|
||||||
title={_t("Zoom in")}
|
);
|
||||||
onClick={this.onZoomInClick}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let title: JSX.Element;
|
let title: JSX.Element;
|
||||||
if (this.props.mxEvent?.getContent()) {
|
if (this.props.mxEvent?.getContent()) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ describe('<IncomingLegacyCallToast />', () => {
|
||||||
const mockRoom = new Room('!room:server.org', mockClient, userId);
|
const mockRoom = new Room('!room:server.org', mockClient, userId);
|
||||||
mockClient.deviceId = deviceId;
|
mockClient.deviceId = deviceId;
|
||||||
|
|
||||||
const call = new MatrixCall({ client: mockClient });
|
const call = new MatrixCall({ client: mockClient, roomId: mockRoom.roomId });
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
call,
|
call,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue