diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a22954c3f..34a3498f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Changes in [3.6.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.6.1) (2020-10-20) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.6.0...v3.6.1) + + * [Release] Adjust for new widget messaging APIs + [\#5342](https://github.com/matrix-org/matrix-react-sdk/pull/5342) + * [Release] Fix Jitsi OpenIDC auth + [\#5335](https://github.com/matrix-org/matrix-react-sdk/pull/5335) + Changes in [3.6.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.6.0) (2020-10-12) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.6.0-rc.1...v3.6.0) diff --git a/package.json b/package.json index ee4094601a..bb47fc6401 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.6.0", + "version": "3.6.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { diff --git a/release.sh b/release.sh index e2cefcbe74..4742f00dea 100755 --- a/release.sh +++ b/release.sh @@ -32,9 +32,7 @@ do echo "Upgrading $i to $latestver..." yarn add -E $i@$latestver git add -u - # The `-e` flag opens the editor and gives you a chance to check - # the upgrade for correctness. - git commit -m "Upgrade $i to $latestver" -e + git commit -m "Upgrade $i to $latestver" fi fi done diff --git a/res/css/structures/_UserMenu.scss b/res/css/structures/_UserMenu.scss index fecac40e4e..6a352d46a3 100644 --- a/res/css/structures/_UserMenu.scss +++ b/res/css/structures/_UserMenu.scss @@ -230,6 +230,10 @@ limitations under the License. align-items: center; justify-content: center; } + + &.mx_UserMenu_contextMenu_hostingLink { + padding-top: 0; + } } .mx_IconizedContextMenu_icon { diff --git a/src/Searching.js b/src/Searching.js index b1507e6a49..f65b8920b3 100644 --- a/src/Searching.js +++ b/src/Searching.js @@ -360,7 +360,7 @@ function combineEvents(previousSearchResult, localEvents = undefined, serverEven let oldestEventFrom = previousSearchResult.oldestEventFrom; response.highlights = previousSearchResult.highlights; - if (localEvents && serverEvents) { + if (localEvents && serverEvents && serverEvents.results) { // This is a first search call, combine the events from the server and // the local index. Note where our oldest event came from, we shall // fetch the next batch of events from the other source. @@ -379,7 +379,7 @@ function combineEvents(previousSearchResult, localEvents = undefined, serverEven oldestEventFrom = "local"; } combineEventSources(previousSearchResult, response, localEvents.results, cachedEvents); - } else if (serverEvents) { + } else if (serverEvents && serverEvents.results) { // This is a pagination call fetching more events from the server, // meaning that our oldest event was in the local index. // Change the source of the oldest event if our server event is older @@ -454,7 +454,7 @@ function combineResponses(previousSearchResult, localEvents = undefined, serverE return response; } -function restoreEncryptionInfo(searchResultSlice) { +function restoreEncryptionInfo(searchResultSlice = []) { for (let i = 0; i < searchResultSlice.length; i++) { const timeline = searchResultSlice[i].context.getTimeline(); @@ -517,7 +517,7 @@ async function combinedPagination(searchResult) { }, }; - const oldResultCount = searchResult.results.length; + const oldResultCount = searchResult.results ? searchResult.results.length : 0; // Let the client process the combined result. const result = client._processRoomEventsSearch(searchResult, response); diff --git a/src/components/structures/LeftPanel.tsx b/src/components/structures/LeftPanel.tsx index 262d12a700..00653995c9 100644 --- a/src/components/structures/LeftPanel.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -388,7 +388,6 @@ export default class LeftPanel extends React.Component { const roomList = { }; _createResizer() { - const classNames = { - handle: "mx_ResizeHandle", - vertical: "mx_ResizeHandle_vertical", - reverse: "mx_ResizeHandle_reverse", - }; let size; - const collapseConfig = { + const collapseConfig: ICollapseConfig = { toggleSize: 260 - 50, onCollapsed: (collapsed) => { if (collapsed) { @@ -234,7 +230,11 @@ class LoggedInView extends React.Component { }, }; const resizer = new Resizer(this._resizeContainer.current, CollapseDistributor, collapseConfig); - resizer.setClassNames(classNames); + resizer.setClassNames({ + handle: "mx_ResizeHandle", + vertical: "mx_ResizeHandle_vertical", + reverse: "mx_ResizeHandle_reverse", + }); return resizer; } diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 38021d46ea..4b2fa67c1c 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1277,7 +1277,7 @@ export default class RoomView extends React.Component { } if (!this.state.searchResults.next_batch) { - if (this.state.searchResults.results.length == 0) { + if (!this.state.searchResults?.results?.length) { ret.push(
  • { _t("No results") }

  • , @@ -1301,7 +1301,7 @@ export default class RoomView extends React.Component { let lastRoomId; - for (let i = this.state.searchResults.results.length - 1; i >= 0; i--) { + for (let i = (this.state.searchResults?.results?.length || 0) - 1; i >= 0; i--) { const result = this.state.searchResults.results[i]; const mxEv = result.context.getEvent(); @@ -1970,7 +1970,7 @@ export default class RoomView extends React.Component { if (this.state.searchResults) { // show searching spinner - if (this.state.searchResults.results === undefined) { + if (this.state.searchResults.count === undefined) { searchResultsPanel = (
    ); diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 81d25e6a0c..cdf1d8e543 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -257,7 +257,7 @@ export default class UserMenu extends React.Component { const signupLink = getHostingLink("user-context-menu"); if (signupLink) { hostingLink = ( -
    +
    {_t( "Upgrade to your own domain", {}, { diff --git a/src/components/views/rooms/RoomList.tsx b/src/components/views/rooms/RoomList.tsx index 92bbdfeacb..3a4d27e666 100644 --- a/src/components/views/rooms/RoomList.tsx +++ b/src/components/views/rooms/RoomList.tsx @@ -53,7 +53,6 @@ interface IProps { onBlur: (ev: React.FocusEvent) => void; onResize: () => void; resizeNotifier: ResizeNotifier; - collapsed: boolean; isMinimized: boolean; } @@ -366,7 +365,7 @@ export default class RoomList extends React.PureComponent { public render() { let explorePrompt: JSX.Element; - if (RoomListStore.instance.getFirstNameFilterCondition()) { + if (!this.props.isMinimized && RoomListStore.instance.getFirstNameFilterCondition()) { explorePrompt =
    {_t("Can't see what you’re looking for?")}
    diff --git a/src/resizer/distributors/collapse.ts b/src/resizer/distributors/collapse.ts index c4b53d5892..ddf3bd687e 100644 --- a/src/resizer/distributors/collapse.ts +++ b/src/resizer/distributors/collapse.ts @@ -1,5 +1,5 @@ /* -Copyright 2019 New Vector Ltd +Copyright 2019 - 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,9 +16,10 @@ limitations under the License. import FixedDistributor from "./fixed"; import ResizeItem from "../item"; -import {IConfig} from "../resizer"; +import Resizer, {IConfig} from "../resizer"; +import Sizer from "../sizer"; -interface ICollapseConfig extends IConfig { +export interface ICollapseConfig extends IConfig { toggleSize: number; onCollapsed?(collapsed: boolean, id: string, element: HTMLElement): void; } @@ -33,17 +34,16 @@ class CollapseItem extends ResizeItem { } export default class CollapseDistributor extends FixedDistributor { - static createItem(resizeHandle, resizer, sizer) { + static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer) { return new CollapseItem(resizeHandle, resizer, sizer); } private readonly toggleSize: number; - private isCollapsed: boolean; + private isCollapsed = false; constructor(item: CollapseItem) { super(item); this.toggleSize = item.resizer?.config?.toggleSize; - this.isCollapsed = false; } public resize(newSize: number) { diff --git a/src/resizer/distributors/fixed.ts b/src/resizer/distributors/fixed.ts index 9f987e7b24..64f1c5015b 100644 --- a/src/resizer/distributors/fixed.ts +++ b/src/resizer/distributors/fixed.ts @@ -1,5 +1,5 @@ /* -Copyright 2019 New Vector Ltd +Copyright 2019 - 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -29,11 +29,11 @@ they have two methods: This method usually ends up calling `resize` once the start offset is subtracted. */ export default class FixedDistributor = ResizeItem> { - static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer) { + static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer): ResizeItem { return new ResizeItem(resizeHandle, resizer, sizer); } - static createSizer(containerElement: HTMLElement, vertical: boolean, reverse: boolean) { + static createSizer(containerElement: HTMLElement, vertical: boolean, reverse: boolean): Sizer { return new Sizer(containerElement, vertical, reverse); } diff --git a/src/resizer/index.ts b/src/resizer/index.ts index e3624f76ac..9199fc2657 100644 --- a/src/resizer/index.ts +++ b/src/resizer/index.ts @@ -1,5 +1,4 @@ /* -Copyright 2018 New Vector Ltd Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/resizer/item.ts b/src/resizer/item.ts index 4fe47544cb..3be290f15e 100644 --- a/src/resizer/item.ts +++ b/src/resizer/item.ts @@ -1,6 +1,5 @@ /* -Copyright 2019 New Vector Ltd -Copyright 2020 The Matrix.org Foundation C.I.C. +Copyright 2019 - 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Sizer from "./sizer"; import Resizer, {IConfig} from "./resizer"; +import Sizer from "./sizer"; export default class ResizeItem { public readonly domNode: HTMLElement; @@ -28,38 +27,31 @@ export default class ResizeItem { public readonly resizer: Resizer, public readonly sizer: Sizer, ) { - const id = handle.getAttribute("data-id"); - const reverse = resizer.isReverseResizeHandle(handle); - - this.domNode = (reverse ? handle.nextElementSibling : handle.previousElementSibling); - this.id = id; - this.reverse = reverse; - this.resizer = resizer; - this.sizer = sizer; + this.reverse = resizer.isReverseResizeHandle(handle); + this.domNode = (this.reverse ? handle.nextElementSibling : handle.previousElementSibling); + this.id = handle.getAttribute("data-id"); } - private copyWith(handle: Element, resizer: Resizer, sizer: Sizer) { + private copyWith(handle: HTMLElement, resizer: Resizer, sizer: Sizer) { const Ctor = this.constructor as typeof ResizeItem; - return new Ctor(handle, resizer, sizer); + return new Ctor(handle, resizer, sizer); } private advance(forwards: boolean) { // opposite direction from fromResizeHandle to get back to handle - let handle = (this.reverse ? - this.domNode.previousElementSibling : - this.domNode.nextElementSibling); + let handle = this.reverse ? this.domNode.previousElementSibling : this.domNode.nextElementSibling; const moveNext = forwards !== this.reverse; // xor // iterate at least once to avoid infinite loop do { if (moveNext) { - handle = handle.nextElementSibling; + handle = handle.nextElementSibling; } else { - handle = handle.previousElementSibling; + handle = handle.previousElementSibling; } - } while (handle && !this.resizer.isResizeHandle(handle)); + } while (handle && !this.resizer.isResizeHandle(handle)); if (handle) { - const nextHandle = this.copyWith(handle, this.resizer, this.sizer); + const nextHandle = this.copyWith(handle, this.resizer, this.sizer); nextHandle.reverse = this.reverse; return nextHandle; } @@ -118,7 +110,7 @@ export default class ResizeItem { return this.resizer.isResizeHandle(el); }); if (firstHandle) { - return this.copyWith(firstHandle, this.resizer, this.sizer); + return this.copyWith(firstHandle, this.resizer, this.sizer); } } @@ -127,7 +119,7 @@ export default class ResizeItem { return this.resizer.isResizeHandle(el); }); if (lastHandle) { - return this.copyWith(lastHandle, this.resizer, this.sizer); + return this.copyWith(lastHandle, this.resizer, this.sizer); } } } diff --git a/src/resizer/resizer.ts b/src/resizer/resizer.ts index 322c8fe0a1..c7c7edcd11 100644 --- a/src/resizer/resizer.ts +++ b/src/resizer/resizer.ts @@ -1,6 +1,5 @@ /* -Copyright 2018 New Vector Ltd -Copyright 2019, 2020 The Matrix.org Foundation C.I.C. +Copyright 2018 - 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,28 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* -classNames: - // class on resize-handle - handle: string - // class on resize-handle - reverse: string - // class on resize-handle - vertical: string - // class on container - resizing: string -*/ - import {throttle} from "lodash"; import FixedDistributor from "./distributors/fixed"; -import Sizer from "./sizer"; import ResizeItem from "./item"; +import Sizer from "./sizer"; interface IClassNames { + // class on resize-handle handle?: string; + // class on resize-handle reverse?: string; + // class on resize-handle vertical?: string; + // class on container resizing?: string; } @@ -90,7 +81,7 @@ export default class Resizer { Gives the distributor for a specific resize handle, as if you would have started to drag that handle. Can be used to manipulate the size of an item programmatically. @param {number} handleIndex the index of the resize handle in the container - @return {Distributor} a new distributor for the given handle + @return {FixedDistributor} a new distributor for the given handle */ public forHandleAt(handleIndex: number): FixedDistributor { const handles = this.getResizeHandles(); @@ -121,7 +112,7 @@ export default class Resizer { private onMouseDown = (event: MouseEvent) => { // use closest in case the resize handle contains // child dom nodes that can be the target - const resizeHandle = event.target && (event.target).closest(`.${this.classNames.handle}`); + const resizeHandle = event.target && (event.target).closest(`.${this.classNames.handle}`); if (!resizeHandle || resizeHandle.parentElement !== this.container) { return; } diff --git a/src/resizer/sizer.ts b/src/resizer/sizer.ts index d5cc524320..4de8bb9221 100644 --- a/src/resizer/sizer.ts +++ b/src/resizer/sizer.ts @@ -1,5 +1,5 @@ /* -Copyright 2018 New Vector Ltd +Copyright 2018 - 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,13 +57,13 @@ export default class Sizer { } /** @return {number} container offset to document */ - private getPageOffset() { + private getPageOffset(): number { let element = this.container; let offset = 0; while (element) { const pos = this.vertical ? element.offsetTop : element.offsetLeft; offset = offset + pos; - element = element.offsetParent as HTMLElement; + element = element.offsetParent; } return offset; } diff --git a/yarn.lock b/yarn.lock index a06e8bc62d..cb38828d0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6507,7 +6507,7 @@ mathml-tag-names@^2.0.1: "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "8.5.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/d8c4101fdd521e189f4755c6f02a8971b991ef5f" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/9f713781cdfea2349115ffaac2d665e8b07fd5dc" dependencies: "@babel/runtime" "^7.11.2" another-json "^0.2.0"