diff --git a/.editorconfig b/.editorconfig index 880331a09e5..56631484cd5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,3 +21,6 @@ insert_final_newline = true indent_style = space indent_size = 4 trim_trailing_whitespace = true + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.github/workflows/element-build-and-test.yaml b/.github/workflows/element-build-and-test.yaml index 1633aae2609..9b3d0f373a0 100644 --- a/.github/workflows/element-build-and-test.yaml +++ b/.github/workflows/element-build-and-test.yaml @@ -3,47 +3,100 @@ # as an artifact and run integration tests. name: Element Web - Build and Test on: - pull_request: + pull_request: { } + push: + branches: [ develop, master ] + repository_dispatch: + types: [ upstream-sdk-notify ] +env: + # These must be set for fetchdep.sh to get the right branch + REPOSITORY: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} jobs: - build: - runs-on: ubuntu-latest + build: + name: "Build Element-Web" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v3 + with: + cache: 'yarn' + + - name: Fetch layered build + 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 env: - # This must be set for fetchdep.sh to get the right branch - PR_NUMBER: ${{github.event.number}} - steps: - - uses: actions/checkout@v2 - - name: Build - run: scripts/ci/layered.sh && cd element-web && cp element.io/develop/config.json config.json && CI_PACKAGE=true yarn build - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - name: previewbuild - path: element-web/webapp - # We'll only use this in a triggered job, then we're done with it - retention-days: 1 - cypress: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Download build - uses: actions/download-artifact@v3 - with: - name: previewbuild - path: webapp - - name: Run Cypress tests - uses: cypress-io/github-action@v2 - with: - # The built in Electron runner seems to grind to a halt trying - # to run the tests, so use chrome. - browser: chrome - start: npx serve -p 8080 webapp - - name: Upload Artifact - if: failure() - uses: actions/upload-artifact@v2 - with: - name: cypress-results - path: | - cypress/screenshots - cypress/videos - cypress/synapselogs + CI_PACKAGE: true + VERSION: "${{ steps.layered_build.outputs.VERSION }}" + run: yarn build + working-directory: ./element-web + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: previewbuild + path: element-web/webapp + # We'll only use this in a triggered job, then we're done with it + retention-days: 1 + + cypress: + name: "Cypress End to End Tests" + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Download build + uses: actions/download-artifact@v3 + with: + name: previewbuild + path: webapp + + - name: Run Cypress tests + uses: cypress-io/github-action@v2 + with: + # The built in Electron runner seems to grind to a halt trying + # to run the tests, so use chrome. + browser: chrome + start: npx serve -p 8080 webapp + record: true + env: + # pass the Dashboard record key as an environment variable + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + # pass GitHub token to allow accurately detecting a build vs a re-run build + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Artifact + if: failure() + uses: actions/upload-artifact@v2 + with: + name: cypress-results + path: | + cypress/screenshots + cypress/videos + cypress/synapselogs + + app-tests: + name: Element Web Integration Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v3 + with: + cache: 'yarn' + + - name: Run tests + run: "./scripts/ci/app-tests.sh" diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml new file mode 100644 index 00000000000..22a92bf0b56 --- /dev/null +++ b/.github/workflows/pull_request.yaml @@ -0,0 +1,24 @@ +name: Pull Request +on: + pull_request_target: + types: [ opened, edited, labeled, unlabeled ] +jobs: + changelog: + name: Preview Changelog + runs-on: ubuntu-latest + steps: + - uses: matrix-org/allchange@main + with: + ghToken: ${{ secrets.GITHUB_TOKEN }} + + enforce-label: + name: Enforce Labels + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: yogevbd/enforce-label-action@2.1.0 + with: + REQUIRED_LABELS_ANY: "T-Defect,T-Enhancement,T-Task" + BANNED_LABELS: "X-Blocked" + BANNED_LABELS_DESCRIPTION: "Preventing merge whilst PR is marked blocked!" diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 00000000000..7029be97f3b --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,47 @@ +name: SonarQube +on: + workflow_run: + workflows: [ "Tests" ] + types: + - completed +jobs: + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + # 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: + - name: Download Coverage Report + uses: actions/github-script@v3.1.0 + with: + script: | + const artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + }); + const matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "coverage" + })[0]; + const download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + const fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/coverage.zip', Buffer.from(download.data)); + + - name: Extract Coverage Report + run: unzip -d coverage coverage.zip && rm coverage.zip + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml new file mode 100644 index 00000000000..5e2f27f68b8 --- /dev/null +++ b/.github/workflows/static_analysis.yaml @@ -0,0 +1,107 @@ +name: Static Analysis +on: + pull_request: { } + push: + branches: [ develop, master ] + repository_dispatch: + types: [ upstream-sdk-notify ] +env: + # These must be set for fetchdep.sh to get the right branch + REPOSITORY: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} +jobs: + ts_lint: + name: "Typescript Syntax Check" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v3 + with: + cache: 'yarn' + + - name: Install Deps + run: "./scripts/ci/install-deps.sh --ignore-scripts" + + - name: Typecheck + run: "yarn run lint:types" + + - name: Switch js-sdk to release mode + run: | + scripts/ci/js-sdk-to-release.js + cd node_modules/matrix-js-sdk + yarn install + yarn run build:compile + yarn run build:types + + - name: Typecheck (release mode) + run: "yarn run lint:types" + + i18n_lint: + name: "i18n Check" + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: actions/checkout@v2 + + - name: "Get modified files" + id: changed_files + if: github.event_name == 'pull_request' + uses: tj-actions/changed-files@v19 + with: + files: | + src/i18n/strings/* + files_ignore: | + src/i18n/strings/en_EN.json + + - name: "Assert only en_EN was modified" + if: github.event_name == 'pull_request' && steps.changed_files.outputs.any_modified == 'true' + run: | + echo "You can only modify en_EN.json, do not touch any of the other i18n files as Weblate will be confused" + exit 1 + + - uses: actions/setup-node@v3 + with: + cache: 'yarn' + + # Does not need branch matching as only analyses this layer + - name: Install Deps + run: "yarn install" + + - name: i18n Check + run: "yarn run diff-i18n" + + js_lint: + name: "ESLint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v3 + with: + cache: 'yarn' + + # Does not need branch matching as only analyses this layer + - name: Install Deps + run: "yarn install" + + - name: Run Linter + run: "yarn run lint:js" + + style_lint: + name: "Style Lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v3 + with: + cache: 'yarn' + + # Does not need branch matching as only analyses this layer + - name: Install Deps + run: "yarn install" + + - name: Run Linter + run: "yarn run lint:style" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000000..9fa7a6f7cf1 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,37 @@ +name: Tests +on: + pull_request: { } + push: + branches: [ develop, master ] + repository_dispatch: + types: [ upstream-sdk-notify ] +env: + # These must be set for fetchdep.sh to get the right branch + REPOSITORY: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} +jobs: + jest: + name: Jest + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Yarn cache + uses: actions/setup-node@v3 + with: + cache: 'yarn' + + - name: Install Deps + run: "./scripts/ci/install-deps.sh --ignore-scripts" + + - name: Run tests with coverage + run: "yarn coverage --ci" + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: coverage + path: | + coverage + !coverage/lcov-report diff --git a/CHANGELOG.md b/CHANGELOG.md index 4922bfe9619..da198272a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,77 @@ +Changes in [3.44.0](/~https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.44.0) (2022-05-10) +===================================================================================================== + +## ✨ Features + * Made the location map change the cursor to a pointer so it looks like it's clickable (https ([\#8451](/~https://github.com/matrix-org/matrix-react-sdk/pull/8451)). Fixes vector-im/element-web#21991. Contributed by @Odyssey346. + * Implement improved spacing for the thread list and timeline ([\#8337](/~https://github.com/matrix-org/matrix-react-sdk/pull/8337)). Fixes vector-im/element-web#21759. Contributed by @luixxiul. + * LLS: expose way to enable live sharing labs flag from location dialog ([\#8416](/~https://github.com/matrix-org/matrix-react-sdk/pull/8416)). + * Fix source text boxes in View Source modal should have full width ([\#8425](/~https://github.com/matrix-org/matrix-react-sdk/pull/8425)). Fixes vector-im/element-web#21938. Contributed by @EECvision. + * Read Receipts: never show +1, if it’s just 4, show all of them ([\#8428](/~https://github.com/matrix-org/matrix-react-sdk/pull/8428)). Fixes vector-im/element-web#21935. + * Add opt-in analytics to onboarding tasks ([\#8409](/~https://github.com/matrix-org/matrix-react-sdk/pull/8409)). Fixes vector-im/element-web#21705. + * Allow user to control if they are signed out of all devices when changing password ([\#8259](/~https://github.com/matrix-org/matrix-react-sdk/pull/8259)). Fixes vector-im/element-web#2671. + * Implement new Read Receipt design ([\#8389](/~https://github.com/matrix-org/matrix-react-sdk/pull/8389)). Fixes vector-im/element-web#20574. + * Stick connected video rooms to the top of the room list ([\#8353](/~https://github.com/matrix-org/matrix-react-sdk/pull/8353)). + * LLS: fix jumpy maximised map ([\#8387](/~https://github.com/matrix-org/matrix-react-sdk/pull/8387)). + * Persist audio and video mute state in video rooms ([\#8376](/~https://github.com/matrix-org/matrix-react-sdk/pull/8376)). + * Forcefully disconnect from video rooms on logout and tab close ([\#8375](/~https://github.com/matrix-org/matrix-react-sdk/pull/8375)). + * Add local echo of connected devices in video rooms ([\#8368](/~https://github.com/matrix-org/matrix-react-sdk/pull/8368)). + * Improve text of account deactivation dialog ([\#8371](/~https://github.com/matrix-org/matrix-react-sdk/pull/8371)). Fixes vector-im/element-web#17421. + * Live location sharing: own live beacon status on maximised view ([\#8374](/~https://github.com/matrix-org/matrix-react-sdk/pull/8374)). + * Show a lobby screen in video rooms ([\#8287](/~https://github.com/matrix-org/matrix-react-sdk/pull/8287)). + * Settings toggle to disable Composer Markdown ([\#8358](/~https://github.com/matrix-org/matrix-react-sdk/pull/8358)). Fixes vector-im/element-web#20321. + * Cache localStorage objects for SettingsStore ([\#8366](/~https://github.com/matrix-org/matrix-react-sdk/pull/8366)). + * Bring `View Source` back from behind developer mode ([\#8369](/~https://github.com/matrix-org/matrix-react-sdk/pull/8369)). Fixes vector-im/element-web#21771. + +## πŸ› Bug Fixes + * Fix race conditions around threads ([\#8448](/~https://github.com/matrix-org/matrix-react-sdk/pull/8448)). Fixes vector-im/element-web#21627. + * Fix reading of cached room device setting values ([\#8495](/~https://github.com/matrix-org/matrix-react-sdk/pull/8495)). + * Fix issue with dispatch happening mid-dispatch due to js-sdk emit ([\#8473](/~https://github.com/matrix-org/matrix-react-sdk/pull/8473)). Fixes vector-im/element-web#22019. + * Match MSC behaviour for threads when disabled (thread-aware mode) ([\#8476](/~https://github.com/matrix-org/matrix-react-sdk/pull/8476)). Fixes vector-im/element-web#22033. + * Specify position of DisambiguatedProfile inside a thread on bubble message layout ([\#8452](/~https://github.com/matrix-org/matrix-react-sdk/pull/8452)). Fixes vector-im/element-web#21998. Contributed by @luixxiul. + * Location sharing: do not trackuserlocation in location picker ([\#8466](/~https://github.com/matrix-org/matrix-react-sdk/pull/8466)). Fixes vector-im/element-web#22013. + * fix text and map indent in thread view ([\#8462](/~https://github.com/matrix-org/matrix-react-sdk/pull/8462)). Fixes vector-im/element-web#21997. + * Live location sharing: don't group beacon info with room creation summary ([\#8468](/~https://github.com/matrix-org/matrix-react-sdk/pull/8468)). + * Don't linkify code blocks ([\#7859](/~https://github.com/matrix-org/matrix-react-sdk/pull/7859)). Fixes vector-im/element-web#9613. + * read receipts: improve tooltips to show names of users ([\#8438](/~https://github.com/matrix-org/matrix-react-sdk/pull/8438)). Fixes vector-im/element-web#21940. + * Fix poll overflowing a reply tile on bubble message layout ([\#8459](/~https://github.com/matrix-org/matrix-react-sdk/pull/8459)). Fixes vector-im/element-web#22005. Contributed by @luixxiul. + * Fix text link buttons on UserInfo panel ([\#8247](/~https://github.com/matrix-org/matrix-react-sdk/pull/8247)). Fixes vector-im/element-web#21702. Contributed by @luixxiul. + * Clear local storage settings handler cache on logout ([\#8454](/~https://github.com/matrix-org/matrix-react-sdk/pull/8454)). Fixes vector-im/element-web#21994. + * Fix jump to bottom button being always displayed in non-overflowing timelines ([\#8460](/~https://github.com/matrix-org/matrix-react-sdk/pull/8460)). Fixes vector-im/element-web#22003. + * fix timeline search with empty text box should do nothing ([\#8262](/~https://github.com/matrix-org/matrix-react-sdk/pull/8262)). Fixes vector-im/element-web#21714. Contributed by @EECvision. + * Fixes "space panel kebab menu is rendered out of view on sub spaces" ([\#8350](/~https://github.com/matrix-org/matrix-react-sdk/pull/8350)). Contributed by @yaya-usman. + * Add margin to the location map inside ThreadView ([\#8442](/~https://github.com/matrix-org/matrix-react-sdk/pull/8442)). Fixes vector-im/element-web#21982. Contributed by @luixxiul. + * Patch: "Reloading the registration page should warn about data loss" ([\#8377](/~https://github.com/matrix-org/matrix-react-sdk/pull/8377)). Contributed by @yaya-usman. + * Live location sharing: fix safari timestamps pt 2 ([\#8443](/~https://github.com/matrix-org/matrix-react-sdk/pull/8443)). + * Fix issue with thread notification state ignoring initial events ([\#8417](/~https://github.com/matrix-org/matrix-react-sdk/pull/8417)). Fixes vector-im/element-web#21927. + * Fix event text overflow on bubble message layout ([\#8391](/~https://github.com/matrix-org/matrix-react-sdk/pull/8391)). Fixes vector-im/element-web#21882. Contributed by @luixxiul. + * Disable the message action bar when hovering over the 1px border between threads on the list ([\#8429](/~https://github.com/matrix-org/matrix-react-sdk/pull/8429)). Fixes vector-im/element-web#21955. Contributed by @luixxiul. + * correctly align read receipts to state events in bubble layout ([\#8419](/~https://github.com/matrix-org/matrix-react-sdk/pull/8419)). Fixes vector-im/element-web#21899. + * Fix issue with underfilled timelines when barren of content ([\#8432](/~https://github.com/matrix-org/matrix-react-sdk/pull/8432)). Fixes vector-im/element-web#21930. + * Fix baseline misalignment of thread panel summary by deduplication ([\#8413](/~https://github.com/matrix-org/matrix-react-sdk/pull/8413)). + * Fix editing of non-html replies ([\#8418](/~https://github.com/matrix-org/matrix-react-sdk/pull/8418)). Fixes vector-im/element-web#21928. + * Read Receipts "Fall from the Sky" ([\#8414](/~https://github.com/matrix-org/matrix-react-sdk/pull/8414)). Fixes vector-im/element-web#21888. + * Make read receipts handle nullable roomMembers correctly ([\#8410](/~https://github.com/matrix-org/matrix-react-sdk/pull/8410)). Fixes vector-im/element-web#21896. + * Don't form continuations on either side of a thread root ([\#8408](/~https://github.com/matrix-org/matrix-react-sdk/pull/8408)). Fixes vector-im/element-web#20908. + * Fix centering issue with sticker placeholder ([\#8404](/~https://github.com/matrix-org/matrix-react-sdk/pull/8404)). Fixes vector-im/element-web#18014 and vector-im/element-web#6449. + * Disable download option on