diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 641a4a0a41..ee57bbe4c8 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -84,14 +84,16 @@ jobs: actions: read issues: read pull-requests: read - environment: - Cypress - #strategy: - # fail-fast: false - # matrix: - # # Run 4 instances in Parallel - # runner: [1, 2, 3, 4] + environment: Cypress + strategy: + fail-fast: false + matrix: + # Run 4 instances in Parallel + runner: [1, 2, 3, 4] steps: + - uses: browser-actions/setup-chrome@latest + - run: echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV + - uses: tecolicom/actions-use-apt-tools@v1 with: # Our test suite includes some screenshot tests with unusual diacritics, which are @@ -121,14 +123,12 @@ jobs: with: # The built-in Electron runner seems to grind to a halt trying # to run the tests, so use chrome. - browser: chrome + browser: "${{ env.BROWSER_PATH }}" start: npx serve -p 8080 webapp wait-on: "http://localhost:8080" - record: - true - #parallel: true - #command-prefix: 'yarn percy exec --parallel --' - command-prefix: "yarn percy exec --" + record: true + parallel: true + command-prefix: "yarn percy exec --parallel --" config: '{"reporter":"cypress-multi-reporters", "reporterOptions": { "configFile": "cypress-ci-reporter-config.json" } }' ci-build-id: ${{ needs.prepare.outputs.uuid }} env: @@ -159,9 +159,8 @@ jobs: # tell Percy more details about the context of this run PERCY_BRANCH: ${{ github.event.workflow_run.head_branch }} PERCY_COMMIT: ${{ github.event.workflow_run.head_sha }} - PERCY_PULL_REQUEST: - ${{ needs.prepare.outputs.pr_id }} - #PERCY_PARALLEL_TOTAL: ${{ strategy.job-total }} + PERCY_PULL_REQUEST: ${{ needs.prepare.outputs.pr_id }} + PERCY_PARALLEL_TOTAL: ${{ strategy.job-total }} PERCY_PARALLEL_NONCE: ${{ needs.prepare.outputs.uuid }} - name: Upload Artifact diff --git a/src/stores/RoomViewStore.tsx b/src/stores/RoomViewStore.tsx index 8ad0637672..e9f61afe8c 100644 --- a/src/stores/RoomViewStore.tsx +++ b/src/stores/RoomViewStore.tsx @@ -335,10 +335,11 @@ export class RoomViewStore extends EventEmitter { this.reset(); break; case "reply_to_event": - // If currently viewed room does not match the room in which we wish to reply then change rooms - // this can happen when performing a search across all rooms. Persist the data from this event for - // both room and search timeline rendering types, search will get auto-closed by RoomView at this time. - if ([TimelineRenderingType.Room, TimelineRenderingType.Search].includes(payload.context)) { + // Thread timeline view handles its own reply-to-state + if (TimelineRenderingType.Thread !== payload.context) { + // If currently viewed room does not match the room in which we wish to reply then change rooms this + // can happen when performing a search across all rooms. Persist the data from this event for both + // room and search timeline rendering types, search will get auto-closed by RoomView at this time. if (payload.event && payload.event.getRoomId() !== this.state.roomId) { this.dis.dispatch({ action: Action.ViewRoom, diff --git a/test/stores/RoomViewStore-test.ts b/test/stores/RoomViewStore-test.ts index 30a8cff02c..7c2b1ec81b 100644 --- a/test/stores/RoomViewStore-test.ts +++ b/test/stores/RoomViewStore-test.ts @@ -15,6 +15,7 @@ limitations under the License. */ import { Room } from "matrix-js-sdk/src/matrix"; +import { sleep } from "matrix-js-sdk/src/utils"; import { RoomViewStore } from "../../src/stores/RoomViewStore"; import { Action } from "../../src/dispatcher/actions"; @@ -245,6 +246,28 @@ describe("RoomViewStore", function () { expect(roomViewStore.getRoomId()).toEqual(roomId2); }); + it("should ignore reply_to_event for Thread panels", async () => { + expect(roomViewStore.getQuotingEvent()).toBeFalsy(); + const replyToEvent = { + getRoomId: () => roomId2, + }; + dis.dispatch({ action: "reply_to_event", event: replyToEvent, context: TimelineRenderingType.Thread }); + await sleep(100); + expect(roomViewStore.getQuotingEvent()).toBeFalsy(); + }); + + it.each([TimelineRenderingType.Room, TimelineRenderingType.File, TimelineRenderingType.Notification])( + "Should respect reply_to_event for %s rendering context", + async (context) => { + const replyToEvent = { + getRoomId: () => roomId, + }; + dis.dispatch({ action: "reply_to_event", event: replyToEvent, context }); + await untilDispatch(Action.ViewRoom, dis); + expect(roomViewStore.getQuotingEvent()).toEqual(replyToEvent); + }, + ); + it("removes the roomId on ViewHomePage", async () => { dis.dispatch({ action: Action.ViewRoom, room_id: roomId }); await untilDispatch(Action.ActiveRoomChanged, dis);