diff --git a/.github/workflows/element-build-and-test.yaml b/.github/workflows/element-build-and-test.yaml index 905dbedb067..2bb95d1c0e1 100644 --- a/.github/workflows/element-build-and-test.yaml +++ b/.github/workflows/element-build-and-test.yaml @@ -23,14 +23,23 @@ jobs: cache: 'yarn' - name: Fetch layered build - run: scripts/ci/layered.sh + id: layered_build + run: | + scripts/ci/layered.sh + JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD) + REACT_SHA=$(git rev-parse --short=12 HEAD) + VECTOR_SHA=$(git -C element-web rev-parse --short=12 HEAD) + echo "::set-output name=VERSION::$VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA" - name: Copy config run: cp element.io/develop/config.json config.json working-directory: ./element-web - name: Build - run: CI_PACKAGE=true yarn build + env: + CI_PACKAGE: true + VERSION: "${{ steps.layered_build.outputs.VERSION }}" + run: yarn build working-directory: ./element-web - name: Upload Artifact diff --git a/.github/workflows/netlify.yaml b/.github/workflows/netlify.yaml index 1acb7e8fd14..ac869121cda 100644 --- a/.github/workflows/netlify.yaml +++ b/.github/workflows/netlify.yaml @@ -7,26 +7,36 @@ on: types: - completed jobs: - build: + deploy: runs-on: ubuntu-latest - if: > - ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }} + if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' steps: - name: "πŸ” Read PR number" id: readctx - # we need to find the PR number that corresponds to the branch, which we do by - # searching the GH API + # We need to find the PR number that corresponds to the branch, which we do by searching the GH API # The workflow_run event includes a list of pull requests, but it doesn't get populated for # forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run run: | head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}' - echo "head branch: $head_branch" + echo "Head branch: $head_branch" pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)" pr_number=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" | jq -r '.[] | .number') echo "PR number: $pr_number" echo "::set-output name=prnumber::$pr_number" + - name: Create Deployment ID + uses: altinukshini/deployment-action@v1.2.6 + id: deployment + with: + token: "${{ secrets.ELEMENT_BOT_TOKEN }}" + pr: true + pr_id: ${{ steps.readctx.outputs.prnumber }} + transient_environment: true + environment: Netlify + initial_status: in_progress + ref: ${{ github.event.workflow_run.head_sha }} + # There's a 'download artifact' action but it hasn't been updated for the # workflow_run action (https://github.com/actions/download-artifact/issues/60) # so instead we get this mess: @@ -69,12 +79,25 @@ jobs: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} timeout-minutes: 1 - - name: Edit PR Description - uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Update deployment status (success) + if: success() + uses: altinukshini/deployment-status@v1.0.1 + with: + token: "${{ secrets.ELEMENT_BOT_TOKEN }}" + environment_url: ${{ steps.netlify.outputs.deploy-url }} + state: "success" + deployment_id: ${{ steps.deployment.outputs.deployment_id }} + pr: true + pr_id: ${{ steps.readctx.outputs.prnumber }} + description: | + Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. + Exercise caution. Use test accounts. + - name: Update deployment status (failure) + if: failure() + uses: altinukshini/deployment-status@v1.0.1 with: - pull-request-number: ${{ steps.readctx.outputs.prnumber }} - description-message: | - Preview: ${{ steps.netlify.outputs.deploy-url }} - ⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts. + token: "${{ secrets.ELEMENT_BOT_TOKEN }}" + state: "failure" + deployment_id: ${{ steps.deployment.outputs.deployment_id }} + pr: true + pr_id: ${{ steps.readctx.outputs.prnumber }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0126f1f369f..841a7360a10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,54 @@ +Changes in [3.43.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.43.0) (2022-04-26) +===================================================================================================== + +## ✨ Features + * Improve performance of switching to rooms with lots of servers and ACLs ([\#8347](https://github.com/matrix-org/matrix-react-sdk/pull/8347)). + * Avoid a reflow when setting caret position on an empty composer ([\#8348](https://github.com/matrix-org/matrix-react-sdk/pull/8348)). + * Add message right-click context menu as a labs feature ([\#5672](https://github.com/matrix-org/matrix-react-sdk/pull/5672)). + * Live location sharing - basic maximised beacon map ([\#8310](https://github.com/matrix-org/matrix-react-sdk/pull/8310)). + * Live location sharing - render users own beacons in timeline ([\#8296](https://github.com/matrix-org/matrix-react-sdk/pull/8296)). + * Improve Threads beta around degraded mode ([\#8318](https://github.com/matrix-org/matrix-react-sdk/pull/8318)). + * Live location sharing - beacon in timeline happy path ([\#8285](https://github.com/matrix-org/matrix-react-sdk/pull/8285)). + * Add copy button to View Source screen ([\#8278](https://github.com/matrix-org/matrix-react-sdk/pull/8278)). Fixes vector-im/element-web#21482. Contributed by @olivialivia. + * Add heart effect ([\#6188](https://github.com/matrix-org/matrix-react-sdk/pull/6188)). Contributed by @CicadaCinema. + * Update new room icon ([\#8239](https://github.com/matrix-org/matrix-react-sdk/pull/8239)). + +## πŸ› Bug Fixes + * Fix: "Code formatting button does not escape backticks" ([\#8181](https://github.com/matrix-org/matrix-react-sdk/pull/8181)). Contributed by @yaya-usman. + * Fix beta indicator dot causing excessive CPU usage ([\#8340](https://github.com/matrix-org/matrix-react-sdk/pull/8340)). Fixes vector-im/element-web#21793. + * Fix overlapping timestamps on empty messages ([\#8205](https://github.com/matrix-org/matrix-react-sdk/pull/8205)). Fixes vector-im/element-web#21381. Contributed by @goelesha. + * Fix power selector not showing up in user info when state_default undefined ([\#8297](https://github.com/matrix-org/matrix-react-sdk/pull/8297)). Fixes vector-im/element-web#21669. + * Avoid looking up settings during timeline rendering ([\#8313](https://github.com/matrix-org/matrix-react-sdk/pull/8313)). Fixes vector-im/element-web#21740. + * Fix a soft crash with video rooms ([\#8333](https://github.com/matrix-org/matrix-react-sdk/pull/8333)). + * Fixes call tiles overflow ([\#8096](https://github.com/matrix-org/matrix-react-sdk/pull/8096)). Fixes vector-im/element-web#20254. Contributed by @luixxiul. + * Fix a bug with emoji autocomplete sorting where adding the final ":" would cause the emoji with the typed shortcode to no longer be at the top of the autocomplete list. ([\#8086](https://github.com/matrix-org/matrix-react-sdk/pull/8086)). Fixes vector-im/element-web#19302. Contributed by @commonlawfeature. + * Fix image preview sizing for edge cases ([\#8322](https://github.com/matrix-org/matrix-react-sdk/pull/8322)). Fixes vector-im/element-web#20088. + * Refactor SecurityRoomSettingsTab and remove unused state ([\#8306](https://github.com/matrix-org/matrix-react-sdk/pull/8306)). Fixes matrix-org/element-web-rageshakes#12002. + * Don't show the prompt to enable desktop notifications immediately after registration ([\#8274](https://github.com/matrix-org/matrix-react-sdk/pull/8274)). + * Stop tracking threads if threads support is disabled ([\#8308](https://github.com/matrix-org/matrix-react-sdk/pull/8308)). Fixes vector-im/element-web#21766. + * Fix some issues with threads rendering ([\#8305](https://github.com/matrix-org/matrix-react-sdk/pull/8305)). Fixes vector-im/element-web#21670. + * Fix threads rendering issue in Safari ([\#8298](https://github.com/matrix-org/matrix-react-sdk/pull/8298)). Fixes vector-im/element-web#21757. + * Fix space panel width change on hovering over space item ([\#8299](https://github.com/matrix-org/matrix-react-sdk/pull/8299)). Fixes vector-im/element-web#19891. + * Hide the reply in thread button in deployments where beta is forcibly disabled ([\#8294](https://github.com/matrix-org/matrix-react-sdk/pull/8294)). Fixes vector-im/element-web#21753. + * Prevent soft crash around room list header context menu when space changes ([\#8289](https://github.com/matrix-org/matrix-react-sdk/pull/8289)). Fixes matrix-org/element-web-rageshakes#11416, matrix-org/element-web-rageshakes#11692, matrix-org/element-web-rageshakes#11739, matrix-org/element-web-rageshakes#11772, matrix-org/element-web-rageshakes#11891 matrix-org/element-web-rageshakes#11858 and matrix-org/element-web-rageshakes#11456. + * When selecting reply in thread on a thread response open existing thread ([\#8291](https://github.com/matrix-org/matrix-react-sdk/pull/8291)). Fixes vector-im/element-web#21743. + * Handle thread bundled relationships coming from the server via MSC3666 ([\#8292](https://github.com/matrix-org/matrix-react-sdk/pull/8292)). Fixes vector-im/element-web#21450. + * Fix: Avatar preview does not update when same file is selected repeatedly ([\#8288](https://github.com/matrix-org/matrix-react-sdk/pull/8288)). Fixes vector-im/element-web#20098. + * Fix a bug where user gets a warning when changing powerlevel from **Admin** to **custom level (100)** ([\#8248](https://github.com/matrix-org/matrix-react-sdk/pull/8248)). Fixes vector-im/element-web#21682. Contributed by @Jumeb. + * Use a consistent alignment for all text items in a list ([\#8276](https://github.com/matrix-org/matrix-react-sdk/pull/8276)). Fixes vector-im/element-web#21731. Contributed by @luixxiul. + * Fixes button labels being collapsed per a character in CJK languages ([\#8212](https://github.com/matrix-org/matrix-react-sdk/pull/8212)). Fixes vector-im/element-web#21287. Contributed by @luixxiul. + * Fix: Remove jittery timeline scrolling after jumping to an event ([\#8263](https://github.com/matrix-org/matrix-react-sdk/pull/8263)). + * Fix regression of edits showing up in the timeline with hidden events shown ([\#8260](https://github.com/matrix-org/matrix-react-sdk/pull/8260)). Fixes vector-im/element-web#21694. + * Fix reporting events not working ([\#8257](https://github.com/matrix-org/matrix-react-sdk/pull/8257)). Fixes vector-im/element-web#21713. + * Make Jitsi widgets in video rooms immutable ([\#8244](https://github.com/matrix-org/matrix-react-sdk/pull/8244)). Fixes vector-im/element-web#21647. + * Fix: Ensure links to events scroll the correct events into view ([\#8250](https://github.com/matrix-org/matrix-react-sdk/pull/8250)). Fixes vector-im/element-web#19934. + +Changes in [3.42.4](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.42.4) (2022-04-14) +===================================================================================================== + +## πŸ› Bug Fixes + * Fixes around threads beta in degraded mode ([\#8319](https://github.com/matrix-org/matrix-react-sdk/pull/8319)). Fixes vector-im/element-web#21762. + Changes in [3.42.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.42.3) (2022-04-12) ===================================================================================================== @@ -477,7 +528,7 @@ Changes in [3.39.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/ ===================================================================================================== ## πŸ› Bug Fixes - * Fix the sticker picker ([\#7692](https://github.com/matrix-org/matrix-react-sdk/pull/7692)). Fixes vector-im/element-web#20797. + * Fix the sticker picker ([\#7692](https://github.com/matrix-org/matrix-react-sdk/pull/7692)). Fixes vector-im/element-web#20797. * Ensure UserInfo can be rendered without a room ([\#7687](https://github.com/matrix-org/matrix-react-sdk/pull/7687)). Fixes vector-im/element-web#20830. * Fix publishing address wrongly demanding the alias be available ([\#7690](https://github.com/matrix-org/matrix-react-sdk/pull/7690)). Fixes vector-im/element-web#12013 and vector-im/element-web#20833. @@ -1336,7 +1387,7 @@ Changes in [3.32.1](https://github.com/vector-im/element-desktop/releases/tag/v3 ## πŸ› Bug Fixes * Upgrade to matrix-js-sdk#14.0.1 - + Changes in [3.32.0](https://github.com/vector-im/element-desktop/releases/tag/v3.32.0) (2021-10-11) =================================================================================================== @@ -2482,7 +2533,7 @@ related to file upload. When uploading a file, the local file preview can lead to execution of scripts embedded in the uploaded file, but only after several user interactions to open the preview in a separate tab. This only impacts the local user while in the process of uploading. It cannot be exploited remotely -or by other users. Thanks to [Muhammad Zaid Ghifari](https://github.com/MR-ZHEEV) +or by other users. Thanks to [Muhammad Zaid Ghifari](https://github.com/MR-ZHEEV) for responsibly disclosing this via Matrix's Security Disclosure Policy. ## All changes @@ -6477,7 +6528,7 @@ Changes in [2.1.0-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/ ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.1.0-rc.1...v2.1.0-rc.2) - * Fix error in previous attempt to upgrade JS SDK + * Fix error in previous attempt to upgrade JS SDK Changes in [2.1.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.1.0-rc.1) (2020-02-13) ============================================================================================================= diff --git a/package.json b/package.json index 987c12eb06d..c62184810c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.42.3", + "version": "3.43.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { @@ -22,7 +22,7 @@ "README.md", "package.json" ], - "main": "./src/index.ts", + "main": "./lib/index.ts", "matrix_src_main": "./src/index.ts", "matrix_lib_main": "./lib/index.ts", "matrix_lib_typings": "./lib/index.d.ts", @@ -88,7 +88,7 @@ "linkifyjs": "^4.0.0-beta.4", "lodash": "^4.17.20", "maplibre-gl": "^1.15.2", - "matrix-analytics-events": "github:matrix-org/matrix-analytics-events.git#daad3faed54f0b1f1e026a7498b4653e4d01cd90", + "matrix-analytics-events": "github:matrix-org/matrix-analytics-events.git#4aef17b56798639906f26a8739043a3c5c5fde7e", "matrix-encrypt-attachment": "^1.0.3", "matrix-events-sdk": "^0.0.1-beta.7", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", @@ -236,5 +236,6 @@ "text", "json" ] - } + }, + "typings": "./lib/index.d.ts" } diff --git a/src/components/structures/HomePage.tsx b/src/components/structures/HomePage.tsx index fdcb52a6878..ddba1c81d71 100644 --- a/src/components/structures/HomePage.tsx +++ b/src/components/structures/HomePage.tsx @@ -34,13 +34,15 @@ import Analytics from "../../Analytics"; import PosthogTrackers from "../../PosthogTrackers"; import EmbeddedPage from "./EmbeddedPage"; -const onClickSendDm = () => { +const onClickSendDm = (ev: ButtonEvent) => { Analytics.trackEvent('home_page', 'button', 'dm'); + PosthogTrackers.trackInteraction("WebHomeCreateChatButton", ev); dis.dispatch({ action: 'view_create_chat' }); }; -const onClickExplore = () => { +const onClickExplore = (ev: ButtonEvent) => { Analytics.trackEvent('home_page', 'button', 'room_directory'); + PosthogTrackers.trackInteraction("WebHomeExploreRoomsButton", ev); dis.fire(Action.ViewRoomDirectory); }; diff --git a/src/components/structures/LeftPanel.tsx b/src/components/structures/LeftPanel.tsx index 9b4e98e66cb..ed1f990c3f8 100644 --- a/src/components/structures/LeftPanel.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -43,6 +43,8 @@ import SettingsStore from "../../settings/SettingsStore"; import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts"; import { shouldShowComponent } from "../../customisations/helpers/UIComponents"; import { UIComponent } from "../../settings/UIFeature"; +import { ButtonEvent } from "../views/elements/AccessibleButton"; +import PosthogTrackers from "../../PosthogTrackers"; interface IProps { isMinimized: boolean; @@ -116,8 +118,9 @@ export default class LeftPanel extends React.Component { dis.fire(Action.OpenDialPad); }; - private onExplore = () => { + private onExplore = (ev: ButtonEvent) => { dis.fire(Action.ViewRoomDirectory); + PosthogTrackers.trackInteraction("WebLeftPanelExploreRoomsButton", ev); }; private refreshStickyHeaders = () => { diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index 8600da90475..38d18e92f76 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -92,9 +92,13 @@ export function shouldFormContinuation( mxEvent.sender.name !== prevEvent.sender.name || mxEvent.sender.getMxcAvatarUrl() !== prevEvent.sender.getMxcAvatarUrl()) return false; - // Thread summaries in the main timeline should break up a continuation - if (threadsEnabled && prevEvent.isThreadRoot && - timelineRenderingType !== TimelineRenderingType.Thread) return false; + // Thread summaries in the main timeline should break up a continuation on both sides + if (threadsEnabled && + (mxEvent.isThreadRoot || prevEvent.isThreadRoot) && + timelineRenderingType !== TimelineRenderingType.Thread + ) { + return false; + } // if we don't have tile for previous event then it was shown by showHiddenEvents and has no SenderProfile if (!haveRendererForEvent(prevEvent, showHiddenEvents)) return false; diff --git a/src/components/views/avatars/MemberAvatar.tsx b/src/components/views/avatars/MemberAvatar.tsx index 09400b7e21d..76dc9e69621 100644 --- a/src/components/views/avatars/MemberAvatar.tsx +++ b/src/components/views/avatars/MemberAvatar.tsx @@ -30,7 +30,7 @@ import SettingsStore from "../../../settings/SettingsStore"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; interface IProps extends Omit, "name" | "idName" | "url"> { - member: RoomMember; + member: RoomMember | null; fallbackUserId?: string; width: number; height: number; @@ -107,8 +107,16 @@ export default class MemberAvatar extends React.PureComponent { } render() { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - let { member, fallbackUserId, onClick, viewUserOnClick, forceHistorical, ...otherProps } = this.props; + let { + member, + fallbackUserId, + onClick, + viewUserOnClick, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + forceHistorical, + hideTitle, + ...otherProps + } = this.props; const userId = member ? member.userId : fallbackUserId; if (viewUserOnClick) { @@ -125,7 +133,7 @@ export default class MemberAvatar extends React.PureComponent {
- { roomMember.rawDisplayName ?? userId } + { roomMember?.rawDisplayName ?? userId }
{ userId } @@ -203,7 +204,11 @@ function ReadReceiptPerson({ userId, roomMember, ts, isTwelveHour, onAfterClick onClick={() => { dis.dispatch({ action: Action.ViewUser, - member: roomMember, + // XXX: We should be using a real member object and not assuming what the receiver wants. + // The ViewUser action leads to the RightPanelStore, and RightPanelStoreIPanelState defines the + // member property of IRightPanelCardState as `RoomMember | User`, so we’re fine for now, but we + // should definitely clean this up later + member: roomMember ?? { userId } as User, push: false, }); onAfterClick?.(); @@ -225,7 +230,7 @@ function ReadReceiptPerson({ userId, roomMember, ts, isTwelveHour, onAfterClick hideTitle />
-

{ roomMember.name }

+

{ roomMember?.name ?? userId }

{ formatDate(new Date(ts), isTwelveHour) }

diff --git a/src/components/views/rooms/ReadReceiptMarker.tsx b/src/components/views/rooms/ReadReceiptMarker.tsx index bf218c0ddb8..934fd7af7ab 100644 --- a/src/components/views/rooms/ReadReceiptMarker.tsx +++ b/src/components/views/rooms/ReadReceiptMarker.tsx @@ -22,6 +22,7 @@ import { logger } from "matrix-js-sdk/src/logger"; import NodeAnimator from "../../../NodeAnimator"; import { toPx } from "../../../utils/units"; import MemberAvatar from '../avatars/MemberAvatar'; +import { READ_AVATAR_SIZE } from "./ReadReceiptGroup"; export interface IReadReceiptInfo { top?: number; @@ -31,7 +32,7 @@ export interface IReadReceiptInfo { interface IProps { // the RoomMember to show the RR for - member?: RoomMember; + member?: RoomMember | null; // userId to fallback the avatar to // if the member hasn't been loaded yet fallbackUserId: string; @@ -101,10 +102,7 @@ export default class ReadReceiptMarker extends React.PureComponent } { showInviteUsers && dispatcher.dispatch({ action: 'view_create_chat' })} + onClick={(e) => { + dispatcher.dispatch({ action: 'view_create_chat' }); + PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuCreateChatItem", e); + }} className="mx_RoomSublist_auxButton" tooltipClassName="mx_RoomSublist_addRoomTooltip" aria-label={_t("Start chat")} @@ -300,6 +304,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => { e.preventDefault(); e.stopPropagation(); closeMenu(); + PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuExploreRoomsItem", e); defaultDispatcher.fire(Action.ViewRoomDirectory); }} /> @@ -496,9 +501,10 @@ export default class RoomList extends React.PureComponent { } }; - private onStartChat = () => { + private onStartChat = (ev: ButtonEvent) => { const initialText = RoomListStore.instance.getFirstNameFilterCondition()?.search; defaultDispatcher.dispatch({ action: "view_create_chat", initialText }); + PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuCreateChatItem", ev); }; private onExplore = (ev: ButtonEvent) => { @@ -512,6 +518,7 @@ export default class RoomList extends React.PureComponent { } else { const initialText = RoomListStore.instance.getFirstNameFilterCondition()?.search; defaultDispatcher.dispatch({ action: Action.ViewRoomDirectory, initialText }); + PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuExploreRoomsItem", ev); } }; diff --git a/src/components/views/rooms/RoomListHeader.tsx b/src/components/views/rooms/RoomListHeader.tsx index 6a892df2386..b8ac024b918 100644 --- a/src/components/views/rooms/RoomListHeader.tsx +++ b/src/components/views/rooms/RoomListHeader.tsx @@ -297,6 +297,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => { e.preventDefault(); e.stopPropagation(); defaultDispatcher.dispatch({ action: "view_create_chat" }); + PosthogTrackers.trackInteraction("WebRoomListHeaderPlusMenuCreateChatItem", e); closePlusMenu(); }} /> @@ -335,6 +336,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => { e.preventDefault(); e.stopPropagation(); defaultDispatcher.dispatch({ action: Action.ViewRoomDirectory }); + PosthogTrackers.trackInteraction("WebRoomListHeaderPlusMenuExploreRoomsItem", e); closePlusMenu(); }} /> diff --git a/src/editor/deserialize.ts b/src/editor/deserialize.ts index 57ef52cafd3..c6c9fc35200 100644 --- a/src/editor/deserialize.ts +++ b/src/editor/deserialize.ts @@ -16,12 +16,14 @@ limitations under the License. */ import { MatrixEvent } from "matrix-js-sdk/src/models/event"; +import { MsgType } from "matrix-js-sdk/src/@types/event"; import { checkBlockNode } from "../HtmlUtils"; import { getPrimaryPermalinkEntity } from "../utils/permalinks/Permalinks"; import { Part, PartCreator, Type } from "./parts"; import SdkConfig from "../SdkConfig"; import { textToHtmlRainbow } from "../utils/colour"; +import { stripPlainReply } from "../utils/Reply"; const LIST_TYPES = ["UL", "OL", "LI"]; @@ -288,7 +290,7 @@ export function parsePlainTextMessage( export function parseEvent(event: MatrixEvent, pc: PartCreator, opts: IParseOptions = { shouldEscape: true }) { const content = event.getContent(); let parts: Part[]; - const isEmote = content.msgtype === "m.emote"; + const isEmote = content.msgtype === MsgType.Emote; let isRainbow = false; if (content.format === "org.matrix.custom.html") { @@ -297,7 +299,11 @@ export function parseEvent(event: MatrixEvent, pc: PartCreator, opts: IParseOpti isRainbow = true; } } else { - parts = parsePlainTextMessage(content.body || "", pc, opts); + let body = content.body || ""; + if (event.replyEventId) { + body = stripPlainReply(body); + } + parts = parsePlainTextMessage(body, pc, opts); } if (isEmote && isRainbow) { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index bf101a8fd36..7223ad37922 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -907,8 +907,8 @@ "Jump to date (adds /jumptodate and jump to date headers)": "Jump to date (adds /jumptodate and jump to date headers)", "Don't send read receipts": "Don't send read receipts", "Right-click message context menu": "Right-click message context menu", - "Location sharing - pin drop (under active development)": "Location sharing - pin drop (under active development)", - "Live location sharing - share current location (active development, and temporarily, locations persist in room history)": "Live location sharing - share current location (active development, and temporarily, locations persist in room history)", + "Location sharing - pin drop": "Location sharing - pin drop", + "Live Location Sharing (temporary implementation: locations persist in room history)": "Live Location Sharing (temporary implementation: locations persist in room history)", "Font size": "Font size", "Use custom size": "Use custom size", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index d9bd0817a4f..e4247908ddf 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -433,7 +433,7 @@ export const SETTINGS: {[setting: string]: ISetting} = { isFeature: true, labsGroup: LabGroup.Messaging, supportedLevels: LEVELS_FEATURE, - displayName: _td("Location sharing - pin drop (under active development)"), + displayName: _td("Location sharing - pin drop"), default: false, }, "feature_location_share_live": { @@ -441,8 +441,7 @@ export const SETTINGS: {[setting: string]: ISetting} = { labsGroup: LabGroup.Messaging, supportedLevels: LEVELS_FEATURE, displayName: _td( - `Live location sharing - share current location ` + - `(active development, and temporarily, locations persist in room history)`, + "Live Location Sharing (temporary implementation: locations persist in room history)", ), default: false, }, diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index eca8c39bec9..4b2d5499361 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -674,6 +674,20 @@ describe('MessagePanel', function() { describe("shouldFormContinuation", () => { it("does not form continuations from thread roots", () => { + const message1 = TestUtilsMatrix.mkMessage({ + event: true, + room: "!room:id", + user: "@user:id", + msg: "Here is a message in the main timeline", + }); + + const message2 = TestUtilsMatrix.mkMessage({ + event: true, + room: "!room:id", + user: "@user:id", + msg: "And here's another message in the main timeline", + }); + const threadRoot = TestUtilsMatrix.mkMessage({ event: true, room: "!room:id", @@ -682,14 +696,15 @@ describe("shouldFormContinuation", () => { }); jest.spyOn(threadRoot, "isThreadRoot", "get").mockReturnValue(true); - const message = TestUtilsMatrix.mkMessage({ + const message3 = TestUtilsMatrix.mkMessage({ event: true, room: "!room:id", user: "@user:id", - msg: "And here's another message in the main timeline", + msg: "And here's another message in the main timeline after the thread root", }); - expect(shouldFormContinuation(threadRoot, message, false, true)).toEqual(false); - expect(shouldFormContinuation(message, threadRoot, false, true)).toEqual(true); + expect(shouldFormContinuation(message1, message2, false, true)).toEqual(true); + expect(shouldFormContinuation(message2, threadRoot, false, true)).toEqual(false); + expect(shouldFormContinuation(threadRoot, message3, false, true)).toEqual(false); }); }); diff --git a/test/editor/deserialize-test.ts b/test/editor/deserialize-test.ts index 47ab6cb2f27..a6713b3139a 100644 --- a/test/editor/deserialize-test.ts +++ b/test/editor/deserialize-test.ts @@ -20,7 +20,7 @@ import { createPartCreator } from "./mock"; const FOUR_SPACES = " ".repeat(4); -function htmlMessage(formattedBody, msgtype = "m.text") { +function htmlMessage(formattedBody: string, msgtype = "m.text") { return { getContent() { return { @@ -32,7 +32,7 @@ function htmlMessage(formattedBody, msgtype = "m.text") { } as unknown as MatrixEvent; } -function textMessage(body, msgtype = "m.text") { +function textMessage(body: string, msgtype = "m.text") { return { getContent() { return { @@ -43,6 +43,13 @@ function textMessage(body, msgtype = "m.text") { } as unknown as MatrixEvent; } +function textMessageReply(body: string, msgtype = "m.text") { + return { + ...textMessage(body, msgtype), + replyEventId: "!foo:bar", + } as unknown as MatrixEvent; +} + function mergeAdjacentParts(parts) { let prevPart; for (let i = 0; i < parts.length; ++i) { @@ -404,5 +411,14 @@ describe('editor/deserialize', function() { text: "> no formatting here", }); }); + it("it strips plaintext replies", () => { + const body = "> Sender: foo\n\nMessage"; + const parts = normalize(parseEvent(textMessageReply(body), createPartCreator(), { shouldEscape: false })); + expect(parts.length).toBe(1); + expect(parts[0]).toStrictEqual({ + type: "plain", + text: "Message", + }); + }); }); }); diff --git a/yarn.lock b/yarn.lock index 703b4a218db..5e5e4838c3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6629,9 +6629,9 @@ mathml-tag-names@^2.1.3: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -"matrix-analytics-events@github:matrix-org/matrix-analytics-events.git#daad3faed54f0b1f1e026a7498b4653e4d01cd90": +"matrix-analytics-events@github:matrix-org/matrix-analytics-events.git#4aef17b56798639906f26a8739043a3c5c5fde7e": version "0.0.1" - resolved "https://codeload.github.com/matrix-org/matrix-analytics-events/tar.gz/daad3faed54f0b1f1e026a7498b4653e4d01cd90" + resolved "https://codeload.github.com/matrix-org/matrix-analytics-events/tar.gz/4aef17b56798639906f26a8739043a3c5c5fde7e" matrix-encrypt-attachment@^1.0.3: version "1.0.3" @@ -6644,8 +6644,8 @@ matrix-events-sdk@^0.0.1-beta.7: integrity sha512-9jl4wtWanUFSy2sr2lCjErN/oC8KTAtaeaozJtrgot1JiQcEI4Rda9OLgQ7nLKaqb4Z/QUx/fR3XpDzm5Jy1JA== "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": - version "17.0.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/db58a66e19608683682a780c777c606af68bc205" + version "17.1.0" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/3649cf46d3435f5b9ff8f60d17f9402c41638dd4" dependencies: "@babel/runtime" "^7.12.5" another-json "^0.2.0"