Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 4ea3fbc

Browse files
committed
Add comments and newlines back and resolve merge conflicts
2 parents 1f77048 + 7ac12d1 commit 4ea3fbc

File tree

19 files changed

+493
-263
lines changed

19 files changed

+493
-263
lines changed

CHANGELOG.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,115 @@
1+
Changes in [3.20.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.20.0) (2021-05-10)
2+
=====================================================================================================
3+
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.20.0-rc.1...v3.20.0)
4+
5+
* Upgrade to JS SDK 10.1.0
6+
* [Release] Don't use the event's metadata to calc the scale of an image
7+
[\#6004](https://github.com/matrix-org/matrix-react-sdk/pull/6004)
8+
9+
Changes in [3.20.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.20.0-rc.1) (2021-05-04)
10+
===============================================================================================================
11+
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.19.0...v3.20.0-rc.1)
12+
13+
* Upgrade to JS SDK 10.1.0-rc.1
14+
* Translations update from Weblate
15+
[\#5966](https://github.com/matrix-org/matrix-react-sdk/pull/5966)
16+
* Fix more space panel layout and hover behaviour issues
17+
[\#5965](https://github.com/matrix-org/matrix-react-sdk/pull/5965)
18+
* Fix edge case with space panel alignment with subspaces on ff
19+
[\#5964](https://github.com/matrix-org/matrix-react-sdk/pull/5964)
20+
* Fix saving room pill part to history
21+
[\#5951](https://github.com/matrix-org/matrix-react-sdk/pull/5951)
22+
* Generate room preview even when minimized
23+
[\#5948](https://github.com/matrix-org/matrix-react-sdk/pull/5948)
24+
* Another change from recovery passphrase to Security Phrase
25+
[\#5934](https://github.com/matrix-org/matrix-react-sdk/pull/5934)
26+
* Sort rooms in the add existing to space dialog based on recency
27+
[\#5943](https://github.com/matrix-org/matrix-react-sdk/pull/5943)
28+
* Inhibit sending RR when context switching to a room
29+
[\#5944](https://github.com/matrix-org/matrix-react-sdk/pull/5944)
30+
* Prevent room list keyboard handling from landing focus on hidden nodes
31+
[\#5950](https://github.com/matrix-org/matrix-react-sdk/pull/5950)
32+
* Make the text filter search all spaces instead of just the selected one
33+
[\#5942](https://github.com/matrix-org/matrix-react-sdk/pull/5942)
34+
* Enable indent rule and fix indent
35+
[\#5931](https://github.com/matrix-org/matrix-react-sdk/pull/5931)
36+
* Prevent peeking members from reacting
37+
[\#5946](https://github.com/matrix-org/matrix-react-sdk/pull/5946)
38+
* Disallow inline display maths
39+
[\#5939](https://github.com/matrix-org/matrix-react-sdk/pull/5939)
40+
* Space creation prompt user to add existing rooms for "Just Me" spaces
41+
[\#5923](https://github.com/matrix-org/matrix-react-sdk/pull/5923)
42+
* Add test coverage collection script
43+
[\#5937](https://github.com/matrix-org/matrix-react-sdk/pull/5937)
44+
* Fix joining room using via servers regression
45+
[\#5936](https://github.com/matrix-org/matrix-react-sdk/pull/5936)
46+
* Revert "Fixes the two Todays problem in Redaction"
47+
[\#5938](https://github.com/matrix-org/matrix-react-sdk/pull/5938)
48+
* Handle encoded matrix URLs
49+
[\#5903](https://github.com/matrix-org/matrix-react-sdk/pull/5903)
50+
* Render ignored users setting regardless of if there are any
51+
[\#5860](https://github.com/matrix-org/matrix-react-sdk/pull/5860)
52+
* Fix inserting trailing colon after mention/pill
53+
[\#5830](https://github.com/matrix-org/matrix-react-sdk/pull/5830)
54+
* Fixes the two Todays problem in Redaction
55+
[\#5917](https://github.com/matrix-org/matrix-react-sdk/pull/5917)
56+
* Fix page up/down scrolling only half a page
57+
[\#5920](https://github.com/matrix-org/matrix-react-sdk/pull/5920)
58+
* Voice messages: Composer controls
59+
[\#5935](https://github.com/matrix-org/matrix-react-sdk/pull/5935)
60+
* Support MSC3086 asserted identity
61+
[\#5886](https://github.com/matrix-org/matrix-react-sdk/pull/5886)
62+
* Handle possible edge case with getting stuck in "unsent messages" bar
63+
[\#5930](https://github.com/matrix-org/matrix-react-sdk/pull/5930)
64+
* Fix suggested rooms not showing up regression from room list optimisation
65+
[\#5932](https://github.com/matrix-org/matrix-react-sdk/pull/5932)
66+
* Broadcast language change to ElectronPlatform
67+
[\#5913](https://github.com/matrix-org/matrix-react-sdk/pull/5913)
68+
* Fix VoIP PIP frame color
69+
[\#5701](https://github.com/matrix-org/matrix-react-sdk/pull/5701)
70+
* Convert some Flow-typed files to TypeScript
71+
[\#5912](https://github.com/matrix-org/matrix-react-sdk/pull/5912)
72+
* Initial SpaceStore tests work
73+
[\#5906](https://github.com/matrix-org/matrix-react-sdk/pull/5906)
74+
* Fix issues with space hierarchy in layout and with incompatible servers
75+
[\#5926](https://github.com/matrix-org/matrix-react-sdk/pull/5926)
76+
* Scale all mxc thumbs using device pixel ratio for hidpi
77+
[\#5928](https://github.com/matrix-org/matrix-react-sdk/pull/5928)
78+
* Fix add existing to space dialog no longer showing rooms for public spaces
79+
[\#5918](https://github.com/matrix-org/matrix-react-sdk/pull/5918)
80+
* Disable spaces context switching for when exploring a space
81+
[\#5924](https://github.com/matrix-org/matrix-react-sdk/pull/5924)
82+
* Autofocus search box in the add existing to space dialog
83+
[\#5921](https://github.com/matrix-org/matrix-react-sdk/pull/5921)
84+
* Use label element in add existing to space dialog for easier hit target
85+
[\#5922](https://github.com/matrix-org/matrix-react-sdk/pull/5922)
86+
* Dynamic max and min zoom in the new ImageView
87+
[\#5916](https://github.com/matrix-org/matrix-react-sdk/pull/5916)
88+
* Improve message error states
89+
[\#5897](https://github.com/matrix-org/matrix-react-sdk/pull/5897)
90+
* Check for null room in `VisibilityProvider`
91+
[\#5914](https://github.com/matrix-org/matrix-react-sdk/pull/5914)
92+
* Add unit tests for various collection-based utility functions
93+
[\#5910](https://github.com/matrix-org/matrix-react-sdk/pull/5910)
94+
* Spaces visual fixes
95+
[\#5909](https://github.com/matrix-org/matrix-react-sdk/pull/5909)
96+
* Remove reliance on DOM API to generated message preview
97+
[\#5908](https://github.com/matrix-org/matrix-react-sdk/pull/5908)
98+
* Expand upon voice message event & include overall waveform
99+
[\#5888](https://github.com/matrix-org/matrix-react-sdk/pull/5888)
100+
* Use floats for image background opacity
101+
[\#5905](https://github.com/matrix-org/matrix-react-sdk/pull/5905)
102+
* Show invites to spaces at the top of the space panel
103+
[\#5902](https://github.com/matrix-org/matrix-react-sdk/pull/5902)
104+
* Improve edge cases with spaces context switching
105+
[\#5899](https://github.com/matrix-org/matrix-react-sdk/pull/5899)
106+
* Fix spaces notification dots wrongly including upgraded (hidden) rooms
107+
[\#5900](https://github.com/matrix-org/matrix-react-sdk/pull/5900)
108+
* Iterate the spaces face pile design
109+
[\#5898](https://github.com/matrix-org/matrix-react-sdk/pull/5898)
110+
* Fix alignment issue with nested spaces being cut off wrong
111+
[\#5890](https://github.com/matrix-org/matrix-react-sdk/pull/5890)
112+
1113
Changes in [3.19.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.19.0) (2021-04-26)
2114
=====================================================================================================
3115
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.19.0-rc.1...v3.19.0)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-react-sdk",
3-
"version": "3.19.0",
3+
"version": "3.20.0",
44
"description": "SDK for matrix.org using React",
55
"author": "matrix.org",
66
"repository": {
@@ -97,7 +97,7 @@
9797
"react-transition-group": "^4.4.1",
9898
"resize-observer-polyfill": "^1.5.1",
9999
"rfc4648": "^1.4.0",
100-
"sanitize-html": "github:apostrophecms/sanitize-html#3c7f93f2058f696f5359e3e58d464161647226db",
100+
"sanitize-html": "^2.3.2",
101101
"tar-js": "^0.3.0",
102102
"text-encoding-utf-8": "^1.0.2",
103103
"url": "^0.11.0",

src/components/structures/MessagePanel.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,13 @@ export default class MessagePanel extends React.Component {
545545
}
546546
if (!grouper) {
547547
const wantTile = this._shouldShowEvent(mxEv);
548+
const isGrouped = false;
548549
if (wantTile) {
549550
// make sure we unpack the array returned by _getTilesForEvent,
550551
// otherwise react will auto-generate keys and we will end up
551552
// replacing all of the DOM elements every time we paginate.
552-
ret.push(...this._getTilesForEvent(prevEvent, mxEv, last, nextEvent, nextTile));
553+
ret.push(...this._getTilesForEvent(prevEvent, mxEv, last, isGrouped,
554+
nextEvent, nextTile));
553555
prevEvent = mxEv;
554556
}
555557

@@ -570,7 +572,7 @@ export default class MessagePanel extends React.Component {
570572
_${mxEv.getId()}`) !== null;
571573
}
572574

573-
_getTilesForEvent(prevEvent, mxEv, last, nextEvent, nextEventWithTile) {
575+
_getTilesForEvent(prevEvent, mxEv, last, isGrouped=false, nextEvent, nextEventWithTile) {
574576
const TileErrorBoundary = sdk.getComponent('messages.TileErrorBoundary');
575577
const EventTile = sdk.getComponent('rooms.EventTile');
576578
const DateSeparator = sdk.getComponent('messages.DateSeparator');
@@ -593,7 +595,7 @@ export default class MessagePanel extends React.Component {
593595

594596
// do we need a date separator since the last event?
595597
const wantsDateSeparator = this._wantsDateSeparator(prevEvent, eventDate);
596-
if (wantsDateSeparator) {
598+
if (wantsDateSeparator && !isGrouped) {
597599
const dateSeparator = <li key={ts1}><DateSeparator key={ts1} ts={ts1} /></li>;
598600
ret.push(dateSeparator);
599601
}
@@ -977,9 +979,9 @@ class CreationGrouper {
977979

978980
const DateSeparator = sdk.getComponent('messages.DateSeparator');
979981
const EventListSummary = sdk.getComponent('views.elements.EventListSummary');
980-
981982
const panel = this.panel;
982983
const ret = [];
984+
const isGrouped = true;
983985
const createEvent = this.createEvent;
984986
const lastShownEvent = this.lastShownEvent;
985987

@@ -993,12 +995,12 @@ class CreationGrouper {
993995
// If this m.room.create event should be shown (room upgrade) then show it before the summary
994996
if (panel._shouldShowEvent(createEvent)) {
995997
// pass in the createEvent as prevEvent as well so no extra DateSeparator is rendered
996-
ret.push(...panel._getTilesForEvent(createEvent, createEvent, false));
998+
ret.push(...panel._getTilesForEvent(createEvent, createEvent));
997999
}
9981000

9991001
for (const ejected of this.ejectedEvents) {
10001002
ret.push(...panel._getTilesForEvent(
1001-
createEvent, ejected, createEvent === lastShownEvent,
1003+
createEvent, ejected, createEvent === lastShownEvent, isGrouped,
10021004
));
10031005
}
10041006

@@ -1007,7 +1009,7 @@ class CreationGrouper {
10071009
// of EventListSummary, render each member event as if the previous
10081010
// one was itself. This way, the timestamp of the previous event === the
10091011
// timestamp of the current event, and no DateSeparator is inserted.
1010-
return panel._getTilesForEvent(e, e, e === lastShownEvent);
1012+
return panel._getTilesForEvent(e, e, e === lastShownEvent, isGrouped);
10111013
}).reduce((a, b) => a.concat(b), []);
10121014
// Get sender profile from the latest event in the summary as the m.room.create doesn't contain one
10131015
const ev = this.events[this.events.length - 1];
@@ -1092,7 +1094,7 @@ class RedactionGrouper {
10921094

10931095
const DateSeparator = sdk.getComponent('messages.DateSeparator');
10941096
const EventListSummary = sdk.getComponent('views.elements.EventListSummary');
1095-
1097+
const isGrouped = true;
10961098
const panel = this.panel;
10971099
const ret = [];
10981100
const lastShownEvent = this.lastShownEvent;
@@ -1112,7 +1114,8 @@ class RedactionGrouper {
11121114
let eventTiles = this.events.map((e, i) => {
11131115
senders.add(e.sender);
11141116
const prevEvent = i === 0 ? this.prevEvent : this.events[i - 1];
1115-
return panel._getTilesForEvent(prevEvent, e, e === lastShownEvent, this.nextEvent, this.nextEventTile);
1117+
return panel._getTilesForEvent(
1118+
prevEvent, e, e === lastShownEvent, isGrouped, this.nextEvent, this.nextEventTile);
11161119
}).reduce((a, b) => a.concat(b), []);
11171120

11181121
if (eventTiles.length === 0) {
@@ -1191,7 +1194,7 @@ class MemberGrouper {
11911194

11921195
const DateSeparator = sdk.getComponent('messages.DateSeparator');
11931196
const MemberEventListSummary = sdk.getComponent('views.elements.MemberEventListSummary');
1194-
1197+
const isGrouped = true;
11951198
const panel = this.panel;
11961199
const lastShownEvent = this.lastShownEvent;
11971200
const ret = [];
@@ -1224,7 +1227,7 @@ class MemberGrouper {
12241227
// of MemberEventListSummary, render each member event as if the previous
12251228
// one was itself. This way, the timestamp of the previous event === the
12261229
// timestamp of the current event, and no DateSeparator is inserted.
1227-
return panel._getTilesForEvent(e, e, e === lastShownEvent);
1230+
return panel._getTilesForEvent(e, e, e === lastShownEvent, isGrouped);
12281231
}).reduce((a, b) => a.concat(b), []);
12291232

12301233
if (eventTiles.length === 0) {

src/components/structures/RoomSearch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import { Action } from "../../dispatcher/actions";
2727
import RoomListStore from "../../stores/room-list/RoomListStore";
2828
import { NameFilterCondition } from "../../stores/room-list/filters/NameFilterCondition";
2929
import { getKeyBindingsManager, RoomListAction } from "../../KeyBindingsManager";
30-
import {replaceableComponent} from "../../utils/replaceableComponent";
31-
import SpaceStore, {UPDATE_SELECTED_SPACE, UPDATE_TOP_LEVEL_SPACES} from "../../stores/SpaceStore";
30+
import { replaceableComponent } from "../../utils/replaceableComponent";
31+
import SpaceStore, { UPDATE_SELECTED_SPACE, UPDATE_TOP_LEVEL_SPACES } from "../../stores/SpaceStore";
3232

3333
interface IProps {
3434
isMinimized: boolean;

src/components/views/dialogs/UploadConfirmDialog.js renamed to src/components/views/dialogs/UploadConfirmDialog.tsx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 New Vector Ltd
2+
Copyright 2019, 2021 The Matrix.org Foundation C.I.C.
33
Copyright 2019 Michael Telatynski <[email protected]>
44
55
Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,20 +16,23 @@ limitations under the License.
1616
*/
1717

1818
import React from 'react';
19-
import PropTypes from 'prop-types';
2019
import * as sdk from '../../../index';
2120
import { _t } from '../../../languageHandler';
2221
import filesize from "filesize";
23-
import {replaceableComponent} from "../../../utils/replaceableComponent";
22+
import { replaceableComponent } from "../../../utils/replaceableComponent";
23+
import { getBlobSafeMimeType } from '../../../utils/blobs';
24+
25+
interface IProps {
26+
file: File;
27+
currentIndex: number;
28+
totalFiles?: number;
29+
onFinished: (uploadConfirmed: boolean, uploadAll?: boolean) => void;
30+
}
2431

2532
@replaceableComponent("views.dialogs.UploadConfirmDialog")
26-
export default class UploadConfirmDialog extends React.Component {
27-
static propTypes = {
28-
file: PropTypes.object.isRequired,
29-
currentIndex: PropTypes.number,
30-
totalFiles: PropTypes.number,
31-
onFinished: PropTypes.func.isRequired,
32-
}
33+
export default class UploadConfirmDialog extends React.Component<IProps> {
34+
private objectUrl: string;
35+
private mimeType: string;
3336

3437
static defaultProps = {
3538
totalFiles: 1,
@@ -38,22 +41,28 @@ export default class UploadConfirmDialog extends React.Component {
3841
constructor(props) {
3942
super(props);
4043

41-
this._objectUrl = URL.createObjectURL(props.file);
44+
// Create a fresh `Blob` for previewing (even though `File` already is
45+
// one) so we can adjust the MIME type if needed.
46+
this.mimeType = getBlobSafeMimeType(props.file.type);
47+
const blob = new Blob([props.file], { type:
48+
this.mimeType,
49+
});
50+
this.objectUrl = URL.createObjectURL(blob);
4251
}
4352

4453
componentWillUnmount() {
45-
if (this._objectUrl) URL.revokeObjectURL(this._objectUrl);
54+
if (this.objectUrl) URL.revokeObjectURL(this.objectUrl);
4655
}
4756

48-
_onCancelClick = () => {
57+
private onCancelClick = () => {
4958
this.props.onFinished(false);
5059
}
5160

52-
_onUploadClick = () => {
61+
private onUploadClick = () => {
5362
this.props.onFinished(true);
5463
}
5564

56-
_onUploadAllClick = () => {
65+
private onUploadAllClick = () => {
5766
this.props.onFinished(true, true);
5867
}
5968

@@ -75,10 +84,10 @@ export default class UploadConfirmDialog extends React.Component {
7584
}
7685

7786
let preview;
78-
if (this.props.file.type.startsWith('image/')) {
87+
if (this.mimeType.startsWith('image/')) {
7988
preview = <div className="mx_UploadConfirmDialog_previewOuter">
8089
<div className="mx_UploadConfirmDialog_previewInner">
81-
<div><img className="mx_UploadConfirmDialog_imagePreview" src={this._objectUrl} /></div>
90+
<div><img className="mx_UploadConfirmDialog_imagePreview" src={this.objectUrl} /></div>
8291
<div>{this.props.file.name} ({filesize(this.props.file.size)})</div>
8392
</div>
8493
</div>;
@@ -95,15 +104,15 @@ export default class UploadConfirmDialog extends React.Component {
95104

96105
let uploadAllButton;
97106
if (this.props.currentIndex + 1 < this.props.totalFiles) {
98-
uploadAllButton = <button onClick={this._onUploadAllClick}>
107+
uploadAllButton = <button onClick={this.onUploadAllClick}>
99108
{_t("Upload all")}
100109
</button>;
101110
}
102111

103112
return (
104113
<BaseDialog className='mx_UploadConfirmDialog'
105114
fixedWidth={false}
106-
onFinished={this._onCancelClick}
115+
onFinished={this.onCancelClick}
107116
title={title}
108117
contentId='mx_Dialog_content'
109118
>
@@ -113,7 +122,7 @@ export default class UploadConfirmDialog extends React.Component {
113122

114123
<DialogButtons primaryButton={_t('Upload')}
115124
hasCancel={false}
116-
onPrimaryButtonClick={this._onUploadClick}
125+
onPrimaryButtonClick={this.onUploadClick}
117126
focus={true}
118127
>
119128
{uploadAllButton}

src/components/views/elements/ImageView.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ export default class ImageView extends React.Component<IProps, IState> {
108108
window.addEventListener("resize", this.calculateZoom);
109109
// After the image loads for the first time we want to calculate the zoom
110110
this.image.current.addEventListener("load", this.calculateZoom);
111-
// Try to precalculate the zoom from width and height props
112-
this.calculateZoom();
113111
}
114112

115113
componentWillUnmount() {
@@ -122,11 +120,8 @@ export default class ImageView extends React.Component<IProps, IState> {
122120
const image = this.image.current;
123121
const imageWrapper = this.imageWrapper.current;
124122

125-
const width = this.props.width || image.naturalWidth;
126-
const height = this.props.height || image.naturalHeight;
127-
128-
const zoomX = imageWrapper.clientWidth / width;
129-
const zoomY = imageWrapper.clientHeight / height;
123+
const zoomX = imageWrapper.clientWidth / image.naturalWidth;
124+
const zoomY = imageWrapper.clientHeight / image.naturalHeight;
130125

131126
// If the image is smaller in both dimensions set its the zoom to 1 to
132127
// display it in its original size

0 commit comments

Comments
 (0)