Merge branch 'develop' of https://github.com/vector-im/element-web into t3chguy/dedup-icons-17oct

# Conflicts:
#	.editorconfig
#	.eslintignore
#	.git-blame-ignore-revs
#	.github/PULL_REQUEST_TEMPLATE.md
#	.github/labels.yml
#	.github/release-drafter.yml
#	.github/workflows/backport.yml
#	.github/workflows/release-gitflow.yml
#	.github/workflows/release.yml
#	.github/workflows/static_analysis.yaml
#	.gitignore
#	.lintstagedrc
#	.npmignore
#	.prettierignore
#	CHANGELOG.md
#	CONTRIBUTING.md
#	LICENSE-AGPL-3.0
#	README.md
#	babel.config.js
#	docs/SUMMARY.md
#	docs/jitsi.md
#	jest.config.ts
#	localazy.json
#	package.json
#	playwright/snapshots/forgot-password/forgot-password.spec.ts/forgot-password-linux.png
#	playwright/snapshots/spaces/spaces.spec.ts/space-panel-collapsed-linux.png
#	release_config.yaml
#	res/css/structures/_RoomSearch.pcss
#	res/fonts/Open_Sans/LICENSE.txt
#	res/jitsi_external_api.min.js.LICENSE.txt
#	sonar-project.properties
#	src/@types/global.d.ts
#	src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx
#	src/components/structures/AutocompleteInput.tsx
#	src/components/structures/ErrorMessage.tsx
#	src/components/structures/auth/ForgotPassword.tsx
#	src/components/structures/auth/forgot-password/EnterEmail.tsx
#	src/components/views/elements/AppPermission.tsx
#	src/components/views/elements/AppTile.tsx
#	src/components/views/messages/DecryptionFailureBody.tsx
#	src/components/views/messages/MessageActionBar.tsx
#	src/components/views/rooms/EntityTile.tsx
#	src/components/views/spaces/QuickSettingsButton.tsx
#	src/voice-broadcast/components/atoms/VoiceBroadcastError.tsx
#	src/voice-broadcast/components/atoms/VoiceBroadcastRecordingConnectionError.tsx
#	tsconfig.json
#	yarn.lock
This commit is contained in:
Michael Telatynski
2024-10-17 10:42:13 +01:00
1033 changed files with 12391 additions and 26154 deletions
+3
View File
@@ -17,5 +17,8 @@ trim_trailing_whitespace = true
[*.{yml,yaml}] [*.{yml,yaml}]
indent_size = 4 indent_size = 4
[package.json]
indent_size = 2
[*.tsx.snap] [*.tsx.snap]
trim_trailing_whitespace = false trim_trailing_whitespace = false
+3
View File
@@ -1,6 +1,9 @@
src/vector/modernizr.js
test/end-to-end-tests/node_modules/ test/end-to-end-tests/node_modules/
test/end-to-end-tests/element/ test/end-to-end-tests/element/
test/end-to-end-tests/synapse/ test/end-to-end-tests/synapse/
test/end-to-end-tests/lib/ test/end-to-end-tests/lib/
# Legacy skinning file that some people might still have # Legacy skinning file that some people might still have
src/component-index.js src/component-index.js
# Auto-generated file
src/modules.ts
-12
View File
@@ -45,24 +45,12 @@ module.exports = {
name: "matrix-js-sdk/src/index", name: "matrix-js-sdk/src/index",
message: "Please use matrix-js-sdk/src/matrix instead", message: "Please use matrix-js-sdk/src/matrix instead",
}, },
{
name: "matrix-react-sdk",
message: "Please use matrix-react-sdk/src/index instead",
},
{
name: "matrix-react-sdk/",
message: "Please use matrix-react-sdk/src/index instead",
},
], ],
patterns: [ patterns: [
{ {
group: ["matrix-js-sdk/lib", "matrix-js-sdk/lib/", "matrix-js-sdk/lib/**"], group: ["matrix-js-sdk/lib", "matrix-js-sdk/lib/", "matrix-js-sdk/lib/**"],
message: "Please use matrix-js-sdk/src/* instead", message: "Please use matrix-js-sdk/src/* instead",
}, },
{
group: ["matrix-react-sdk/lib", "matrix-react-sdk/lib/", "matrix-react-sdk/lib/**"],
message: "Please use matrix-react-sdk/src/* instead",
},
], ],
}, },
], ],
+4 -8
View File
@@ -51,6 +51,10 @@ module.exports = {
"error", "error",
{ {
paths: [ paths: [
{
name: "@testing-library/react",
message: "Please use jest-matrix-react instead",
},
{ {
name: "matrix-js-sdk", name: "matrix-js-sdk",
message: "Please use matrix-js-sdk/src/matrix instead", message: "Please use matrix-js-sdk/src/matrix instead",
@@ -71,14 +75,6 @@ module.exports = {
name: "matrix-js-sdk/src/index", name: "matrix-js-sdk/src/index",
message: "Please use matrix-js-sdk/src/matrix instead", message: "Please use matrix-js-sdk/src/matrix instead",
}, },
{
name: "matrix-react-sdk",
message: "Please use matrix-react-sdk/src/index instead",
},
{
name: "matrix-react-sdk/",
message: "Please use matrix-react-sdk/src/index instead",
},
{ {
name: "emojibase-regex", name: "emojibase-regex",
message: message:
+1
View File
@@ -1,2 +1,3 @@
# prettier # prettier
526645c79160ab1ad4b4c3845de27d51263a405e 526645c79160ab1ad4b4c3845de27d51263a405e
7921a6cbf86b035d2b0c1daecb4c24beaf5a5abc
+1 -1
View File
@@ -5,4 +5,4 @@
- [ ] Tests written for new code (and old code if feasible). - [ ] Tests written for new code (and old code if feasible).
- [ ] New or updated `public`/`exported` symbols have accurate [TSDoc](https://tsdoc.org/) documentation. - [ ] New or updated `public`/`exported` symbols have accurate [TSDoc](https://tsdoc.org/) documentation.
- [ ] Linter and other CI checks pass. - [ ] Linter and other CI checks pass.
- [ ] I have licensed the changes to Element by completing the [Contributor License Agreement (CLA)](https://cla-assistant.io/element-hq/matrix-react-sdk) - [ ] I have licensed the changes to Element by completing the [Contributor License Agreement (CLA)](https://cla-assistant.io/element-hq/element-web)
+244 -6
View File
@@ -1,28 +1,266 @@
- name: "A-Aliases"
color: "bfd4f2"
- name: "A-Authentication"
color: "bfd4f2"
- name: "A-Autocomplete"
color: "bfd4f2"
- name: "A-Breadcrumbs"
color: "bfd4f2"
- name: "A-Bridge"
color: "bfd4f2"
- name: "A-Broadcast"
description: "Broadcast-style voice messages"
color: "bfd4f2"
- name: "A-Create-Room"
description: "Create room flow, user suggestions, etc."
color: "bfd4f2"
- name: "A-DevTools"
description: "/devtools, show hidden events, etc."
color: "bfd4f2"
- name: "A-Dialogs"
color: "bfd4f2"
- name: "A-Disambiguation"
color: "bfd4f2"
- name: "A-DM-Start"
description: "Creating a DM with another user"
color: "bfd4f2"
- name: "A-E2EE-Dehydration"
color: "8CC59A"
- name: "A-Electron"
color: "bfd4f2"
- name: "A-Element-Call"
description: "Group calls via Element Call"
color: "bfd4f2"
- name: "A-Element-R"
description: "Issues affecting the port of Element's crypto layer to Rust"
color: "bfd4f2"
- name: "A-ELS"
description: "Event List Summary (and Membership ELS, MELS)"
color: "bfd4f2"
- name: "A-Emotes"
color: "bfd4f2"
- name: "A-EMS"
description: "Issues related to EMS"
color: "bfd4f2"
- name: "A-Error-Message"
color: "bfd4f2"
- name: "A-Federation"
color: "bfd4f2"
- name: "A-Feedback-Reporting"
description: "Reporting process for bugs, debug logs (rageshakes), suggestions"
color: "bfd4f2"
- name: "A-File-Download"
color: "bfd4f2"
- name: "A-File-Panel"
color: "bfd4f2"
- name: "A-Identity-Server"
color: "bfd4f2"
- name: "A-Indexing"
description: "Indexing messages via Seshat"
color: "bfd4f2"
- name: "A-IRC-Layout"
color: "bfd4f2"
- name: "A-Jump-To-Date"
description: "Jump to date headers or slash command"
color: "bfd4f2"
- name: "A-Lazy-Loading"
color: "bfd4f2"
- name: "A-Light-Box"
description: "UI when viewing an image"
color: "bfd4f2"
- name: "A-Location-Sharing"
color: "bfd4f2"
- name: "A-Logout"
description: "Logout, sign out, etc."
color: "bfd4f2"
- name: "A-Maths"
description: "Render LaTeX maths in messages"
color: "bfd4f2"
- name: "A-Memory"
description: "Memory leaks, leak hunting tools"
color: "bfd4f2"
- name: "A-Message-Forwarding"
color: "bfd4f2"
- name: "A-Message-Pinning"
color: "bfd4f2"
- name: "A-Message-Previews"
color: "bfd4f2"
- name: "A-Message-Starring"
description: "Saving favourite messages for later"
color: "bfd4f2"
- name: "A-Modules"
description: "Module system related"
color: "bfd4f2"
- name: "A-New-Search-Experience"
description: "The new search dialog available in Labs"
color: "bfd4f2"
- name: "A-Packaging"
description: "Packaging, signing, releasing"
color: "bfd4f2"
- name: "A-Peeking"
color: "bfd4f2"
- name: "A-Picture-in-Picture"
color: "bfd4f2"
- name: "A-Power-Levels"
description: "The permissions that users have in rooms and spaces"
color: "bfd4f2"
- name: "A-Replies"
description: "reply"
color: "bfd4f2"
- name: "A-Session-Mgmt"
description: "Session / device names, management UI, etc."
color: "bfd4f2"
- name: "A-Share"
color: "bfd4f2"
- name: "A-Shortcuts"
description: "Keyboard shortcuts"
color: "bfd4f2"
- name: "A-Sliding-Sync"
description: "Also known as Sync v3 - https://github.com/matrix-org/sliding-sync"
color: "bfd4f2"
- name: "A-Soft-Logout"
description: "https://github.com/element-hq/element-web/issues/10224"
color: "bfd4f2"
- name: "A-Spaces-Settings"
color: "bfd4f2"
- name: "A-SSO"
color: "bfd4f2"
- name: "A-Status-Bar"
description: "Unsent messages warning and 'Connectivity to the server has been lost'"
color: "bfd4f2"
- name: "A-Storage"
description: "Storage layer of the app, including IndexedDB, local storage, etc."
color: "bfd4f2"
- name: "A-Technical-Debt"
color: "bfd4f2"
- name: "A-Testing"
description: "Testing, code coverage, etc."
color: "bfd4f2"
- name: "A-Themes-Custom"
description: "Custom theme variables or support"
color: "bfd4f2"
- name: "A-Themes-Official"
description: "Official themes (light, dark)"
color: "bfd4f2"
- name: "A-Theming"
color: "bfd4f2"
- name: "A-Timeline-Jumpy-Scroll"
description: "Stable timeline dream ✨"
color: "bfd4f2"
- name: "A-Timesheet-1" - name: "A-Timesheet-1"
description: "Log any time spent on this into the A-Timesheet-1 project" description: "Log any time spent on this into the A-Timesheet-1 project"
color: "5319E7" color: "5319E7"
- name: "A-Toast"
color: "bfd4f2"
- name: "A-Tooltips"
description: "Anything related to tooltips"
color: "bfd4f2"
- name: "A-UI-Customisation"
description: "UIFeatures etc. for customising entire parts of the UI"
color: "bfd4f2"
- name: "A-URL-Previews"
color: "bfd4f2"
- name: "A-User-Menu"
description: "The top left main menu with the user's name and avatar"
color: "bfd4f2"
- name: "A-User-Search"
description: "The start DM or invite to room dialogs (things dealing with `/user_directory/search`)"
color: "bfd4f2"
- name: "A-Video-Rooms"
description: "Persistent group calls"
color: "bfd4f2"
- name: "A-Voice-Messages"
color: "bfd4f2"
- name: "A-Welcome-Page"
color: "bfd4f2"
- name: "backport staging" - name: "backport staging"
description: "Label to automatically backport PR to staging branch" description: "Label to automatically backport PR to staging branch"
color: "B60205" color: "B60205"
- name: "Dependencies" - name: "Dependencies"
description: "Pull requests that update a dependency file" description: "Pull requests that update a dependency file"
color: "0366d6" color: "0366d6"
- name: "Hacktoberfest"
description: "Issues which are suitable for Hacktoberfest PRs: https://hacktoberfest.digitalocean.com/"
color: "ff7518"
- name: "P4"
description: "[OBSOLETE LABEL] Interesting — Not yet scheduled, will accept patches"
color: "d1e5f0"
- name: "spam"
color: "B60205"
- name: "Sponsored" - name: "Sponsored"
color: "b506d8" color: "ffc8f4"
- name: "T-Deprecation" - name: "T-Deprecation"
description: "A pull request that makes something deprecated" description: "A pull request that makes something deprecated"
color: "98e6ae" color: "98e6ae"
- name: "T-Other"
description: "Questions, user support, anything else"
color: "98e6ae"
- name: "Team: App"
color: "FFA500"
- name: "X-Blocked" - name: "X-Blocked"
description: "The PR cannot move forward in any capacity until an action is made"
color: "ff7979" color: "ff7979"
- name: "X-Breaking-Change" - name: "X-Cannot-Reproduce"
color: "ff7979"
- name: "X-Command"
description: "Created using the !github command"
color: "ff7979"
- name: "X-Community-Supported-Platform"
description: "This issue occurs in a platform not directly supported by us, but by a community project elsewhere"
color: "ff7979" color: "ff7979"
- name: "X-Upcoming-Release-Blocker" - name: "X-Upcoming-Release-Blocker"
description: "This does not affect the current release cycle but will affect the next one" description: "This does not affect the current release cycle but will affect the next one"
color: "e99695" color: "e99695"
- name: "Z-Actions"
color: "ededed"
- name: "Z-Cache-Confusion"
description: "Related to internal cache (clearing helps / causes the issue)"
color: "ededed"
- name: "Z-Community-PR" - name: "Z-Community-PR"
description: "Issue is solved by a community member's PR" description: "Issue is solved by a community member's PR"
color: "ededed" color: "ededed"
- name: "Z-Experiment" - name: "Z-Element-R-Blocker"
description: "Experimental PR, primarily up for its Netlify build, high likelihood of never making it beyond here." description: "A blocker for enabling Element R by default"
color: "b60205" color: "ededed"
- name: "Z-Experimental"
color: "ededed"
- name: "Z-Fixed by Element Call"
description: "Issues which can be closed when we move to Element Call"
color: "ededed"
- name: "Z-Fixed-By-OIDC"
description: "Issues which can be closed when we move to OIDC"
color: "ededed"
- name: "Z-Flaky-Test"
description: "A test is raising false alarms"
color: "ededed"
- name: "Z-FOSDEM"
description: "Issues in chat.fosdem.org"
color: "ededed"
- name: "Z-Gitter"
description: "Issues relating to or coming out of the Gitter migration, feature parity, etc"
color: "ededed"
- name: "Z-Legacy-Crypto"
description: "Issues affecting the legacy crypto stack"
color: "EEEEEE"
- name: "Z-Maximised-Widgets"
color: "ededed"
- name: "Z-Papercuts"
description: "Visible. Impactful. Predictable to action."
color: "ededed"
- name: "Z-Power-Users"
color: "ededed"
- name: "Z-Rageshake"
description: "Has attached rageshake (not for log submission process)"
color: "ededed"
- name: "Z-RICE"
color: "ededed"
- name: "Z-Soft-Crash"
description: "React soft crash caught by an error boundary"
color: "ededed"
- name: "Z-Spec-Compliance"
description: "An area where Element doesn't correctly implement the spec"
color: "ededed"
- name: "Z-t3chguy"
color: "ededed"
- name: "Z-Flaky-Test-Disabled"
description: "The flaking test has been disabled"
color: "ededed"
+2
View File
@@ -1 +1,3 @@
_extends: matrix-org/matrix-js-sdk _extends: matrix-org/matrix-js-sdk
version-resolver:
default: patch
+1 -1
View File
@@ -10,7 +10,7 @@ on:
jobs: jobs:
backport: backport:
name: Backport name: Backport
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
# Only react to merged PRs for security reasons. # Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: > if: >
+1 -10
View File
@@ -30,12 +30,6 @@ jobs:
with: with:
path: element-web path: element-web
- name: Fetch matrix-react-sdk
uses: actions/checkout@v4
with:
repository: element-hq/matrix-react-sdk
path: matrix-react-sdk
- name: Fetch matrix-js-sdk - name: Fetch matrix-js-sdk
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@@ -52,7 +46,7 @@ jobs:
working-directory: element-web working-directory: element-web
run: | run: |
yarn install --frozen-lockfile yarn install --frozen-lockfile
yarn ts-node ./scripts/gen-workflow-mermaid.ts ../element-desktop ../element-web ../matrix-react-sdk ../matrix-js-sdk > docs/automations.md yarn ts-node ./scripts/gen-workflow-mermaid.ts ../element-desktop ../element-web ../matrix-js-sdk > docs/automations.md
echo "- [Automations](automations.md)" >> docs/SUMMARY.md echo "- [Automations](automations.md)" >> docs/SUMMARY.md
- name: Setup mdBook - name: Setup mdBook
@@ -74,9 +68,6 @@ jobs:
mv element-web/docs/lib docs/ mv element-web/docs/lib docs/
mv element-web/docs "docs/Element Web" mv element-web/docs "docs/Element Web"
mv matrix-react-sdk/README.md matrix-react-sdk/docs/
mv matrix-react-sdk/docs "docs/Matrix React SDK"
mv matrix-js-sdk/README.md matrix-js-sdk/docs/ mv matrix-js-sdk/README.md matrix-js-sdk/docs/
mv matrix-js-sdk/docs "docs/Matrix JS SDK" mv matrix-js-sdk/docs "docs/Matrix JS SDK"
@@ -37,7 +37,7 @@ jobs:
branch: ${{ github.event.workflow_run.head_branch }} branch: ${{ github.event.workflow_run.head_branch }}
revision: ${{ github.event.workflow_run.head_sha }} revision: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.NETLIFY_AUTH_TOKEN }} token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
site_id: ${{ secrets.NETLIFY_SITE_ID }} site_id: ${{ vars.NETLIFY_SITE_ID }}
desc: Playwright Report desc: Playwright Report
deployment_env: EndToEndTests deployment_env: EndToEndTests
prefix: "e2e-" prefix: "e2e-"
+10 -28
View File
@@ -9,7 +9,7 @@ on:
push: push:
branches: [develop, master] branches: [develop, master]
repository_dispatch: repository_dispatch:
types: [upstream-sdk-notify] types: [element-web-notify]
# support triggering from other workflows # support triggering from other workflows
workflow_call: workflow_call:
@@ -20,19 +20,10 @@ on:
default: false default: false
description: "A boolean to skip the playwright check itself while still creating the passing check. Useful when only running in Merge Queues." description: "A boolean to skip the playwright check itself while still creating the passing check. Useful when only running in Merge Queues."
react-sdk-repository:
type: string
required: true
description: "The name of the github repository to check out and build."
matrix-js-sdk-sha: matrix-js-sdk-sha:
type: string type: string
required: false required: false
description: "The Git SHA of matrix-js-sdk to build against. By default, will use a matching branch name if it exists, or develop." description: "The Git SHA of matrix-js-sdk to build against. By default, will use a matching branch name if it exists, or develop."
element-web-sha:
type: string
required: false
description: "The Git SHA of element-web to build against. By default, will use a matching branch name if it exists, or develop."
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
@@ -51,7 +42,7 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: ${{ inputs.react-sdk-repository || github.repository }} repository: element-hq/element-web
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
@@ -63,17 +54,14 @@ jobs:
env: env:
# tell layered.sh to check out the right sha of the JS-SDK & EW, if they were given one # tell layered.sh to check out the right sha of the JS-SDK & EW, if they were given one
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }} JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
ELEMENT_WEB_GITHUB_BASE_REF: ${{ inputs.element-web-sha }}
run: | run: |
scripts/ci/layered.sh scripts/layered.sh
JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD) JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD)
REACT_SHA=$(git rev-parse --short=12 HEAD) VECTOR_SHA=$(git rev-parse --short=12 HEAD)
VECTOR_SHA=$(git -C element-web rev-parse --short=12 HEAD) echo "VERSION=$VECTOR_SHA--js-$JSSDK_SHA" >> $GITHUB_OUTPUT
echo "VERSION=$VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA" >> $GITHUB_OUTPUT
- name: Copy config - name: Copy config
run: cp element.io/develop/config.json config.json run: cp element.io/develop/config.json config.json
working-directory: ./element-web
- name: Build - name: Build
env: env:
@@ -82,13 +70,12 @@ jobs:
run: | run: |
yarn build yarn build
echo $VERSION > webapp/version echo $VERSION > webapp/version
working-directory: ./element-web
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: webapp name: webapp
path: element-web/webapp path: webapp
retention-days: 1 retention-days: 1
playwright: playwright:
@@ -109,8 +96,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
path: matrix-react-sdk repository: element-hq/element-web
repository: ${{ inputs.react-sdk-repository || github.repository }}
- name: 📥 Download artifact - name: 📥 Download artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@@ -121,16 +107,14 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
cache: "yarn" cache: "yarn"
cache-dependency-path: matrix-react-sdk/yarn.lock cache-dependency-path: yarn.lock
node-version: "lts/*" node-version: "lts/*"
- name: Install dependencies - name: Install dependencies
working-directory: matrix-react-sdk
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
- name: Get installed Playwright version - name: Get installed Playwright version
id: playwright id: playwright
working-directory: matrix-react-sdk
run: echo "version=$(yarn list --pattern @playwright/test --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')" >> $GITHUB_OUTPUT run: echo "version=$(yarn list --pattern @playwright/test --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')" >> $GITHUB_OUTPUT
- name: Cache playwright binaries - name: Cache playwright binaries
@@ -143,19 +127,17 @@ jobs:
- name: Install Playwright browsers - name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true' if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: matrix-react-sdk
run: yarn playwright install --with-deps run: yarn playwright install --with-deps
- name: Run Playwright tests - name: Run Playwright tests
run: yarn playwright test --shard ${{ matrix.runner }}/${{ strategy.job-total }} run: yarn playwright test --shard ${{ matrix.runner }}/${{ strategy.job-total }}
working-directory: matrix-react-sdk
- name: Upload blob report to GitHub Actions Artifacts - name: Upload blob report to GitHub Actions Artifacts
if: always() if: always()
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: all-blob-reports-${{ matrix.runner }} name: all-blob-reports-${{ matrix.runner }}
path: matrix-react-sdk/blob-report path: blob-report
retention-days: 1 retention-days: 1
complete: complete:
@@ -168,7 +150,7 @@ jobs:
if: inputs.skip != true if: inputs.skip != true
with: with:
persist-credentials: false persist-credentials: false
repository: ${{ inputs.react-sdk-repository || github.repository }} repository: element-hq/element-web
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
if: inputs.skip != true if: inputs.skip != true
+1 -1
View File
@@ -40,7 +40,7 @@ jobs:
branch: ${{ github.event.workflow_run.head_branch }} branch: ${{ github.event.workflow_run.head_branch }}
revision: ${{ github.event.workflow_run.head_sha }} revision: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.NETLIFY_AUTH_TOKEN }} token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
site_id: ${{ secrets.NETLIFY_SITE_ID }} site_id: ${{ vars.NETLIFY_SITE_ID }}
deployment_env: ${{ steps.deployment.outputs.env }} deployment_env: ${{ steps.deployment.outputs.env }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }} deployment_id: ${{ steps.deployment.outputs.deployment_id }}
desc: | desc: |
-19
View File
@@ -1,19 +0,0 @@
name: Notify element-web
on:
push:
branches: [develop]
repository_dispatch:
types: [upstream-sdk-notify]
jobs:
notify-element-web:
name: "Notify Element Web"
runs-on: ubuntu-22.04
# Only respect triggers from our develop branch, ignore that of forks
if: github.repository == 'element-hq/matrix-react-sdk'
steps:
- name: Notify element-web repo that a new SDK build is on develop
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3
with:
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
repository: vector-im/element-web
event-type: element-web-notify
-1
View File
@@ -64,7 +64,6 @@ jobs:
const repos = [ const repos = [
"element-hq/element-desktop", "element-hq/element-desktop",
"element-hq/element-web", "element-hq/element-web",
"element-hq/matrix-react-sdk",
"matrix-org/matrix-js-sdk", "matrix-org/matrix-js-sdk",
]; ];
const teams = [ const teams = [
+2 -1
View File
@@ -7,7 +7,8 @@ concurrency: ${{ github.repository }}-${{ github.workflow }}
jobs: jobs:
merge: merge:
uses: matrix-org/matrix-js-sdk/.github/workflows/release-gitflow.yml@develop uses: matrix-org/matrix-js-sdk/.github/workflows/release-gitflow.yml@develop
secrets: inherit secrets:
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
with: with:
dependencies: | dependencies: |
matrix-js-sdk matrix-js-sdk
+42 -8
View File
@@ -10,19 +10,53 @@ on:
options: options:
- rc - rc
- final - final
npm:
description: Publish to npm
required: true
type: boolean
default: true
concurrency: ${{ github.workflow }} concurrency: ${{ github.workflow }}
jobs: jobs:
release: release:
uses: matrix-org/matrix-js-sdk/.github/workflows/release-make.yml@develop uses: matrix-org/matrix-js-sdk/.github/workflows/release-make.yml@develop
secrets: secrets:
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }} ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
with: with:
final: ${{ inputs.mode == 'final' }} final: ${{ inputs.mode == 'final' }}
npm: ${{ inputs.npm }} gpg-fingerprint: ${{ vars.GPG_FINGERPRINT }}
downstreams: '["element-hq/element-web"]' asset-path: dist/*.tar.gz
expected-asset-count: 3
notify-downstream:
name: Trigger release drafter downstream
needs: release
runs-on: ubuntu-latest
steps:
- name: Notify element-desktop repo that element-web release has completed to re-trigger release-drafter
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1
with:
workflow: release-drafter.yml
repo: element-hq/element-desktop
ref: staging
# Required when using the `repo` option. Either a PAT or a token generated from the GitHub app or CLI
token: "${{ secrets.ELEMENT_BOT_TOKEN }}"
check:
name: Post release checks
needs: release
runs-on: ubuntu-latest
steps:
- name: Wait for dockerhub
uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork
with:
ref: master
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
check-name: "Docker Buildx (vanilla)"
allowed-conclusions: success
- name: Wait for debian package
uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork
with:
ref: master
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
check-name: Build package
allowed-conclusions: success
-33
View File
@@ -12,11 +12,6 @@ on:
required: true required: true
type: boolean type: boolean
default: true default: true
matrix-react-sdk:
description: Prepare matrix-react-sdk
required: true
type: boolean
default: true
matrix-js-sdk: matrix-js-sdk:
description: Prepare matrix-js-sdk description: Prepare matrix-js-sdk
required: true required: true
@@ -25,9 +20,6 @@ on:
jobs: jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
# The order is specified bottom-up to avoid any races for allchange
REPOS: matrix-js-sdk matrix-react-sdk element-web element-desktop
steps: steps:
- name: Checkout Element Desktop - name: Checkout Element Desktop
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -49,16 +41,6 @@ jobs:
fetch-depth: 0 fetch-depth: 0
fetch-tags: true fetch-tags: true
token: ${{ secrets.ELEMENT_BOT_TOKEN }} token: ${{ secrets.ELEMENT_BOT_TOKEN }}
- name: Checkout Matrix React SDK
uses: actions/checkout@v4
if: inputs.matrix-react-sdk
with:
repository: element-hq/matrix-react-sdk
path: matrix-react-sdk
ref: staging
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
- name: Checkout Matrix JS SDK - name: Checkout Matrix JS SDK
uses: actions/checkout@v4 uses: actions/checkout@v4
if: inputs.matrix-js-sdk if: inputs.matrix-js-sdk
@@ -83,10 +65,6 @@ jobs:
if: inputs.element-web if: inputs.element-web
run: | run: |
git -C "element-web" merge origin/develop git -C "element-web" merge origin/develop
- name: Merge React SDK
if: inputs.matrix-react-sdk
run: |
git -C "matrix-react-sdk" merge origin/develop
- name: Merge JS SDK - name: Merge JS SDK
if: inputs.matrix-js-sdk if: inputs.matrix-js-sdk
run: | run: |
@@ -106,17 +84,6 @@ jobs:
check-name: draft check-name: draft
allowed-conclusions: success allowed-conclusions: success
- name: Wait for matrix-react-sdk draft
if: inputs.matrix-react-sdk
uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork
with:
ref: staging
repo: element-hq/matrix-react-sdk
repo-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
wait-interval: 10
check-name: draft
allowed-conclusions: success
- name: Wait for element-web draft - name: Wait for element-web draft
if: inputs.element-web if: inputs.element-web
uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork
+18 -16
View File
@@ -1,24 +1,25 @@
name: Static Analysis name: Static Analysis
on: on:
pull_request: {} pull_request: {}
merge_group:
types: [checks_requested]
push: push:
branches: [develop, master] branches: [develop, master]
merge_group:
types: [checks_requested]
repository_dispatch: repository_dispatch:
types: [upstream-sdk-notify] types: [element-web-notify]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true cancel-in-progress: true
env: env:
# fetchdep.sh needs to know our PR number # These must be set for fetchdep.sh to get the right branch
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
jobs: jobs:
ts_lint: ts_lint:
name: "Typescript Syntax Check" name: "Typescript Syntax Check"
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -27,8 +28,8 @@ jobs:
cache: "yarn" cache: "yarn"
node-version: "lts/*" node-version: "lts/*"
- name: Install Deps - name: Install Dependencies
run: "./scripts/ci/install-deps.sh" run: "./scripts/layered.sh"
- name: Typecheck - name: Typecheck
run: "yarn run lint:types" run: "yarn run lint:types"
@@ -64,6 +65,9 @@ jobs:
labs|element_call_video_rooms labs|element_call_video_rooms
labs|feature_disable_call_per_sender_encryption labs|feature_disable_call_per_sender_encryption
voip|element_call voip|element_call
error|invalid_json
error|misconfigured
welcome_to_element
rethemendex_lint: rethemendex_lint:
name: "Rethemendex Check" name: "Rethemendex Check"
@@ -77,7 +81,7 @@ jobs:
js_lint: js_lint:
name: "ESLint" name: "ESLint"
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -88,14 +92,14 @@ jobs:
# Does not need branch matching as only analyses this layer # Does not need branch matching as only analyses this layer
- name: Install Deps - name: Install Deps
run: "yarn install" run: "yarn install --frozen-lockfile"
- name: Run Linter - name: Run Linter
run: "yarn run lint:js" run: "yarn run lint:js"
style_lint: style_lint:
name: "Style Lint" name: "Style Lint"
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -113,7 +117,7 @@ jobs:
workflow_lint: workflow_lint:
name: "Workflow Lint" name: "Workflow Lint"
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -131,7 +135,7 @@ jobs:
analyse_dead_code: analyse_dead_code:
name: "Analyse Dead Code" name: "Analyse Dead Code"
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -141,9 +145,7 @@ jobs:
node-version: "lts/*" node-version: "lts/*"
- name: Install Deps - name: Install Deps
run: "scripts/ci/layered.sh" run: "scripts/layered.sh"
- name: Dead Code Analysis - name: Dead Code Analysis
run: | run: "yarn run analyse:unused-exports"
cd element-web
yarn run analyse:unused-exports
-60
View File
@@ -1,60 +0,0 @@
name: Tests
on:
pull_request: {}
push:
branches: [develop, master]
merge_group:
types: [checks_requested]
repository_dispatch:
types: [element-web-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@v4
- name: Yarn cache
uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"
- name: Install Dependencies
run: "./scripts/layered.sh"
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2
- name: Run tests with coverage
run: "yarn coverage --ci --max-workers ${{ steps.cpu-cores.outputs.count }}"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: |
coverage
!coverage/lcov-report
skip_sonar:
name: Skip SonarCloud in merge queue
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
needs: jest
steps:
- name: Skip SonarCloud
uses: Sibz/github-status-action@faaa4d96fecf273bd762985e0e7f9f933c774918 # v1
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
state: success
description: SonarCloud skipped
context: SonarCloud Code Analysis
sha: ${{ github.sha }}
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
+3 -21
View File
@@ -6,7 +6,7 @@ on:
push: push:
branches: [develop, master] branches: [develop, master]
repository_dispatch: repository_dispatch:
types: [upstream-sdk-notify] types: [element-web-notify]
workflow_call: workflow_call:
inputs: inputs:
disable_coverage: disable_coverage:
@@ -39,7 +39,7 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: ${{ inputs.matrix-js-sdk-sha && 'element-hq/matrix-react-sdk' || github.repository }} repository: ${{ inputs.matrix-js-sdk-sha && 'element-hq/element-web' || github.repository }}
- name: Yarn cache - name: Yarn cache
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@@ -48,7 +48,7 @@ jobs:
cache: "yarn" cache: "yarn"
- name: Install Deps - name: Install Deps
run: "./scripts/ci/install-deps.sh" run: "./scripts/layered.sh"
env: env:
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }} JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
@@ -108,21 +108,3 @@ jobs:
context: SonarCloud Code Analysis context: SonarCloud Code Analysis
sha: ${{ github.sha }} sha: ${{ github.sha }}
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
app-tests:
name: Element Web Integration Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.matrix-js-sdk-sha && 'element-hq/matrix-react-sdk' || github.repository }}
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"
- name: Run tests
run: "./scripts/ci/app-tests.sh"
env:
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
+26 -14
View File
@@ -1,21 +1,33 @@
/build
/cert.pem
/dist
/key.pem
/lib
/node_modules
/packages/
/webapp
/.npmrc /.npmrc
/*.log /*.log
package-lock.json package-lock.json
.DS_Store
/coverage electron/dist
/node_modules electron/pub
/lib **/.idea
/config.json
# version file and tarball created by `npm pack` / `yarn pack` /config.json.*
/git-revision.txt /config.local*.json
/matrix-react-sdk-*.tgz
/.idea
# Legacy skinning file that some people might still have # Legacy skinning file that some people might still have
/src/component-index.js /src/component-index.js
/.tmp
.DS_Store /webpack-stats.json
*.tmp
.vscode .vscode
.vscode/ .vscode/
.env
/coverage
# Auto-generated file
/src/modules.ts
/build_config.yaml
/book
/index.html
# version file and tarball created by `npm pack` / `yarn pack`
/git-revision.txt
+4 -2
View File
@@ -1,5 +1,7 @@
{ {
"*": "prettier --write", "*": "prettier --write",
"*.(ts|tsx|js|jsx)": ["eslint --fix"], "src/**/*.(ts|tsx)": ["eslint --fix"],
"*.pcss": ["stylelint"] "scripts/**/*.(ts|tsx)": ["eslint --fix"],
"module_system/**/*.(ts|tsx)": ["eslint --fix --config .eslintrc-module_system.js module_system"],
"*.pcss": ["stylelint --fix"]
} }
View File
+32 -13
View File
@@ -1,22 +1,41 @@
/coverage /build
/dist
/lib /lib
/node_modules
/.idea /packages/
/webapp
/*.log
yarn.lock
electron/dist
electron/pub
**/.idea
/.tmp
/webpack-stats.json
.vscode .vscode
.vscode/ .vscode/
.env
/coverage
# Auto-generated file
/src/modules.ts
/src/i18n/strings
/build_config.yaml
# Raises an error because it contains a template var breaking the script tag
src/vector/index.html
src/vector/modernizr.js
/docs/lib
/book
/debian/tmp
/.npmrc
package-lock.json
# This file is owned, parsed, and generated by allchange, which doesn't comply with prettier
/CHANGELOG.md
/docs/changelogs
# Legacy skinning file that some people might still have # Legacy skinning file that some people might still have
/src/component-index.js /src/component-index.js
/.npmrc # Downloaded and already minified
/*.log res/jitsi_external_api.min.js
package-lock.json
yarn.lock
/src/i18n/strings
# This file is owned, parsed, and generated by allchange, which doesn't comply with prettier
/CHANGELOG.md
# This file is also machine-generated # This file is also machine-generated
/playwright/e2e/crypto/test_indexeddb_cryptostore_dump/dump.json /playwright/e2e/crypto/test_indexeddb_cryptostore_dump/dump.json
+239 -16200
View File
File diff suppressed because it is too large Load Diff
+297 -3
View File
@@ -1,5 +1,299 @@
# Contributing code to matrix-react-sdk # Contributing code to Element Web
Everyone is welcome to contribute code to matrix-react-sdk, provided that they are willing to license their contributions to Element under a [Contributor License Agreement](https://cla-assistant.io/element-hq/matrix-react-sdk) (CLA). This ensures that their contribution will be made available under an OSI-approved open-source license, currently licensed under Affero General Public License v3 (AGPLv3) or General Public License v3 (GPLv3) at your choice. Everyone is welcome to contribute code to Element Web, provided that they are willing to license their contributions to Element under a [Contributor License Agreement](https://cla-assistant.io/element-hq/element-web) (CLA). This ensures that their contribution will be made available under an OSI-approved open-source license, currently licensed under Affero General Public License v3 (AGPLv3) or General Public License v3 (GPLv3) at your choice.
matrix-react-sdk follows the same pattern as element-web, please find more contributing guidelines at https://github.com/vector-im/element-web/blob/develop/CONTRIBUTING.md ## How to contribute
The preferred and easiest way to contribute changes to the project is to fork
it on github, and then create a pull request to ask us to pull your changes
into our repo (https://help.github.com/articles/using-pull-requests/)
We use GitHub's pull request workflow to review the contribution, and either
ask you to make any refinements needed or merge it and make them ourselves.
Your PR should have a title that describes what change is being made. This
is used for the text in the Changelog entry by default (see below), so a good
title will tell a user succinctly what change is being made. "Fix bug where
cows had five legs" and, "Add support for miniature horses" are examples of good
titles. Don't include an issue number here: that belongs in the description.
Definitely don't use the GitHub default of "Update file.ts".
As for your PR description, it should include these things:
- References to any bugs fixed by the change (in GitHub's `Fixes` notation)
- Describe the why and what is changing in the PR description so it's easy for
onlookers and reviewers to onboard and context switch. This information is
also helpful when we come back to look at this in 6 months and ask "why did
we do it like that?" we have a chance of finding out.
- Why didn't it work before? Why does it work now? What use cases does it
unlock?
- If you find yourself adding information on how the code works or why you
chose to do it the way you did, make sure this information is instead
written as comments in the code itself.
- Sometimes a PR can change considerably as it is developed. In this case,
the description should be updated to reflect the most recent state of
the PR. (It can be helpful to retain the old content under a suitable
heading, for additional context.)
- Include both **before** and **after** screenshots to easily compare and discuss
what's changing.
- Include a step-by-step testing strategy so that a reviewer can check out the
code locally and easily get to the point of testing your change.
- Add comments to the diff for the reviewer that might help them to understand
why the change is necessary or how they might better understand and review it.
### Changelogs
There's no need to manually add Changelog entries: we use information in the
pull request to populate the information that goes into the changelogs our
users see, both for Element Web itself and other projects on which it is based.
This is picked up from both labels on the pull request and the `Notes:`
annotation in the description. By default, the PR title will be used for the
changelog entry, but you can specify more options, as follows.
To add a longer, more detailed description of the change for the changelog:
_Fix llama herding bug_
```
Notes: Fix a bug (https://github.com/matrix-org/notaproject/issues/123) where the 'Herd' button would not herd more than 8 Llamas if the moon was in the waxing gibbous phase
```
For some PRs, it's not useful to have an entry in the user-facing changelog (this is
the default for PRs labelled with `T-Task`):
_Remove outdated comment from `Ungulates.ts`_
```
Notes: none
```
Sometimes, you're fixing a bug in a downstream project, in which case you want
an entry in that project's changelog. You can do that too:
_Fix another herding bug_
```
Notes: Fix a bug where the `herd()` function would only work on Tuesdays
element-web notes: Fix a bug where the 'Herd' button only worked on Tuesdays
```
This example is for Element Web. You can specify:
- element-web
- element-desktop
If your PR introduces a breaking change, use the `Notes` section in the same
way, additionally adding the `X-Breaking-Change` label (see below). There's no need
to specify in the notes that it's a breaking change - this will be added
automatically based on the label - but remember to tell the developer how to
migrate:
_Remove legacy class_
```
Notes: Remove legacy `Camelopard` class. `Giraffe` should be used instead.
```
Other metadata can be added using labels.
- `X-Breaking-Change`: A breaking change - adding this label will mean the change causes a _major_ version bump.
- `T-Enhancement`: A new feature - adding this label will mean the change causes a _minor_ version bump.
- `T-Defect`: A bug fix (in either code or docs).
- `T-Task`: No user-facing changes, eg. code comments, CI fixes, refactors or tests. Won't have a changelog entry unless you specify one.
If you don't have permission to add labels, your PR reviewer(s) can work with you
to add them: ask in the PR description or comments.
We use continuous integration, and all pull requests get automatically tested:
if your change breaks the build, then the PR will show that there are failed
checks, so please check back after a few minutes.
## Tests
Your PR should include tests.
For new user facing features in `matrix-js-sdk` or `element-web`, you must include:
1. Comprehensive unit tests written in Jest. These are located in `/test`.
2. "happy path" end-to-end tests.
These are located in `/playwright/e2e`, and are run using `element-web`.
Ideally, you would also include tests for edge and error cases.
Unit tests are expected even when the feature is in labs. It's good practice
to write tests alongside the code as it ensures the code is testable from
the start, and gives you a fast feedback loop while you're developing the
functionality. End-to-end tests should be added prior to the feature
leaving labs, but don't have to be present from the start (although it might
be beneficial to have some running early, so you can test things faster).
For bugs in those repos, your change must include at least one unit test or
end-to-end test; which is best depends on what sort of test most concisely
exercises the area.
Changes to must be accompanied by unit tests written in Jest.
These are located in `/spec/` in `matrix-js-sdk` or `/test/` in `element-web`.
When writing unit tests, please aim for a high level of test coverage
for new code - 80% or greater. If you cannot achieve that, please document
why it's not possible in your PR.
Some sections of code are not sensible to add coverage for, such as those
which explicitly inhibit noisy logging for tests. Which can be hidden using
an istanbul magic comment as [documented here][1]. See example:
```javascript
/* istanbul ignore if */
if (process.env.NODE_ENV !== "test") {
logger.error("Log line that is noisy enough in tests to want to skip");
}
```
Tests validate that your change works as intended and also document
concisely what is being changed. Ideally, your new tests fail
prior to your change, and succeed once it has been applied. You may
find this simpler to achieve if you write the tests first.
If you're spiking some code that's experimental and not being used to support
production features, exceptions can be made to requirements for tests.
Note that tests will still be required in order to ship the feature, and it's
strongly encouraged to think about tests early in the process, as adding
tests later will become progressively more difficult.
If you're not sure how to approach writing tests for your change, ask for help
in [#element-dev](https://matrix.to/#/#element-dev:matrix.org).
## Code style
Element Web aims to target TypeScript/ES6. All new files should be written in
TypeScript and existing files should use ES6 principles where possible.
Members should not be exported as a default export in general - it causes problems
with the architecture of the SDK (index file becomes less clear) and could
introduce naming problems (as default exports get aliased upon import). In
general, avoid using `export default`.
The remaining code style is documented in [code_style.md](./code_style.md).
Contributors are encouraged to it and follow the principles set out there.
Please ensure your changes match the cosmetic style of the existing project,
and **_never_** mix cosmetic and functional changes in the same commit, as it
makes it horribly hard to review otherwise.
## Attribution
Everyone who contributes anything to Matrix is welcome to be listed in the
AUTHORS.rst file for the project in question. Please feel free to include a
change to AUTHORS.rst in your pull request to list yourself and a short
description of the area(s) you've worked on. Also, we sometimes have swag to
give away to contributors - if you feel that Matrix-branded apparel is missing
from your life, please mail us your shipping address to matrix at matrix.org
and we'll try to fix it :)
## Sign off
In order to have a concrete record that your contribution is intentional
and you agree to license it under the same terms as the project's license, we've
adopted the same lightweight approach that the Linux Kernel
(https://www.kernel.org/doc/html/latest/process/submitting-patches.html), Docker
(https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other
projects use: the DCO (Developer Certificate of Origin:
http://developercertificate.org/). This is a simple declaration that you wrote
the contribution or otherwise have the right to contribute it to Matrix:
```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
If you agree to this for your contribution, then all that's needed is to
include the line in your commit or pull request comment:
```
Signed-off-by: Your Name <your@email.example.org>
```
We accept contributions under a legally identifiable name, such as your name on
government documentation or common-law names (names claimed by legitimate usage
or repute). Unfortunately, we cannot accept anonymous contributions at this
time.
Git allows you to add this signoff automatically when using the `-s` flag to
`git commit`, which uses the name and email set in your `user.name` and
`user.email` git configs.
If you forgot to sign off your commits before making your pull request and are
on Git 2.17+ you can mass signoff using rebase:
```
git rebase --signoff origin/develop
```
## Private sign off
If you would like to provide your legal name privately to the Matrix.org
Foundation (instead of in a public commit or comment), you can do so by emailing
your legal name and a link to the pull request to dco@matrix.org. It helps to
include "sign off" or similar in the subject line. You will then be instructed
further.
Once private sign off is complete, doing so for future contributions will not
be required.
# Review expectations
See https://github.com/element-hq/element-meta/wiki/Review-process
# Merge Strategy
The preferred method for merging pull requests is squash merging to keep the
commit history trim, but it is up to the discretion of the team member merging
the change. We do not support rebase merges due to `allchange` being unable to
handle them. When merging make sure to leave the default commit title, or
at least leave the PR number at the end in brackets like by default.
When stacking pull requests, you may wish to do the following:
1. Branch from develop to your branch (branch1), push commits onto it and open a pull request
2. Branch from your base branch (branch1) to your work branch (branch2), push commits and open a pull request configuring the base to be branch1, saying in the description that it is based on your other PR.
3. Merge the first PR using a merge commit otherwise your stacked PR will need a rebase. Github will automatically adjust the base branch of your other PR to be develop.
[1]: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
# Decoding Stack Traces
Element Web has crashed and given you an obfuscated stack trace? Don't panic:
use the [Decoder Ring](https://app.element.io/decoder-ring/) (or /decoder-ring/
on any Element Web deploy). It is somewhat of a manual process, but it should
tell you what lines the stack trace corresponds to from the source maps.
+1 -4
View File
@@ -1,11 +1,8 @@
# Builder # Builder
FROM --platform=$BUILDPLATFORM node:20-bullseye as builder FROM --platform=$BUILDPLATFORM node:20-bullseye as builder
# Support custom branches of the react-sdk and js-sdk. This also helps us build # Support custom branch of the js-sdk. This also helps us build images of element-web develop.
# images of element-web develop.
ARG USE_CUSTOM_SDKS=false ARG USE_CUSTOM_SDKS=false
ARG REACT_SDK_REPO="https://github.com/matrix-org/matrix-react-sdk.git"
ARG REACT_SDK_BRANCH="master"
ARG JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git" ARG JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git"
ARG JS_SDK_BRANCH="master" ARG JS_SDK_BRANCH="master"
+263 -158
View File
@@ -1,208 +1,313 @@
[![npm](https://img.shields.io/npm/v/matrix-react-sdk)](https://www.npmjs.com/package/matrix-react-sdk) [![Chat](https://img.shields.io/matrix/element-web:matrix.org?logo=matrix)](https://matrix.to/#/#element-web:matrix.org)
![Tests](https://github.com/matrix-org/matrix-react-sdk/actions/workflows/tests.yml/badge.svg) ![Tests](https://github.com/element-hq/element-web/actions/workflows/tests.yaml/badge.svg)
[![Playwright](https://img.shields.io/badge/Playwright-end_to_end_tests-blue)](https://e2e-develop--matrix-react-sdk.netlify.app/) ![Static Analysis](https://github.com/element-hq/element-web/actions/workflows/static_analysis.yaml/badge.svg)
![Static Analysis](https://github.com/matrix-org/matrix-react-sdk/actions/workflows/static_analysis.yaml/badge.svg)
[![Localazy](https://img.shields.io/endpoint?url=https%3A%2F%2Fconnect.localazy.com%2Fstatus%2Felement-web%2Fdata%3Fcontent%3Dall%26title%3Dlocalazy%26logo%3Dtrue)](https://localazy.com/p/element-web) [![Localazy](https://img.shields.io/endpoint?url=https%3A%2F%2Fconnect.localazy.com%2Fstatus%2Felement-web%2Fdata%3Fcontent%3Dall%26title%3Dlocalazy%26logo%3Dtrue)](https://localazy.com/p/element-web)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=element-web&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=element-web)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=coverage)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=element-web&metric=coverage)](https://sonarcloud.io/summary/new_code?id=element-web)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=element-web&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=element-web)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=bugs)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=element-web&metric=bugs)](https://sonarcloud.io/summary/new_code?id=element-web)
# matrix-react-sdk # Element
This is a react-based SDK for inserting a Matrix chat/voip client into a web page. Element (formerly known as Vector and Riot) is a Matrix web client built using the [Matrix
JS SDK](https://github.com/matrix-org/matrix-js-sdk).
This package provides the React components needed to build a Matrix web client # Supported Environments
using React. It is not useable in isolation, and instead must be used from
a 'skin'. A skin provides:
- Customised implementations of presentation components. Element has several tiers of support for different environments:
- Custom CSS
- The containing application
- Zero or more 'modules' containing non-UI functionality
As of Aug 2018, the only skin that exists is - Supported
[`vector-im/element-web`](https://github.com/vector-im/element-web/); it and - Definition:
`matrix-org/matrix-react-sdk` should effectively - Issues **actively triaged**, regressions **block** the release
be considered as a single project (for instance, matrix-react-sdk bugs - Last 2 major versions of Chrome, Firefox, and Edge on desktop OSes
are currently filed against vector-im/element-web rather than this project). - Last 2 versions of Safari
- Latest release of official Element Desktop app on desktop OSes
- Desktop OSes means macOS, Windows, and Linux versions for desktop devices
that are actively supported by the OS vendor and receive security updates
- Best effort
- Definition:
- Issues **accepted**, regressions **do not block** the release
- The wider Element Products(including Element Call and the Enterprise Server Suite) do still not officially support these browsers.
- The element web project and its contributors should keep the client functioning and gracefully degrade where other sibling features (E.g. Element Call) may not function.
- Last major release of Firefox ESR and Chrome/Edge Extended Stable
- Community Supported
- Definition:
- Issues **accepted**, regressions **do not block** the release
- Community contributions are welcome to support these issues
- Mobile web for current stable version of Chrome, Firefox, and Safari on Android, iOS, and iPadOS
- Not supported
- Definition: Issues only affecting unsupported environments are **closed**
- Everything else
## Developer Guide The period of support for these tiers should last until the releases specified above, plus 1 app release cycle(2 weeks). In the case of Firefox ESR this is extended further to allow it land in Debian Stable.
Platform Targets: For accessing Element on an Android or iOS device, we currently recommend the
native apps [element-android](https://github.com/element-hq/element-android)
and [element-ios](https://github.com/element-hq/element-ios).
- Chrome, Firefox and Safari. # Getting Started
- WebRTC features (VoIP and Video calling) are only available in Chrome & Firefox.
- Mobile Web is not currently a target platform - instead please use the native
iOS (https://github.com/matrix-org/matrix-ios-kit) and Android
(https://github.com/matrix-org/matrix-android-sdk2) SDKs.
All code lands on the `develop` branch - `master` is only used for stable releases. The easiest way to test Element is to just use the hosted copy at <https://app.element.io>.
**Please file PRs against `develop`!!** The `develop` branch is continuously deployed to <https://develop.element.io>
for those who like living dangerously.
We use the same contribution guide as Element. Check it out here: To host your own instance of Element see [Installing Element Web](docs/install.md).
https://github.com/vector-im/element-web/blob/develop/CONTRIBUTING.md
Our code style is also the same as Element's: To install Element as a desktop application, see [Running as a desktop app](#running-as-a-desktop-app) below.
https://github.com/vector-im/element-web/blob/develop/code_style.md
Code should be committed as follows: # Important Security Notes
- All new components: ## Separate domains
https://github.com/matrix-org/matrix-react-sdk/tree/master/src/components
- Element-specific components:
https://github.com/vector-im/element-web/tree/master/src/components
- In practice, `matrix-react-sdk` is still evolving so fast that the
maintenance burden of customising and overriding these components for
Element can seriously impede development. So right now, there should be
very few (if any) customisations for Element.
- CSS: https://github.com/matrix-org/matrix-react-sdk/tree/master/res/css
- Theme specific CSS & resources:
https://github.com/matrix-org/matrix-react-sdk/tree/master/res/themes
React components in matrix-react-sdk come in two different flavours: We do not recommend running Element from the same domain name as your Matrix
'structures' and 'views'. Structures are stateful components which handle the homeserver. The reason is the risk of XSS (cross-site-scripting)
more complicated business logic of the app, delegating their actual presentation vulnerabilities that could occur if someone caused Element to load and render
rendering to stateless 'view' components. For instance, the RoomView component malicious user generated content from a Matrix API which then had trusted
that orchestrates the act of visualising the contents of a given Matrix chat access to Element (or other apps) due to sharing the same domain.
room tracks lots of state for its child components which it passes into them for
visual rendering via props.
Good separation between the components is maintained by adopting various best We have put some coarse mitigations into place to try to protect against this
practices that anyone working with the SDK needs to be aware of and uphold: situation, but it's still not good practice to do it in the first place. See
<https://github.com/element-hq/element-web/issues/1977> for more details.
- Components are named with upper camel case (e.g. views/rooms/EventTile.js) ## Configuration best practices
- They are organised in a typically two-level hierarchy - first whether the Unless you have special requirements, you will want to add the following to
component is a view or a structure, and then a broad functional grouping your web server configuration when hosting Element Web:
(e.g. 'rooms' here)
- The view's CSS file MUST have the same name (e.g. view/rooms/MessageTile.css). - The `X-Frame-Options: SAMEORIGIN` header, to prevent Element Web from being
CSS for matrix-react-sdk currently resides in framed and protect from [clickjacking][owasp-clickjacking].
https://github.com/matrix-org/matrix-react-sdk/tree/master/res/css. - The `frame-ancestors 'self'` directive to your `Content-Security-Policy`
header, as the modern replacement for `X-Frame-Options` (though both should be
included since not all browsers support it yet, see
[this][owasp-clickjacking-csp]).
- The `X-Content-Type-Options: nosniff` header, to [disable MIME
sniffing][mime-sniffing].
- The `X-XSS-Protection: 1; mode=block;` header, for basic XSS protection in
legacy browsers.
- Per-view CSS is optional - it could choose to inherit all its styling from [mime-sniffing]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#mime_sniffing
the context of the rest of the app, although this is unusual for any but [owasp-clickjacking-csp]: https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html#content-security-policy-frame-ancestors-examples
- Theme specific CSS & resources: [owasp-clickjacking]: https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html
https://github.com/matrix-org/matrix-react-sdk/tree/master/res/themes
structural components (lacking presentation logic) and the simplest view
components.
- The view MUST _only_ refer to the CSS rules defined in its own CSS file. If you are using nginx, this would look something like the following:
'Stealing' styling information from other components (including parents)
is not cool, as it breaks the independence of the components.
- CSS classes are named with an app-specific name-spacing prefix to try to ```
avoid CSS collisions. The base skin shipped by Matrix.org with the add_header X-Frame-Options SAMEORIGIN;
matrix-react-sdk uses the naming prefix "mx*". A company called Yoyodyne add_header X-Content-Type-Options nosniff;
Inc might use a prefix like "yy*" for its app-specific classes. add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "frame-ancestors 'self'";
```
- CSS classes use upper camel case when they describe React components - e.g. For Apache, the configuration looks like:
.mx_MessageTile is the selector for the CSS applied to a MessageTile view.
- CSS classes for DOM elements within a view which aren't components are named ```
by appending a lower camel case identifier to the view's class name - e.g. Header set X-Frame-Options SAMEORIGIN
.mx_MessageTile_randomDiv is how you'd name the class of an arbitrary div Header set X-Content-Type-Options nosniff
within the MessageTile view. Header set X-XSS-Protection "1; mode=block"
Header set Content-Security-Policy "frame-ancestors 'self'"
```
- We deliberately use vanilla CSS 3.0 to avoid adding any more magic Note: In case you are already setting a `Content-Security-Policy` header
dependencies into the mix than we already have. App developers are welcome elsewhere, you should modify it to include the `frame-ancestors` directive
to use whatever floats their boat however. In future we'll start using instead of adding that last line.
css-next to pull in features like CSS variable support.
- The CSS for a component can override the rules for child components. # Building From Source
For instance, .mx*RoomList .mx_RoomTile {} would be the selector to override
styles of RoomTiles when viewed in the context of a RoomList view.
Overrides \_must* be scoped to the View's CSS class - i.e. don't just define
.mx_RoomTile {} in RoomList.css - only RoomTile.css is allowed to define its
own CSS. Instead, say .mx_RoomList .mx_RoomTile {} to scope the override
only to the context of RoomList views. N.B. overrides should be relatively
rare as in general CSS inheritance should be enough.
- Components should render only within the bounding box of their outermost DOM
element. Page-absolute positioning and negative CSS margins and similar are
generally not cool and stop the component from being reused easily in
different places.
Originally `matrix-react-sdk` followed the Atomic design pattern as per
http://patternlab.io to try to encourage a modular architecture. However, we
found that the grouping of components into atoms/molecules/organisms
made them harder to find relative to a functional split, and didn't emphasise
the distinction between 'structural' and 'view' components, so we backed away
from it.
## Github Issues
All issues should be filed under https://github.com/vector-im/element-web/issues
for now.
## Development
Element is a modular webapp built with modern ES6 and uses a Node.js build system.
Ensure you have the latest LTS version of Node.js installed. Ensure you have the latest LTS version of Node.js installed.
Using `yarn` instead of `npm` is recommended. Please see the Yarn 1 [install Using `yarn` instead of `npm` is recommended. Please see the Yarn [install
guide](https://classic.yarnpkg.com/docs/install) if you do not have it guide](https://classic.yarnpkg.com/en/docs/install) if you do not have it already.
already. This project has not yet been migrated to Yarn 2, so please ensure
`yarn --version` shows a version from the 1.x series.
`matrix-react-sdk` depends on 1. Install or update `node.js` so that your `node` is at least the current recommended LTS.
[`matrix-js-sdk`](https://github.com/matrix-org/matrix-js-sdk). To make use of 1. Install `yarn` if not present already.
changes in the latter and to ensure tests run against the develop branch of 1. Clone the repo: `git clone https://github.com/element-hq/element-web.git`.
`matrix-js-sdk`, you should set up `matrix-js-sdk`: 1. Switch to the element-web directory: `cd element-web`.
1. Install the prerequisites: `yarn install`.
- If you're using the `develop` branch, then it is recommended to set up a
proper development environment (see [Setting up a dev
environment](#setting-up-a-dev-environment) below). Alternatively, you
can use <https://develop.element.io> - the continuous integration release of
the develop branch.
1. Configure the app by copying `config.sample.json` to `config.json` and
modifying it. See the [configuration docs](docs/config.md) for details.
1. `yarn dist` to build a tarball to deploy. Untaring this file will give
a version-specific directory containing all the files that need to go on your
web server.
Note that `yarn dist` is not supported on Windows, so Windows users can run `yarn build`,
which will build all the necessary files into the `webapp` directory. The version of Element
will not appear in Settings without using the dist script. You can then mount the
`webapp` directory on your web server to actually serve up the app, which is
entirely static content.
# Running as a Desktop app
Element can also be run as a desktop app, wrapped in Electron. You can download a
pre-built version from <https://element.io/get-started> or, if you prefer,
build it yourself.
To build it yourself, follow the instructions at <https://github.com/element-hq/element-desktop>.
Many thanks to @aviraldg for the initial work on the Electron integration.
The [configuration docs](docs/config.md#desktop-app-configuration) show how to override the desktop app's default settings if desired.
# config.json
Element supports a variety of settings to configure default servers, behaviour, themes, etc.
See the [configuration docs](docs/config.md) for more details.
# Labs Features
Some features of Element may be enabled by flags in the `Labs` section of the settings.
Some of these features are described in [labs.md](https://github.com/element-hq/element-web/blob/develop/docs/labs.md).
# Caching requirements
Element requires the following URLs not to be cached, when/if you are serving Element from your own webserver:
```
/config.*.json
/i18n
/home
/sites
/index.html
```
We also recommend that you force browsers to re-validate any cached copy of Element on page load by configuring your
webserver to return `Cache-Control: no-cache` for `/`. This ensures the browser will fetch a new version of Element on
the next page load after it's been deployed. Note that this is already configured for you in the nginx config of our
Dockerfile.
# Development
Before attempting to develop on Element you **must** read the [developer guide
for `matrix-react-sdk`](https://github.com/matrix-org/matrix-react-sdk#developer-guide), which
also defines the design, architecture and style for Element too.
Read the [Choosing an issue](docs/choosing-an-issue.md) page for some guidance
about where to start. Before starting work on a feature, it's best to ensure
your plan aligns well with our vision for Element. Please chat with the team in
[#element-dev:matrix.org](https://matrix.to/#/#element-dev:matrix.org) before
you start so we can ensure it's something we'd be willing to merge.
You should also familiarise yourself with the ["Here be Dragons" guide
](https://docs.google.com/document/d/12jYzvkidrp1h7liEuLIe6BMdU0NUjndUYI971O06ooM)
to the tame & not-so-tame dragons (gotchas) which exist in the codebase.
The idea of Element is to be a relatively lightweight "skin" of customisations on
top of the underlying `matrix-react-sdk`. `matrix-react-sdk` provides both the
higher and lower level React components useful for building Matrix communication
apps using React.
Please note that Element is intended to run correctly without access to the public
internet. So please don't depend on resources (JS libs, CSS, images, fonts)
hosted by external CDNs or servers but instead please package all dependencies
into Element itself.
# Setting up a dev environment
Much of the functionality in Element is actually in the `matrix-js-sdk` module.
It is possible to set these up in a way that makes it easy to track the `develop` branches
in git and to make local changes without having to manually rebuild each time.
First clone and build `matrix-js-sdk`:
```bash ```bash
git clone https://github.com/matrix-org/matrix-js-sdk git clone https://github.com/matrix-org/matrix-js-sdk.git
cd matrix-js-sdk pushd matrix-js-sdk
git checkout develop
yarn link yarn link
yarn install yarn install
popd
``` ```
Then check out `matrix-react-sdk` and pull in dependencies: Clone the repo and switch to the `element-web` directory:
```bash
git clone https://github.com/element-hq/element-web.git
cd element-web
```
Configure the app by copying `config.sample.json` to `config.json` and
modifying it. See the [configuration docs](docs/config.md) for details.
Finally, build and start Element itself:
```bash ```bash
git clone https://github.com/matrix-org/matrix-react-sdk
cd matrix-react-sdk
git checkout develop
yarn link matrix-js-sdk yarn link matrix-js-sdk
yarn install yarn install
yarn start
``` ```
See the [help for `yarn link`](https://classic.yarnpkg.com/docs/cli/link) for Wait a few seconds for the initial build to finish; you should see something like:
more details about this.
### Running tests ```
[element-js] <s> [webpack.Progress] 100%
[element-js]
[element-js] ℹ 「wdm」: 1840 modules
[element-js] ℹ 「wdm」: Compiled successfully.
```
Ensure you've followed the above development instructions and then: Remember, the command will not terminate since it runs the web server
and rebuilds source files when they change. This development server also
disables caching, so do NOT use it in production.
```bash Open <http://127.0.0.1:8080/> in your browser to see your newly built Element.
**Note**: The build script uses inotify by default on Linux to monitor directories
for changes. If the inotify limits are too low your build will fail silently or with
`Error: EMFILE: too many open files`. To avoid these issues, we recommend a watch limit
of at least `128M` and instance limit around `512`.
You may be interested in issues [#15750](https://github.com/element-hq/element-web/issues/15750) and
[#15774](https://github.com/element-hq/element-web/issues/15774) for further details.
To set a new inotify watch and instance limit, execute:
```
sudo sysctl fs.inotify.max_user_watches=131072
sudo sysctl fs.inotify.max_user_instances=512
sudo sysctl -p
```
If you wish, you can make the new limits permanent, by executing:
```
echo fs.inotify.max_user_watches=131072 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_instances=512 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
```
---
When you make changes to `matrix-js-sdk` they should be automatically picked up by webpack and built.
If any of these steps error with, `file table overflow`, you are probably on a mac
which has a very low limit on max open files. Run `ulimit -Sn 1024` and try again.
You'll need to do this in each new terminal you open before building Element.
## Running the tests
There are a number of application-level tests in the `tests` directory; these
are designed to run with Jest and JSDOM. To run them
```
yarn test yarn test
``` ```
### Running lint
To check your code complies with the project style, ensure you've followed the
above development instructions and then:
```bash
yarn lint
```
### Dependency problems
If you see errors (particularly "Cannot find module") running the lint or test
commands, and `yarn install` doesn't fix them, it may be because
yarn is not fetching git dependencies eagerly enough.
Try running this:
```bash
yarn cache clean && yarn install --force
```
Now the yarn commands should work as normal.
### End-to-End tests ### End-to-End tests
We use Playwright and Element Web for end-to-end tests. See See [matrix-react-sdk](https://github.com/matrix-org/matrix-react-sdk/#end-to-end-tests) for how to run the end-to-end tests.
[`docs/playwright.md`](docs/playwright.md) for more information.
# Translations
To add a new translation, head to the [translating doc](docs/translating.md).
For a developer guide, see the [translating dev doc](docs/translating-dev.md).
# Triaging issues
Issues are triaged by community members and the Web App Team, following the [triage process](https://github.com/element-hq/element-meta/wiki/Triage-process).
We use [issue labels](https://github.com/element-hq/element-meta/wiki/Issue-labelling) to sort all incoming issues.
+10 -1
View File
@@ -1,5 +1,5 @@
module.exports = { module.exports = {
sourceMaps: "inline", sourceMaps: true,
presets: [ presets: [
[ [
"@babel/preset-env", "@babel/preset-env",
@@ -20,6 +20,15 @@ module.exports = {
"@babel/plugin-proposal-export-default-from", "@babel/plugin-proposal-export-default-from",
"@babel/plugin-transform-numeric-separator", "@babel/plugin-transform-numeric-separator",
"@babel/plugin-transform-object-rest-spread", "@babel/plugin-transform-object-rest-spread",
"@babel/plugin-transform-optional-chaining",
"@babel/plugin-transform-nullish-coalescing-operator",
// transform logical assignment (??=, ||=, &&=). preset-env doesn't
// normally bother with these (presumably because all the target
// browsers support it natively), but they make our webpack version (or
// something downstream of babel, at least) fall over.
"@babel/plugin-transform-logical-assignment-operators",
"@babel/plugin-syntax-dynamic-import", "@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime", "@babel/plugin-transform-runtime",
], ],
-1
View File
@@ -5,7 +5,6 @@ adjacent to. As of writing, these are:
- element-desktop - element-desktop
- element-web - element-web
- matrix-react-sdk
- matrix-js-sdk - matrix-js-sdk
Other projects might extend this code style for increased strictness. For example, matrix-events-sdk Other projects might extend this code style for increased strictness. For example, matrix-events-sdk
+38 -6
View File
@@ -2,12 +2,48 @@
- [Introduction](../README.md) - [Introduction](../README.md)
# Customisation # Usage
- [Skinning](skinning.md) - [Betas](betas.md)
- [Labs](labs.md)
# Setup
- [Install](install.md)
- [Config](config.md)
- [Custom home page](custom-home.md)
- [Kubernetes](kubernetes.md)
- [Jitsi](jitsi.md)
- [Encryption](e2ee.md)
# Build
- [Customisations](customisations.md)
- [Modules](modules.md)
- [Native Node modules](native-node-modules.md)
# Contribution
- [Choosing an issue](choosing-an-issue.md)
- [Translation](translating.md)
- [Netlify builds](pr-previews.md)
- [Code review](review.md)
# Development
- [App load order](app-load.md)
- [Translation](translating-dev.md)
- [Theming](theming.md)
- [Playwright end to end tests](playwright.md)
- [Memory profiling](memory-profiles-and-leaks.md)
- [Jitsi](jitsi-dev.md)
- [Feature flags](feature-flags.md)
- [OIDC and delegated authentication](oidc.md)
- [Release Process](release.md)
# Deep dive # Deep dive
- [Skinning](skinning.md)
- [Cider editor](ciderEditor.md) - [Cider editor](ciderEditor.md)
- [Iconography](icons.md) - [Iconography](icons.md)
- [Jitsi](jitsi.md) - [Jitsi](jitsi.md)
@@ -17,7 +53,3 @@
- [Scrolling](scrolling.md) - [Scrolling](scrolling.md)
- [Usercontent](usercontent.md) - [Usercontent](usercontent.md)
- [Widget layouts](widget-layouts.md) - [Widget layouts](widget-layouts.md)
# Testing
- [Playwright end to end](playwright.md)
+1 -2
View File
@@ -19,8 +19,7 @@ If you're looking for inspiration on where to start, keep reading!
All the issues for Element Web live in the All the issues for Element Web live in the
[element-web](https://github.com/element-hq/element-web) repository, including [element-web](https://github.com/element-hq/element-web) repository, including
issues that actually need fixing in `matrix-react-sdk` or one of the related issues that actually need fixing in one of the related repos.
repos.
The first place to look is for The first place to look is for
[issues tagged with "good first issue"](https://github.com/element-hq/element-web/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22). [issues tagged with "good first issue"](https://github.com/element-hq/element-web/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
+1 -1
View File
@@ -1,7 +1,7 @@
# The CIDER (Contenteditable-Input-Diff-Error-Reconcile) editor # The CIDER (Contenteditable-Input-Diff-Error-Reconcile) editor
The CIDER editor is a custom editor written for Element. The CIDER editor is a custom editor written for Element.
Most of the code can be found in the `/editor/` directory of the `matrix-react-sdk` project. Most of the code can be found in the `/editor/` directory.
It is used to power the composer main composer (both to send and edit messages), and might be used for other usecases where autocomplete is desired (invite box, ...). It is used to power the composer main composer (both to send and edit messages), and might be used for other usecases where autocomplete is desired (invite box, ...).
## High-level overview. ## High-level overview.
+1 -1
View File
@@ -109,7 +109,7 @@ instance. As of writing those settings are not fully documented, however a few a
} }
``` ```
These values will take priority over the hardcoded defaults for the settings. For a list of available settings, see These values will take priority over the hardcoded defaults for the settings. For a list of available settings, see
[Settings.tsx](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.tsx). [Settings.tsx](https://github.com/element-hq/element-web/blob/develop/src/settings/Settings.tsx).
## Customisation & branding ## Customisation & branding
+2 -2
View File
@@ -12,7 +12,7 @@ Element Web and the React SDK support "customisation points" that can be used to
easily add custom logic specific to a particular deployment of Element Web. easily add custom logic specific to a particular deployment of Element Web.
An example of this is the [security customisations An example of this is the [security customisations
module](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/customisations/Security.ts). module](https://github.com/element-hq/element-web/blob/develop/src/customisations/Security.ts).
This module in the React SDK only defines some empty functions and their types: This module in the React SDK only defines some empty functions and their types:
it does not do anything by default. it does not do anything by default.
@@ -54,7 +54,7 @@ UI for some actions can be hidden via the ComponentVisibility customisation:
- creating rooms, - creating rooms,
- creating spaces, - creating spaces,
To customise visibility create a customisation module from [ComponentVisibility](https://github.com/matrix-org/matrix-react-sdk/blob/master/src/customisations/ComponentVisibility.ts) following the instructions above. To customise visibility create a customisation module from [ComponentVisibility](https://github.com/element-hq/element-web/blob/master/src/customisations/ComponentVisibility.ts) following the instructions above.
`shouldShowComponent` determines whether the active MatrixClient user should be able to use `shouldShowComponent` determines whether the active MatrixClient user should be able to use
the given UI component. When `shouldShowComponent` returns falsy all UI components for that feature will be hidden. the given UI component. When `shouldShowComponent` returns falsy all UI components for that feature will be hidden.
+3 -3
View File
@@ -35,7 +35,7 @@ clients commit to doing the associated clean up work once a feature stabilises.
When starting work on a feature, we should create a matching feature flag: When starting work on a feature, we should create a matching feature flag:
1. Add a new 1. Add a new
[setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.tsx) [setting](https://github.com/element-hq/element-web/blob/develop/src/settings/Settings.tsx)
of the form: of the form:
```js ```js
@@ -93,14 +93,14 @@ Once we're confident that a feature is working well, we should remove or convert
If the feature is meant to be turned off/on by the user: If the feature is meant to be turned off/on by the user:
1. Remove `isFeature` from the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts) 1. Remove `isFeature` from the [setting](https://github.com/element-hq/element-web/blob/develop/src/settings/Settings.ts)
2. Change the `default` to `true` (if desired). 2. Change the `default` to `true` (if desired).
3. Remove the feature from the [labs documentation](https://github.com/element-hq/element-web/blob/develop/docs/labs.md) 3. Remove the feature from the [labs documentation](https://github.com/element-hq/element-web/blob/develop/docs/labs.md)
4. Celebrate! 🥳 4. Celebrate! 🥳
If the feature is meant to be forced on (non-configurable): If the feature is meant to be forced on (non-configurable):
1. Remove the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts) 1. Remove the [setting](https://github.com/element-hq/element-web/blob/develop/src/settings/Settings.ts)
2. Remove all `getValue` lines that test for the feature. 2. Remove all `getValue` lines that test for the feature.
3. Remove the feature from the [labs documentation](https://github.com/element-hq/element-web/blob/develop/docs/labs.md) 3. Remove the feature from the [labs documentation](https://github.com/element-hq/element-web/blob/develop/docs/labs.md)
4. If applicable, remove the feature state from 4. If applicable, remove the feature state from
-2
View File
@@ -67,8 +67,6 @@ element-web branch and then run:
```bash ```bash
docker build -t \ docker build -t \
--build-arg USE_CUSTOM_SDKS=true \ --build-arg USE_CUSTOM_SDKS=true \
--build-arg REACT_SDK_REPO="https://github.com/matrix-org/matrix-react-sdk.git" \
--build-arg REACT_SDK_BRANCH="develop" \
--build-arg JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git" \ --build-arg JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git" \
--build-arg JS_SDK_BRANCH="develop" \ --build-arg JS_SDK_BRANCH="develop" \
. .
+73
View File
@@ -1,3 +1,76 @@
# Jitsi in Element
Element uses [Jitsi](https://jitsi.org/) for conference calls, which provides options for
self-hosting your own server and supports most major platforms.
1:1 calls, or calls between you and one other person, do not use Jitsi. Instead, those
calls work directly between clients or via TURN servers configured on the respective
homeservers.
There's a number of ways to start a Jitsi call: the easiest way is to click on the
voice or video buttons near the message composer in a room with more than 2 people. This
will add a Jitsi widget which allows anyone in the room to join.
Integration managers (available through the 4 squares in the top right of the room) may
provide their own approaches for adding Jitsi widgets.
## Configuring Element to use your self-hosted Jitsi server
You can host your own Jitsi server to use with Element. It's usually advisable to use a recent
version of Jitsi. In particular, versions older than around 6826 will cause problems with
Element 1.9.10 or newer.
Element will use the Jitsi server that is embedded in the widget, even if it is not the
one you configured. This is because conference calls must be held on a single Jitsi
server and cannot be split over multiple servers.
However, you can configure Element to _start_ a conference with your Jitsi server by adding
to your [config](./config.md) the following:
```json
{
"jitsi": {
"preferred_domain": "your.jitsi.example.org"
}
}
```
Element's default is `meet.element.io` (a free service offered by Element). `meet.jit.si`
is an instance hosted by Jitsi themselves and is also free to use.
Once you've applied the config change, refresh Element and press the call button. This
should start a new conference on your Jitsi server.
**Note**: The widget URL will point to a `jitsi.html` page hosted by Element. The Jitsi
domain will appear later in the URL as a configuration parameter.
**Hint**: If you want everyone on your homeserver to use the same Jitsi server by
default, and you are using element-web 1.6 or newer, set the following on your homeserver's
`/.well-known/matrix/client` config:
```json
{
"im.vector.riot.jitsi": {
"preferredDomain": "your.jitsi.example.org"
}
}
```
## Element Android
Element Android (1.0.5+) supports custom Jitsi domains, similar to Element Web above.
1:1 calls, or calls between you and one other person, do not use Jitsi. Instead, those
calls work directly between clients or via TURN servers configured on the respective
homeservers.
For rooms with more than 2 joined members, when creating a Jitsi conference via call/video buttons of the toolbar (not via integration manager), Element Android will create a widget using the [wrapper](https://github.com/element-hq/element-web/blob/develop/docs/jitsi-dev.md) hosted on `app.element.io`.
The domain used is the one specified by the `/.well-known/matrix/client` endpoint, and if not present it uses the fallback defined in `config.json` (meet.element.io)
For active Jitsi widgets in the room, a native Jitsi widget UI is created and points to the instance specified in the `domain` key of the widget content data.
Element Android manages allowed native widgets permissions a bit differently than web widgets (as the data shared are different and never shared with the widget URL). For Jitsi widgets, permissions are requested only once per domain (consent saved in account data).
# Jitsi Wrapper # Jitsi Wrapper
**Note**: These are developer docs. Please consult your client's documentation for **Note**: These are developer docs. Please consult your client's documentation for
+3 -3
View File
@@ -23,11 +23,11 @@ the current directory as the build context (the `.` in `docker build -t my-eleme
## Writing modules ## Writing modules
While writing modules is meant to be easy, not everything is possible yet. For modules which want to do something we haven't While writing modules is meant to be easy, not everything is possible yet. For modules which want to do something we haven't
exposed in the module API, the module API will need to be updated. This means a PR to both the exposed in the module API, the module API will need to be updated. This means a PR to both this repo
[`matrix-react-sdk`](https://github.com/matrix-org/matrix-react-sdk) and [`matrix-react-sdk-module-api`](https://github.com/matrix-org/matrix-react-sdk-module-api). and [`matrix-react-sdk-module-api`](https://github.com/matrix-org/matrix-react-sdk-module-api).
Once your change to the module API is accepted, the `@matrix-org/react-sdk-module-api` dependency gets updated at the Once your change to the module API is accepted, the `@matrix-org/react-sdk-module-api` dependency gets updated at the
`matrix-react-sdk` and `element-web` layers (usually by us, the maintainers) to ensure your module can operate. `element-web` layer (usually by us, the maintainers) to ensure your module can operate.
If you're not adding anything to the module API, or your change was accepted per above, then start off with a clone of If you're not adding anything to the module API, or your change was accepted per above, then start off with a clone of
our [ILAG module](https://github.com/element-hq/element-web-ilag-module) which will give you a general idea for what the our [ILAG module](https://github.com/element-hq/element-web-ilag-module) which will give you a general idea for what the
+6 -16
View File
@@ -22,7 +22,7 @@ The master branch is the most stable as it is the very latest non-RC release. De
<details><summary><h1>Versions</h1></summary><blockquote> <details><summary><h1>Versions</h1></summary><blockquote>
The matrix-js-sdk follows semver, the matrix-react-sdk loosely follows semver, most releases for both will bump the minor version number. The matrix-js-sdk follows semver, most releases will bump the minor version number.
Breaking changes will bump the major version number. Breaking changes will bump the major version number.
Element Web & Element Desktop do not follow semver and always have matching version numbers. The patch version number is normally incremented for every release. Element Web & Element Desktop do not follow semver and always have matching version numbers. The patch version number is normally incremented for every release.
@@ -80,11 +80,10 @@ This label will automagically convert to `X-Release-Blocker` at the conclusion o
<details><summary><h1>Repositories</h1></summary><blockquote> <details><summary><h1>Repositories</h1></summary><blockquote>
This release process revolves around our four main repositories: This release process revolves around our main repositories:
- [Element Desktop](https://github.com/element-hq/element-desktop/) - [Element Desktop](https://github.com/element-hq/element-desktop/)
- [Element Web](https://github.com/element-hq/element-web/) - [Element Web](https://github.com/element-hq/element-web/)
- [Matrix React SDK](https://github.com/matrix-org/matrix-react-sdk/)
- [Matrix JS SDK](https://github.com/matrix-org/matrix-js-sdk/) - [Matrix JS SDK](https://github.com/matrix-org/matrix-js-sdk/)
We own other repositories, but they have more ad-hoc releases and are not part of the bi-weekly cycle: We own other repositories, but they have more ad-hoc releases and are not part of the bi-weekly cycle:
@@ -117,14 +116,13 @@ flowchart TD
subgraph Releasing subgraph Releasing
R1[[Releasing matrix-js-sdk]] R1[[Releasing matrix-js-sdk]]
R2[[Releasing matrix-react-sdk]] R2[[Releasing element-web]]
R3[[Releasing element-web]] R3[[Releasing element-desktop]]
R4[[Releasing element-desktop]]
R1 --> R2 --> R3 --> R4 R1 --> R2 --> R3
end end
R4 --> D1 R3 --> D1
subgraph Deploying subgraph Deploying
D1[\Deploy staging.element.io/] D1[\Deploy staging.element.io/]
@@ -198,12 +196,6 @@ switched back to the version of the dependency from the master branch to not lea
- [ ] Make any changes to the release notes in the draft release as are necessary - **Do not click publish, only save draft** - [ ] Make any changes to the release notes in the draft release as are necessary - **Do not click publish, only save draft**
- [ ] Kick off a release using [the automation](https://github.com/matrix-org/matrix-js-sdk/actions/workflows/release.yml) - making sure to select the right type of release. For anything other than an RC: choose final. You should not need to ever switch off either of the Publishing options. - [ ] Kick off a release using [the automation](https://github.com/matrix-org/matrix-js-sdk/actions/workflows/release.yml) - making sure to select the right type of release. For anything other than an RC: choose final. You should not need to ever switch off either of the Publishing options.
### Matrix React SDK
- [ ] Check the draft release which has been generated by [the automation](https://github.com/element-hq/matrix-react-sdk/actions/workflows/release-drafter.yml)
- [ ] Make any changes to the release notes in the draft release as are necessary - **Do not click publish, only save draft**
- [ ] Kick off a release using [the automation](https://github.com/element-hq/matrix-react-sdk/actions/workflows/release.yml) - making sure to select the right type of release. For anything other than an RC: choose final. You should not need to ever switch off either of the Publishing options.
### Element Web ### Element Web
- [ ] Check the draft release which has been generated by [the automation](https://github.com/element-hq/element-web/actions/workflows/release-drafter.yml) - [ ] Check the draft release which has been generated by [the automation](https://github.com/element-hq/element-web/actions/workflows/release-drafter.yml)
@@ -256,8 +248,6 @@ For the first RC of a given release cycle do these steps:
- [ ] Go to the [matrix-js-sdk Renovate dashboard](https://github.com/matrix-org/matrix-js-sdk/issues/2406) and click the checkbox to create/update its PRs. - [ ] Go to the [matrix-js-sdk Renovate dashboard](https://github.com/matrix-org/matrix-js-sdk/issues/2406) and click the checkbox to create/update its PRs.
- [ ] Go to the [matrix-react-sdk Renovate dashboard](https://github.com/element-hq/matrix-react-sdk/issues/6) and click the checkbox to create/update its PRs.
- [ ] Go to the [element-web Renovate dashboard](https://github.com/element-hq/element-web/issues/22941) and click the checkbox to create/update its PRs. - [ ] Go to the [element-web Renovate dashboard](https://github.com/element-hq/element-web/issues/22941) and click the checkbox to create/update its PRs.
- [ ] Go to the [element-desktop Renovate dashboard](https://github.com/element-hq/element-desktop/issues/465) and click the checkbox to create/update its PRs. - [ ] Go to the [element-desktop Renovate dashboard](https://github.com/element-hq/element-desktop/issues/465) and click the checkbox to create/update its PRs.
+3 -7
View File
@@ -3,21 +3,17 @@
Themes are a very basic way of providing simple alternative look & feels to the Themes are a very basic way of providing simple alternative look & feels to the
Element app via CSS & custom imagery. Element app via CSS & custom imagery.
They are _NOT_ co be confused with 'skins', which describe apps which sit on top
of matrix-react-sdk - e.g. in theory Element itself is a react-sdk skin.
As of March 2022, skins are not fully supported; Element is the only available skin.
To define a theme for Element: To define a theme for Element:
1. Pick a name, e.g. `teal`. at time of writing we have `light` and `dark`. 1. Pick a name, e.g. `teal`. at time of writing we have `light` and `dark`.
2. Fork `src/skins/vector/css/themes/dark.pcss` to be `teal.pcss` 2. Fork `res/themes/dark/css/dark.pcss` to be `teal.pcss`
3. Fork `src/skins/vector/css/themes/_base.pcss` to be `_teal.pcss` 3. Fork `res/themes/dark/css/_base.pcss` to be `_teal.pcss`
4. Override variables in `_teal.pcss` as desired. You may wish to delete ones 4. Override variables in `_teal.pcss` as desired. You may wish to delete ones
which don't differ from `_base.pcss`, to make it clear which are being which don't differ from `_base.pcss`, to make it clear which are being
overridden. If every single colour is being changed (as per `_dark.pcss`) overridden. If every single colour is being changed (as per `_dark.pcss`)
then you might as well keep them all. then you might as well keep them all.
5. Add the theme to the list of entrypoints in webpack.config.js 5. Add the theme to the list of entrypoints in webpack.config.js
6. Add the theme to the list of themes in matrix-react-sdk's UserSettings.js 6. Add the theme to the list of themes in theme.ts
7. Sit back and admire your handywork. 7. Sit back and admire your handywork.
In future, the assets for a theme will probably be gathered together into a In future, the assets for a theme will probably be gathered together into a
+2 -3
View File
@@ -3,13 +3,12 @@
## Requirements ## Requirements
- A working [Development Setup](../README.md#setting-up-a-dev-environment) - A working [Development Setup](../README.md#setting-up-a-dev-environment)
- Including up-to-date versions of matrix-react-sdk and matrix-js-sdk
- Latest LTS version of Node.js installed - Latest LTS version of Node.js installed
- Be able to understand English - Be able to understand English
## Translating strings vs. marking strings for translation ## Translating strings vs. marking strings for translation
Translating strings are done with the `_t()` function found in matrix-react-sdk/lib/languageHandler.js. Translating strings are done with the `_t()` function found in `languageHandler.tsx`.
It is recommended to call this function wherever you introduce a string constant which should be translated. It is recommended to call this function wherever you introduce a string constant which should be translated.
However, translating can not be performed until after the translation system has been initialized. However, translating can not be performed until after the translation system has been initialized.
Thus, sometimes translation must be performed at a different location in the source code than where the string is introduced. Thus, sometimes translation must be performed at a different location in the source code than where the string is introduced.
@@ -49,7 +48,7 @@ We are aiming for a set of common strings to be shared then some more localised
## Adding new strings ## Adding new strings
1. Check if the import `import { _t } from 'matrix-react-sdk/src/languageHandler';` is present. If not add it to the other import statements. Also import `_td` if needed. 1. Check if the import `import { _t } from ".../languageHandler";` is present. If not add it to the other import statements. Also import `_td` if needed.
1. Add `_t()` to your string passing the translation key you come up with based on the rules above. If the string is introduced at a point before the translation system has not yet been initialized, use `_td()` instead, and call `_t()` at the appropriate time. 1. Add `_t()` to your string passing the translation key you come up with based on the rules above. If the string is introduced at a point before the translation system has not yet been initialized, use `_td()` instead, and call `_t()` at the appropriate time.
1. Run `yarn i18n` to add the keys to `src/i18n/strings/en_EN.json` 1. Run `yarn i18n` to add the keys to `src/i18n/strings/en_EN.json`
1. Modify the new entries in `src/i18n/strings/en_EN.json` with the English (UK) translations for the added keys. 1. Modify the new entries in `src/i18n/strings/en_EN.json` with the English (UK) translations for the added keys.
+13 -1
View File
@@ -12,20 +12,31 @@ import type { Config } from "jest";
const config: Config = { const config: Config = {
testEnvironment: "jsdom", testEnvironment: "jsdom",
testMatch: ["<rootDir>/test/**/*-test.[jt]s?(x)"], testEnvironmentOptions: {
url: "http://localhost/",
},
testMatch: ["<rootDir>/test/**/*-test.[tj]s?(x)"],
globalSetup: "<rootDir>/test/globalSetup.ts", globalSetup: "<rootDir>/test/globalSetup.ts",
setupFiles: ["jest-canvas-mock", "web-streams-polyfill/polyfill"], setupFiles: ["jest-canvas-mock", "web-streams-polyfill/polyfill"],
setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts"], setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts"],
moduleNameMapper: { moduleNameMapper: {
"\\.(css|scss|pcss)$": "<rootDir>/__mocks__/cssMock.js",
"\\.(gif|png|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js", "\\.(gif|png|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js",
"\\.svg$": "<rootDir>/__mocks__/svg.js", "\\.svg$": "<rootDir>/__mocks__/svg.js",
"\\$webapp/i18n/languages.json": "<rootDir>/__mocks__/languages.json", "\\$webapp/i18n/languages.json": "<rootDir>/__mocks__/languages.json",
"^react$": "<rootDir>/node_modules/react",
"^react-dom$": "<rootDir>/node_modules/react-dom",
"^matrix-js-sdk$": "<rootDir>/node_modules/matrix-js-sdk/src",
"^matrix-react-sdk$": "<rootDir>/src",
"decoderWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js", "decoderWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js",
"decoderWorker\\.min\\.wasm": "<rootDir>/__mocks__/empty.js", "decoderWorker\\.min\\.wasm": "<rootDir>/__mocks__/empty.js",
"waveWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js", "waveWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js",
"context-filter-polyfill": "<rootDir>/__mocks__/empty.js",
"FontManager.ts": "<rootDir>/__mocks__/FontManager.js",
"workers/(.+)Factory": "<rootDir>/__mocks__/workerFactoryMock.js", "workers/(.+)Factory": "<rootDir>/__mocks__/workerFactoryMock.js",
"^!!raw-loader!.*": "jest-raw-loader", "^!!raw-loader!.*": "jest-raw-loader",
"recorderWorkletFactory": "<rootDir>/__mocks__/empty.js", "recorderWorkletFactory": "<rootDir>/__mocks__/empty.js",
"^fetch-mock$": "<rootDir>/node_modules/fetch-mock",
}, },
transformIgnorePatterns: ["/node_modules/(?!matrix-js-sdk).+$"], transformIgnorePatterns: ["/node_modules/(?!matrix-js-sdk).+$"],
collectCoverageFrom: [ collectCoverageFrom: [
@@ -37,6 +48,7 @@ const config: Config = {
coverageReporters: ["text-summary", "lcov"], coverageReporters: ["text-summary", "lcov"],
testResultsProcessor: "@casualbot/jest-sonar-reporter", testResultsProcessor: "@casualbot/jest-sonar-reporter",
prettierPath: null, prettierPath: null,
moduleDirectories: ["node_modules", "test/test-utils"],
}; };
// if we're running under GHA, enable the GHA reporter // if we're running under GHA, enable the GHA reporter
+3 -3
View File
@@ -9,13 +9,13 @@
"files": [ "files": [
{ {
"pattern": "src/i18n/strings/en_EN.json", "pattern": "src/i18n/strings/en_EN.json",
"file": "matrix-react-sdk.json", "file": "element-web.json",
"lang": "inherited" "lang": "inherited"
}, },
{ {
"group": "existing", "group": "existing",
"pattern": "src/i18n/strings/*.json", "pattern": "src/i18n/strings/*.json",
"file": "matrix-react-sdk.json", "file": "element-web.json",
"excludes": ["src/i18n/strings/en_EN.json"], "excludes": ["src/i18n/strings/en_EN.json"],
"lang": "${autodetectLang}" "lang": "${autodetectLang}"
} }
@@ -25,7 +25,7 @@
"download": { "download": {
"files": [ "files": [
{ {
"conditions": "equals: ${file}, matrix-react-sdk.json", "conditions": "equals: ${file}, element-web.json",
"output": "src/i18n/strings/${langLsrUnderscore}.json" "output": "src/i18n/strings/${langLsrUnderscore}.json"
} }
], ],
+107 -41
View File
@@ -1,77 +1,95 @@
{ {
"name": "matrix-react-sdk", "name": "element-web",
"version": "3.108.0", "version": "1.11.81",
"description": "SDK for matrix.org using React", "description": "A feature-rich client for Matrix.org",
"author": "New Vector Ltd.", "author": "New Vector Ltd.",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/element-hq/matrix-react-sdk" "url": "https://github.com/element-hq/element-web"
}, },
"license": "AGPL-3.0-only OR GPL-3.0-only", "license": "AGPL-3.0-only OR GPL-3.0-only",
"files": [ "files": [
"lib", "lib",
"res", "res",
"src", "src",
"webpack.config.js",
"scripts", "scripts",
"git-revision.txt",
"docs", "docs",
"header", "release.sh",
"deploy",
"CHANGELOG.md", "CHANGELOG.md",
"CONTRIBUTING.rst", "CONTRIBUTING.rst",
"LICENSE", "LICENSE",
"README.md", "README.md",
"AUTHORS.rst",
"package.json", "package.json",
".stylelintrc.js" "contribute.json"
], ],
"engines": { "style": "bundle.css",
"node": ">=20.0.0"
},
"main": "./lib/index.ts",
"typings": "./lib/index.d.ts",
"matrix_i18n_extra_translation_funcs": [ "matrix_i18n_extra_translation_funcs": [
"UserFriendlyError" "UserFriendlyError"
], ],
"scripts": { "scripts": {
"prepack": "yarn build",
"i18n": "matrix-gen-i18n && yarn i18n:sort && yarn i18n:lint", "i18n": "matrix-gen-i18n && yarn i18n:sort && yarn i18n:lint",
"i18n:sort": "jq --sort-keys '.' src/i18n/strings/en_EN.json > src/i18n/strings/en_EN.json.tmp && mv src/i18n/strings/en_EN.json.tmp src/i18n/strings/en_EN.json", "i18n:sort": "jq --sort-keys '.' src/i18n/strings/en_EN.json > src/i18n/strings/en_EN.json.tmp && mv src/i18n/strings/en_EN.json.tmp src/i18n/strings/en_EN.json",
"i18n:lint": "matrix-i18n-lint && prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null", "i18n:lint": "matrix-i18n-lint && prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json", "i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
"make-component": "node scripts/make-react-component.js", "make-component": "node scripts/make-react-component.js",
"rethemendex": "res/css/rethemendex.sh", "rethemendex": "res/css/rethemendex.sh",
"clean": "rimraf lib", "clean": "rimraf lib webapp",
"build": "yarn clean && git rev-parse HEAD > git-revision.txt && yarn build:compile && yarn build:types", "build": "yarn clean && yarn build:genfiles && yarn build:bundle",
"build:compile": "babel -d lib --verbose --extensions \".ts,.js,.tsx\" src", "build-stats": "yarn clean && yarn build:genfiles && yarn build:bundle-stats",
"build:types": "tsc --emitDeclarationOnly --jsx react", "build:res": "ts-node scripts/copy-res.ts",
"start": "echo THIS IS FOR LEGACY PURPOSES ONLY. && yarn start:all", "build:genfiles": "yarn build:res && yarn build:module_system",
"start:all": "echo THIS IS FOR LEGACY PURPOSES ONLY. && yarn start:build", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
"start:build": "babel src -w -s -d lib --verbose --extensions \".ts,.js\"", "build:bundle": "webpack --progress --mode production",
"build:bundle-stats": "webpack --progress --mode production --json > webpack-stats.json",
"build:module_system": "ts-node --project ./tsconfig.module_system.json module_system/scripts/install.ts",
"dist": "scripts/package.sh",
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n modules,res \"yarn build:module_system\" \"yarn build:res\" && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js\"",
"start:https": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js --server-type https\"",
"start:res": "ts-node scripts/copy-res.ts -w",
"start:js": "webpack serve --output-path webapp --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js --mode development",
"lint": "yarn lint:types && yarn lint:js && yarn lint:style && yarn lint:workflows", "lint": "yarn lint:types && yarn lint:js && yarn lint:style && yarn lint:workflows",
"lint:js": "eslint --max-warnings 0 src test playwright && prettier --check .", "lint:js": "yarn lint:js:src && yarn lint:js:module_system",
"lint:js-fix": "eslint --fix src test playwright && prettier --log-level=warn --write .", "lint:js:src": "eslint --max-warnings 0 src test playwright && prettier --check .",
"lint:types": "tsc --noEmit --jsx react && tsc --noEmit --jsx react -p playwright", "lint:js:module_system": "eslint --max-warnings 0 --config .eslintrc-module_system.js module_system",
"lint:js-fix": "yarn lint:js-fix:src && yarn lint:js-fix:module_system",
"lint:js-fix:src": "prettier --log-level=warn --write . && eslint --fix src test playwright",
"lint:js-fix:module_system": "eslint --fix --config .eslintrc-module_system.js module_system",
"lint:types": "yarn lint:types:src && yarn lint:types:module_system",
"lint:types:src": "tsc --noEmit --jsx react && tsc --noEmit --jsx react -p playwright",
"lint:types:module_system": "tsc --noEmit --project ./tsconfig.module_system.json",
"lint:style": "stylelint \"res/css/**/*.pcss\"", "lint:style": "stylelint \"res/css/**/*.pcss\"",
"lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'",
"test": "jest", "test": "jest",
"test:playwright": "playwright test", "test:playwright": "playwright test",
"test:playwright:open": "yarn test:playwright --ui", "test:playwright:open": "yarn test:playwright --ui",
"test:playwright:screenshots": "yarn test:playwright:screenshots:build && yarn test:playwright:screenshots:run", "test:playwright:screenshots": "yarn test:playwright:screenshots:build && yarn test:playwright:screenshots:run",
"test:playwright:screenshots:build": "docker build playwright -t matrix-react-sdk-playwright", "test:playwright:screenshots:build": "docker build playwright -t element-web-playwright",
"test:playwright:screenshots:run": "docker run --rm --network host -e BASE_URL -v $(pwd)/../:/work/ -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/:/tmp/ -it matrix-react-sdk-playwright", "test:playwright:screenshots:run": "docker run --rm --network host -e BASE_URL -e CI -v $(pwd):/work/ -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/:/tmp/ -it element-web-playwright",
"coverage": "yarn test --coverage", "coverage": "yarn test --coverage",
"lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'" "analyse:unused-exports": "ts-node ./scripts/analyse_unused_exports.ts",
"analyse:webpack-bundles": "webpack-bundle-analyzer webpack-stats.json webapp",
"update:jitsi": "curl -s https://meet.element.io/libs/external_api.min.js > ./res/jitsi_external_api.min.js"
}, },
"resolutions": { "resolutions": {
"@types/react-dom": "17.0.25", "@types/react-dom": "17.0.25",
"@types/react": "17.0.82", "@types/react": "17.0.83",
"@types/seedrandom": "3.0.8", "@types/seedrandom": "3.0.8",
"oidc-client-ts": "3.0.1", "oidc-client-ts": "3.0.1",
"jwt-decode": "4.0.0", "jwt-decode": "4.0.0",
"@vector-im/compound-design-tokens": "1.8.0",
"@vector-im/compound-web": "7.0.0",
"@floating-ui/react": "0.26.11", "@floating-ui/react": "0.26.11",
"@radix-ui/react-id": "1.1.0", "@radix-ui/react-id": "1.1.0",
"caniuse-lite": "1.0.30001655" "caniuse-lite": "1.0.30001668",
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0",
"wrap-ansi": "npm:wrap-ansi@^7.0.0"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@formatjs/intl-segmenter": "^11.5.7",
"@matrix-org/analytics-events": "^0.26.0", "@matrix-org/analytics-events": "^0.26.0",
"@matrix-org/emojibase-bindings": "^1.3.3", "@matrix-org/emojibase-bindings": "^1.3.3",
"@vector-im/matrix-wysiwyg": "2.37.13", "@vector-im/matrix-wysiwyg": "2.37.13",
@@ -80,7 +98,7 @@
"@sentry/browser": "^8.0.0", "@sentry/browser": "^8.0.0",
"@testing-library/react-hooks": "^8.0.1", "@testing-library/react-hooks": "^8.0.1",
"@vector-im/compound-design-tokens": "^1.8.0", "@vector-im/compound-design-tokens": "^1.8.0",
"@vector-im/compound-web": "^5.5.0", "@vector-im/compound-web": "^7.0.0",
"@zxcvbn-ts/core": "^3.0.4", "@zxcvbn-ts/core": "^3.0.4",
"@zxcvbn-ts/language-common": "^3.0.4", "@zxcvbn-ts/language-common": "^3.0.4",
"@zxcvbn-ts/language-en": "^3.0.2", "@zxcvbn-ts/language-en": "^3.0.2",
@@ -103,6 +121,7 @@
"highlight.js": "^11.3.1", "highlight.js": "^11.3.1",
"html-entities": "^2.0.0", "html-entities": "^2.0.0",
"is-ip": "^3.1.0", "is-ip": "^3.1.0",
"jsrsasign": "^11.0.0",
"js-xxhash": "^4.0.0", "js-xxhash": "^4.0.0",
"jszip": "^3.7.0", "jszip": "^3.7.0",
"katex": "^0.16.0", "katex": "^0.16.0",
@@ -110,14 +129,13 @@
"linkify-react": "4.1.3", "linkify-react": "4.1.3",
"linkify-string": "4.1.3", "linkify-string": "4.1.3",
"linkifyjs": "4.1.3", "linkifyjs": "4.1.3",
"lodash": "^4.17.20", "lodash": "^4.17.21",
"maplibre-gl": "^2.0.0", "maplibre-gl": "^2.0.0",
"matrix-encrypt-attachment": "^1.0.3", "matrix-encrypt-attachment": "^1.0.3",
"matrix-events-sdk": "0.0.1", "matrix-events-sdk": "0.0.1",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
"matrix-widget-api": "^1.9.0", "matrix-widget-api": "^1.9.0",
"memoize-one": "^6.0.0", "memoize-one": "^6.0.0",
"minimist": "^1.2.5",
"oidc-client-ts": "^3.0.1", "oidc-client-ts": "^3.0.1",
"opus-recorder": "^8.0.3", "opus-recorder": "^8.0.3",
"pako": "^2.0.3", "pako": "^2.0.3",
@@ -150,17 +168,25 @@
"@babel/eslint-plugin": "^7.12.10", "@babel/eslint-plugin": "^7.12.10",
"@babel/parser": "^7.12.11", "@babel/parser": "^7.12.11",
"@babel/plugin-proposal-export-default-from": "^7.12.1", "@babel/plugin-proposal-export-default-from": "^7.12.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-class-properties": "^7.12.1", "@babel/plugin-transform-class-properties": "^7.12.1",
"@babel/plugin-transform-logical-assignment-operators": "^7.20.7",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.12.1",
"@babel/plugin-transform-numeric-separator": "^7.12.7", "@babel/plugin-transform-numeric-separator": "^7.12.7",
"@babel/plugin-transform-object-rest-spread": "^7.12.1", "@babel/plugin-transform-object-rest-spread": "^7.12.1",
"@babel/plugin-transform-optional-chaining": "^7.12.7",
"@babel/plugin-transform-runtime": "^7.12.10", "@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.11", "@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10", "@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.12.7", "@babel/preset-typescript": "^7.12.7",
"@babel/register": "^7.12.10", "@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@casualbot/jest-sonar-reporter": "2.2.7", "@casualbot/jest-sonar-reporter": "2.2.7",
"@peculiar/webcrypto": "^1.4.3", "@peculiar/webcrypto": "^1.4.3",
"@playwright/test": "^1.40.1", "@playwright/test": "^1.40.1",
"@principalstudio/html-webpack-inject-preload": "^1.2.7",
"@sentry/webpack-plugin": "^2.7.1",
"@svgr/webpack": "^8.0.0",
"@testing-library/dom": "^9.0.0", "@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^6.0.0", "@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^12.1.5", "@testing-library/react": "^12.1.5",
@@ -176,29 +202,43 @@
"@types/fs-extra": "^11.0.0", "@types/fs-extra": "^11.0.0",
"@types/glob-to-regexp": "^0.4.1", "@types/glob-to-regexp": "^0.4.1",
"@types/jest": "29.5.12", "@types/jest": "29.5.12",
"@types/jitsi-meet": "^2.0.2",
"@types/jsrsasign": "^10.5.4",
"@types/katex": "^0.16.0", "@types/katex": "^0.16.0",
"@types/lodash": "^4.14.168", "@types/lodash": "^4.14.168",
"@types/minimist": "^1.2.5",
"@types/modernizr": "^3.5.3", "@types/modernizr": "^3.5.3",
"@types/node": "18", "@types/node": "18",
"@types/node-fetch": "^2.6.2", "@types/node-fetch": "^2.6.2",
"@types/pako": "^2.0.0", "@types/pako": "^2.0.0",
"@types/qrcode": "^1.3.5", "@types/qrcode": "^1.3.5",
"@types/react": "17.0.82", "@types/react": "17.0.83",
"@types/react-beautiful-dnd": "^13.0.0", "@types/react-beautiful-dnd": "^13.0.0",
"@types/react-dom": "17.0.25", "@types/react-dom": "17.0.25",
"@types/react-transition-group": "^4.4.0", "@types/react-transition-group": "^4.4.0",
"@types/sanitize-html": "2.13.0", "@types/sanitize-html": "2.13.0",
"@types/sdp-transform": "^2.4.6", "@types/sdp-transform": "^2.4.6",
"@types/seedrandom": "3.0.8", "@types/seedrandom": "3.0.8",
"@types/tar-js": "^0.3.2", "@types/semver": "^7.5.8",
"@types/tar-js": "^0.3.5",
"@types/ua-parser-js": "^0.7.36", "@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0", "@typescript-eslint/parser": "^7.0.0",
"axe-core": "4.10.0", "axe-core": "4.10.0",
"babel-jest": "^29.0.0", "babel-jest": "^29.0.0",
"babel-loader": "^9.0.0",
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
"blob-polyfill": "^9.0.0", "blob-polyfill": "^9.0.0",
"buffer": "^6.0.3",
"chokidar": "^4.0.0",
"concurrently": "^9.0.0",
"copy-webpack-plugin": "^12.0.0",
"core-js": "^3.38.1", "core-js": "^3.38.1",
"cronstrue": "^2.41.0",
"css-loader": "^7.0.0",
"css-minimizer-webpack-plugin": "^7.0.0",
"dotenv": "^16.0.2",
"eslint": "8.57.1", "eslint": "8.57.1",
"eslint-config-google": "^0.14.0", "eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
@@ -209,12 +249,15 @@
"eslint-plugin-matrix-org": "1.2.1", "eslint-plugin-matrix-org": "1.2.1",
"eslint-plugin-react": "^7.28.0", "eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-unicorn": "^55.0.0", "eslint-plugin-unicorn": "^56.0.0",
"express": "^4.18.2", "express": "^4.18.2",
"fake-indexeddb": "^6.0.0", "fake-indexeddb": "^6.0.0",
"fetch-mock": "9.11.0",
"fetch-mock-jest": "^1.5.1", "fetch-mock-jest": "^1.5.1",
"file-loader": "^6.0.0",
"fs-extra": "^11.0.0", "fs-extra": "^11.0.0",
"glob": "^11.0.0", "glob": "^11.0.0",
"html-webpack-plugin": "^5.5.3",
"husky": "^9.0.0", "husky": "^9.0.0",
"jest": "^29.6.2", "jest": "^29.6.2",
"jest-canvas-mock": "^2.5.2", "jest-canvas-mock": "^2.5.2",
@@ -224,28 +267,51 @@
"jsqr": "^1.4.0", "jsqr": "^1.4.0",
"lint-staged": "^15.0.2", "lint-staged": "^15.0.2",
"mailhog": "^4.16.0", "mailhog": "^4.16.0",
"matrix-mock-request": "^2.5.0",
"matrix-web-i18n": "^3.2.1", "matrix-web-i18n": "^3.2.1",
"mini-css-extract-plugin": "2.9.0",
"minimist": "^1.2.6",
"mkdirp": "^3.0.0",
"mocha-junit-reporter": "^2.2.0", "mocha-junit-reporter": "^2.2.0",
"node-fetch": "2", "modernizr": "^3.12.0",
"node-fetch": "^2.6.7",
"playwright-core": "^1.45.1", "playwright-core": "^1.45.1",
"postcss": "8.4.38",
"postcss-easings": "^4.0.0",
"postcss-hexrgba": "2.1.0",
"postcss-import": "16.1.0",
"postcss-loader": "8.1.1",
"postcss-mixins": "^11.0.0",
"postcss-nested": "^6.0.0",
"postcss-preset-env": "^10.0.0",
"postcss-scss": "^4.0.4", "postcss-scss": "^4.0.4",
"postcss-simple-vars": "^7.0.1",
"prettier": "3.3.3", "prettier": "3.3.3",
"process": "^0.11.10",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"rimraf": "^6.0.0", "rimraf": "^6.0.0",
"semver": "^7.5.2",
"stylelint": "^16.1.0", "stylelint": "^16.1.0",
"stylelint-config-standard": "^36.0.0", "stylelint-config-standard": "^36.0.0",
"stylelint-scss": "^6.0.0", "stylelint-scss": "^6.0.0",
"terser-webpack-plugin": "^5.3.9",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "5.6.2", "ts-prune": "^0.10.3",
"web-streams-polyfill": "^4.0.0" "typescript": "5.6.3",
}, "util": "^0.12.5",
"peerDependencies": { "web-streams-polyfill": "^4.0.0",
"postcss": "^8.4.19", "webpack": "^5.89.0",
"webpack": "^4.0.0 || ^5.0.0" "webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^5.0.0",
"webpack-dev-server": "^5.0.0",
"yaml": "^2.3.3"
}, },
"@casualbot/jest-sonar-reporter": { "@casualbot/jest-sonar-reporter": {
"outputDirectory": "coverage", "outputDirectory": "coverage",
"outputName": "jest-sonar-report.xml", "outputName": "jest-sonar-report.xml",
"relativePaths": true "relativePaths": true
},
"engines": {
"node": ">=20.0.0"
} }
} }
+1 -1
View File
@@ -23,7 +23,7 @@ export default defineConfig({
trace: "on-first-retry", trace: "on-first-retry",
}, },
webServer: { webServer: {
command: process.env.CI ? "npx serve -p 8080 -L ../webapp" : "yarn --cwd ../element-web start", command: process.env.CI ? "npx serve -p 8080 -L ./webapp" : "yarn start",
url: `${baseURL}/config.json`, url: `${baseURL}/config.json`,
reuseExistingServer: true, reuseExistingServer: true,
}, },
+2 -3
View File
@@ -1,7 +1,6 @@
FROM mcr.microsoft.com/playwright:v1.46.1-jammy FROM mcr.microsoft.com/playwright:v1.48.0-jammy
WORKDIR /work/matrix-react-sdk WORKDIR /work
VOLUME ["/work/element-web/node_modules"]
# fonts-dejavu is needed for the same RTL rendering as on CI # fonts-dejavu is needed for the same RTL rendering as on CI
RUN apt-get update && apt-get -y install docker.io fonts-dejavu RUN apt-get update && apt-get -y install docker.io fonts-dejavu
-3
View File
@@ -2,7 +2,4 @@
set -e set -e
yarn link
yarn --cwd ../element-web install
yarn --cwd ../element-web link matrix-react-sdk
npx playwright test --update-snapshots --reporter line $@ npx playwright test --update-snapshots --reporter line $@
+1 -1
View File
@@ -226,7 +226,7 @@ test.describe("Cryptography", function () {
// Assert that verified icon is rendered // Assert that verified icon is rendered
await page.getByTestId("base-card-back-button").click(); await page.getByTestId("base-card-back-button").click();
await page.getByLabel("Room info").nth(1).click(); await page.getByLabel("Room info").nth(1).click();
await expect(page.locator('.mx_RoomSummaryCard_badges [data-kind="success"]')).toContainText("Encrypted"); await expect(page.locator('.mx_RoomSummaryCard_badges [data-kind="green"]')).toContainText("Encrypted");
// Take a snapshot of RoomSummaryCard with a verified E2EE icon // Take a snapshot of RoomSummaryCard with a verified E2EE icon
await expect(page.locator(".mx_RightPanel")).toMatchScreenshot("RoomSummaryCard-with-verified-e2ee.png"); await expect(page.locator(".mx_RightPanel")).toMatchScreenshot("RoomSummaryCard-with-verified-e2ee.png");
+12 -6
View File
@@ -70,7 +70,9 @@ test.describe("Cryptography", function () {
const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon"); const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_decryption_failure/); await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_decryption_failure/);
await lastE2eIcon.focus(); await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("This message could not be decrypted"); await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText(
"This message could not be decrypted",
);
/* Should show a red padlock for an unencrypted message in an e2e room */ /* Should show a red padlock for an unencrypted message in an e2e room */
await bob.evaluate( await bob.evaluate(
@@ -90,7 +92,7 @@ test.describe("Cryptography", function () {
await expect(last).toContainText("test unencrypted"); await expect(last).toContainText("test unencrypted");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/); await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastE2eIcon.focus(); await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("Not encrypted"); await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText("Not encrypted");
/* Should show no padlock for an unverified user */ /* Should show no padlock for an unverified user */
// bob sends a valid event // bob sends a valid event
@@ -123,7 +125,9 @@ test.describe("Cryptography", function () {
await expect(lastTile).toContainText("test encrypted from unverified"); await expect(lastTile).toContainText("test encrypted from unverified");
await expect(lastTileE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/); await expect(lastTileE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastTileE2eIcon.focus(); await lastTileE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("Encrypted by a device not verified by its owner."); await expect(await app.getTooltipForElement(lastTileE2eIcon)).toContainText(
"Encrypted by a device not verified by its owner.",
);
/* In legacy crypto: should show a grey padlock for a message from a deleted device. /* In legacy crypto: should show a grey padlock for a message from a deleted device.
* In rust crypto: should show a red padlock for a message from an unverified device. * In rust crypto: should show a red padlock for a message from an unverified device.
@@ -159,7 +163,7 @@ test.describe("Cryptography", function () {
await expect(last).toContainText("test encrypted from unverified"); await expect(last).toContainText("test encrypted from unverified");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/); await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastE2eIcon.focus(); await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText( await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText(
workerInfo.project.name === "Legacy Crypto" workerInfo.project.name === "Legacy Crypto"
? "Encrypted by an unknown or deleted device." ? "Encrypted by an unknown or deleted device."
: "Encrypted by a device not verified by its owner.", : "Encrypted by a device not verified by its owner.",
@@ -212,7 +216,7 @@ test.describe("Cryptography", function () {
// The key is coming from backup, so it is not anymore possible to establish if the claimed device // The key is coming from backup, so it is not anymore possible to establish if the claimed device
// creator of this key is authentic. The tooltip should be "The authenticity of this encrypted message can't be guaranteed on this device." // creator of this key is authentic. The tooltip should be "The authenticity of this encrypted message can't be guaranteed on this device."
// It is not "Encrypted by an unknown or deleted device." even if the claimed device is actually deleted. // It is not "Encrypted by an unknown or deleted device." even if the claimed device is actually deleted.
await expect(page.getByRole("tooltip")).toContainText( await expect(await app.getTooltipForElement(lastTileE2eIcon)).toContainText(
"The authenticity of this encrypted message can't be guaranteed on this device.", "The authenticity of this encrypted message can't be guaranteed on this device.",
); );
}); });
@@ -296,7 +300,9 @@ test.describe("Cryptography", function () {
const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon"); const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/); await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastE2eIcon.focus(); await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("Encrypted by a device not verified by its owner."); await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText(
"Encrypted by a device not verified by its owner.",
);
const penultimate = page.locator(".mx_EventTile").filter({ hasText: "test encrypted from verified" }); const penultimate = page.locator(".mx_EventTile").filter({ hasText: "test encrypted from verified" });
await expect(penultimate.locator(".mx_EventTile_e2eIcon")).not.toBeVisible(); await expect(penultimate.locator(".mx_EventTile_e2eIcon")).not.toBeVisible();
+2 -1
View File
@@ -8,8 +8,9 @@ Please see LICENSE files in the repository root for full details.
import { expect, JSHandle, type Page } from "@playwright/test"; import { expect, JSHandle, type Page } from "@playwright/test";
import type { CryptoEvent, ICreateRoomOpts, MatrixClient } from "matrix-js-sdk/src/matrix"; import type { ICreateRoomOpts, MatrixClient } from "matrix-js-sdk/src/matrix";
import type { import type {
CryptoEvent,
EmojiMapping, EmojiMapping,
ShowSasCallbacks, ShowSasCallbacks,
VerificationRequest, VerificationRequest,
+1 -1
View File
@@ -32,7 +32,7 @@ test.describe("Soft logout", () => {
// back to the welcome page // back to the welcome page
await expect(page).toHaveURL(/\/#\/home/); await expect(page).toHaveURL(/\/#\/home/);
await expect(page.getByRole("heading", { name: "Welcome Alice", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: `Welcome ${user.userId}`, exact: true })).toBeVisible();
}); });
test("still shows the soft-logout page when the page is reloaded after a soft-logout", async ({ test("still shows the soft-logout page when the page is reloaded after a soft-logout", async ({
@@ -84,7 +84,7 @@ test.describe("FilePanel", () => {
await expect(filePanelMessageList.locator(".mx_EventTile")).toHaveCount(3); await expect(filePanelMessageList.locator(".mx_EventTile")).toHaveCount(3);
// Assert that the download links are rendered // Assert that the download links are rendered
await expect(filePanelMessageList.locator(".mx_MFileBody_download")).toHaveCount(3); await expect(filePanelMessageList.locator(".mx_MFileBody_download,.mx_MFileBody_info")).toHaveCount(3);
// Assert that the sender of the files is rendered on all of the tiles // Assert that the sender of the files is rendered on all of the tiles
await expect(filePanelMessageList.getByText(NAME)).toHaveCount(3); await expect(filePanelMessageList.getByText(NAME)).toHaveCount(3);
@@ -176,8 +176,7 @@ test.describe("FilePanel", () => {
// Assert that the file size is displayed in kibibytes, not kilobytes (1000 bytes) // Assert that the file size is displayed in kibibytes, not kilobytes (1000 bytes)
// See: https://github.com/vector-im/element-web/issues/24866 // See: https://github.com/vector-im/element-web/issues/24866
await expect(tile.locator(".mx_MFileBody_info_filename", { hasText: size })).toBeVisible(); await expect(tile.locator(".mx_MFileBody_info_filename", { hasText: size })).toBeVisible();
await expect(tile.locator(".mx_MFileBody_download a", { hasText: size })).toBeVisible(); await expect(tile.locator(".mx_MFileBody_info", { hasText: size })).toBeVisible();
await expect(tile.locator(".mx_MFileBody_download .mx_MImageBody_size", { hasText: size })).toBeVisible();
}); });
}); });
+1 -1
View File
@@ -224,7 +224,7 @@ export const test = base.extend<{
}, },
axe: async ({ page }, use) => { axe: async ({ page }, use) => {
await use(new AxeBuilder({ page })); await use(new AxeBuilder({ page }).exclude("[id^='floating-ui-']"));
}, },
checkA11y: async ({ axe }, use, testInfo) => checkA11y: async ({ axe }, use, testInfo) =>
use(async () => { use(async () => {
+18
View File
@@ -172,4 +172,22 @@ export class ElementAppPage {
await this.page.getByRole("button", { name: "Room info" }).first().click(); await this.page.getByRole("button", { name: "Room info" }).first().click();
return this.page.locator(".mx_RightPanel"); return this.page.locator(".mx_RightPanel");
} }
/**
* Get a locator for the tooltip associated with an element
* @param e The element with the tooltip
* @returns Locator to the tooltip
*/
public async getTooltipForElement(e: Locator): Promise<Locator> {
const [labelledById, describedById] = await Promise.all([
e.getAttribute("aria-labelledby"),
e.getAttribute("aria-describedby"),
]);
if (!labelledById && !describedById) {
throw new Error(
"Element has no aria-labelledby or aria-describedy attributes! The tooltip should have added either one of these.",
);
}
return this.page.locator(`#${labelledById ?? describedById}`);
}
} }
@@ -20,7 +20,7 @@ import { randB64Bytes } from "../../utils/rand";
// Docker tag to use for synapse docker image. // Docker tag to use for synapse docker image.
// We target a specific digest as every now and then a Synapse update will break our CI. // We target a specific digest as every now and then a Synapse update will break our CI.
// This digest is updated by the playwright-image-updates.yaml workflow periodically. // This digest is updated by the playwright-image-updates.yaml workflow periodically.
const DOCKER_TAG = "develop@sha256:117a94ee66e4049eb6f40d04cc70d4fc83f7022dacc9871448c141e7756492f9"; const DOCKER_TAG = "develop@sha256:fd6ba2d8471a0807e1bccef4124b22d17f0058f2cf9285066fdd94d8c631964a";
async function cfgDirFromTemplate(opts: StartHomeserverOpts): Promise<Omit<HomeserverConfig, "dockerUrl">> { async function cfgDirFromTemplate(opts: StartHomeserverOpts): Promise<Omit<HomeserverConfig, "dockerUrl">> {
const templateDir = path.join(__dirname, "templates", opts.template); const templateDir = path.join(__dirname, "templates", opts.template);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 13 KiB

+1
View File
@@ -1,3 +1,4 @@
signing_id: releases@riot.im
subprojects: subprojects:
matrix-js-sdk: matrix-js-sdk:
includeByDefault: false includeByDefault: false
-1
View File
@@ -65,7 +65,6 @@
@import "./structures/_FileDropTarget.pcss"; @import "./structures/_FileDropTarget.pcss";
@import "./structures/_FilePanel.pcss"; @import "./structures/_FilePanel.pcss";
@import "./structures/_GenericDropdownMenu.pcss"; @import "./structures/_GenericDropdownMenu.pcss";
@import "./structures/_GenericErrorPage.pcss";
@import "./structures/_HomePage.pcss"; @import "./structures/_HomePage.pcss";
@import "./structures/_LargeLoader.pcss"; @import "./structures/_LargeLoader.pcss";
@import "./structures/_LeftPanel.pcss"; @import "./structures/_LeftPanel.pcss";
+2 -2
View File
@@ -69,8 +69,8 @@ Please see LICENSE files in the repository root for full details.
font-size: $font-12px; font-size: $font-12px;
} }
.mx_AutocompleteInput_editor_selection_remove_button { .mx_AutocompleteInput_editor_selection_remove_button svg {
padding: 0 $spacing-4; vertical-align: middle;
} }
.mx_AutocompleteInput_matches { .mx_AutocompleteInput_matches {
+14 -33
View File
@@ -20,70 +20,51 @@ Please see LICENSE files in the repository root for full details.
.mx_RoomView_MessageList { .mx_RoomView_MessageList {
width: 100%; width: 100%;
gap: var(--cpd-space-6x);
h2 {
display: none;
}
} }
/* FIXME: rather than having EventTile's default CSS be for MessagePanel, /* FIXME: rather than having EventTile's default CSS be for MessagePanel,
we should make EventTile a base CSS class and customise it specifically we should make EventTile a base CSS class and customise it specifically
for usage in {Message,File,Notification}Panel. */ for usage in {Message,File,Notification}Panel. */
.mx_EventTile_avatar {
display: none;
}
/* Overrides for the attachment body tiles */ /* Overrides for the attachment body tiles */
.mx_EventTile { .mx_EventTile {
word-break: break-word; word-break: break-word;
margin-top: 10px;
padding-top: 0; padding-top: 0;
& + .mx_EventTile {
border-top: 1px solid var(--cpd-color-gray-400);
padding-top: var(--cpd-space-6x);
}
.mx_EventTile_line { .mx_EventTile_line {
padding-inline-start: 0; padding-inline-start: 0;
} }
.mx_MFileBody {
line-height: 2.4rem;
}
.mx_MFileBody_download { .mx_MFileBody_download {
padding-top: $spacing-8; margin-top: var(--cpd-space-4x);
display: flex;
justify-content: space-between;
font: var(--cpd-font-body-md-regular);
color: $event-timestamp-color;
.mx_MImageBody_size {
font: var(--cpd-font-body-md-regular);
text-align: right;
white-space: nowrap;
}
}
.mx_MFileBody_downloadLink {
flex: 1 1 auto;
color: $light-fg-color;
} }
/* anchor link as wrapper */ /* anchor link as wrapper */
.mx_EventTile_senderDetailsLink { .mx_EventTile_senderDetailsLink {
text-decoration: none; text-decoration: none;
margin-bottom: var(--cpd-space-1x);
display: block;
.mx_EventTile_senderDetails { .mx_EventTile_senderDetails {
display: flex; display: flex;
justify-content: space-between;
margin-top: -2px; margin-top: -2px;
gap: var(--cpd-space-2x);
align-items: center;
.mx_DisambiguatedProfile { .mx_DisambiguatedProfile {
color: $event-timestamp-color; /* for ellipsis. Color of displayName and mxid is inherited */ color: $event-timestamp-color; /* for ellipsis. Color of displayName and mxid is inherited */
} }
.mx_MessageTimestamp { .mx_MessageTimestamp {
text-align: right; margin-left: auto;
color: $secondary-content; font: var(--cpd-font-body-xs-regular);
font: var(--cpd-font-body-sm-regular); color: var(--cpd-color-text-secondary);
} }
} }
} }
-17
View File
@@ -1,17 +0,0 @@
.mx_GenericErrorPage {
width: 100%;
height: 100%;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.mx_GenericErrorPage_box {
display: inline;
width: 500px;
min-height: 125px;
border: 1px solid #f22;
padding: 10px 10px 20px;
background-color: #fcc;
}
+5 -5
View File
@@ -24,13 +24,13 @@ Please see LICENSE files in the repository root for full details.
cursor: pointer; cursor: pointer;
.mx_RoomSearch_icon { .mx_RoomSearch_icon {
width: 16px; width: 20px;
height: 16px; height: 20px;
mask: url("@vector-im/compound-design-tokens/icons/search.svg"); mask-image: url("@vector-im/compound-design-tokens/icons/search.svg");
mask-repeat: no-repeat; mask-repeat: no-repeat;
mask-size: contain;
background-color: $secondary-content; background-color: $secondary-content;
margin-left: 7px; margin-left: var(--cpd-space-2x);
margin-bottom: 2px;
flex-shrink: 0; flex-shrink: 0;
mask-size: 20px; mask-size: 20px;
} }
+3 -2
View File
@@ -53,13 +53,14 @@ Please see LICENSE files in the repository root for full details.
} }
.mx_AuthBody_icon { .mx_AuthBody_icon {
width: 40px; width: 44px;
height: 44px;
} }
.mx_AuthBody_lockIcon { .mx_AuthBody_lockIcon {
color: $secondary-content; color: $secondary-content;
height: 32px; height: 32px;
margin-bottom: -3px; /* tweak to align all icons on different forgot password steps */ width: 32px;
} }
.mx_AuthBody_text { .mx_AuthBody_text {
+14
View File
@@ -11,6 +11,13 @@ Please see LICENSE files in the repository root for full details.
margin-bottom: $spacing-16; margin-bottom: $spacing-16;
} }
.mx_LoginWithQRSection {
.mx_AccessibleButton_kind_primary + p {
color: var(--cpd-color-text-secondary);
margin-top: var(--cpd-space-2x);
}
}
.mx_LoginWithQRSection .mx_AccessibleButton svg { .mx_LoginWithQRSection .mx_AccessibleButton svg {
margin-right: $spacing-12; margin-right: $spacing-12;
} }
@@ -135,10 +142,17 @@ Please see LICENSE files in the repository root for full details.
padding: var(--cpd-space-3x); padding: var(--cpd-space-3x);
gap: 10px; gap: 10px;
background-color: var(--cpd-color-bg-subtle-secondary);
svg {
color: var(--cpd-color-icon-secondary);
}
&.mx_LoginWithQR_icon--success {
background-color: var(--cpd-color-bg-success-subtle); background-color: var(--cpd-color-bg-success-subtle);
svg { svg {
color: var(--cpd-color-icon-success-primary); color: var(--cpd-color-icon-success-primary);
} }
}
&.mx_LoginWithQR_icon--critical { &.mx_LoginWithQR_icon--critical {
background-color: var(--cpd-color-bg-critical-subtle); background-color: var(--cpd-color-bg-critical-subtle);
+4 -1
View File
@@ -174,8 +174,11 @@ Please see LICENSE files in the repository root for full details.
.mx_InviteDialog_userTile_remove { .mx_InviteDialog_userTile_remove {
display: inline-block; display: inline-block;
margin-inline-start: $spacing-4;
vertical-align: middle; vertical-align: middle;
svg {
vertical-align: middle;
}
} }
} }
+3 -25
View File
@@ -8,25 +8,7 @@ Please see LICENSE files in the repository root for full details.
.mx_MFileBody_download { .mx_MFileBody_download {
color: $accent; color: $accent;
height: var(--cpd-space-9x);
.mx_MFileBody_download_icon {
/* 12px instead of 14px to better match surrounding font size */
width: 12px;
height: 12px;
mask-size: 12px;
mask-position: center;
mask-repeat: no-repeat;
mask-image: url("$(res)/img/download.svg");
background-color: $accent;
display: inline-block;
}
}
.mx_MFileBody_download a {
color: $accent;
text-decoration: none;
cursor: pointer;
} }
.mx_MFileBody_download object { .mx_MFileBody_download object {
@@ -43,12 +25,6 @@ Please see LICENSE files in the repository root for full details.
padding: 0px; padding: 0px;
border: none; border: none;
width: 100%; width: 100%;
/* Set the height of the iframe to be 1 line of text.
* Iframes don't automatically size themselves to fit their content.
* So either we have to fix the height of the iframe using CSS or
* use javascript's cross-origin postMessage API to communicate how
* big the content of the iframe is. */
height: 1.5em;
} }
.mx_MFileBody_info { .mx_MFileBody_info {
@@ -81,6 +57,8 @@ Please see LICENSE files in the repository root for full details.
} }
.mx_MFileBody_info_filename { .mx_MFileBody_info_filename {
font: var(--cpd-font-body-md-regular);
color: var(--cpd-color-text-primary);
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
@@ -159,37 +159,6 @@ Please see LICENSE files in the repository root for full details.
cursor: pointer; cursor: pointer;
} }
.mx_LegacyRoomHeader_button {
cursor: pointer;
flex: 0 0 auto;
margin-left: 1px;
margin-right: 1px;
height: 32px;
width: 32px;
position: relative;
border-radius: 100%;
&::before {
content: "";
position: absolute;
top: 4px; /* center with parent of 32px */
left: 4px; /* center with parent of 32px */
height: 24px;
width: 24px;
background-color: $icon-button-color;
mask-repeat: no-repeat;
mask-size: contain;
}
&:hover {
background: var(--cpd-color-bg-subtle-primary);
&::before {
background-color: var(--cpd-color-icon-primary);
}
}
}
.mx_LegacyRoomHeader_button_unreadIndicator_bg { .mx_LegacyRoomHeader_button_unreadIndicator_bg {
position: absolute; position: absolute;
right: var(--RoomHeader-indicator-dot-offset); right: var(--RoomHeader-indicator-dot-offset);
@@ -225,18 +194,6 @@ Please see LICENSE files in the repository root for full details.
} }
} }
.mx_LegacyRoomHeader_button--unread {
&::before {
background-color: $room-icon-unread-color !important;
}
}
.mx_LegacyRoomHeader_button--highlight {
&::before {
background-color: var(--cpd-color-icon-primary) !important;
}
}
.mx_LegacyRoomHeader_forgetButton::before { .mx_LegacyRoomHeader_forgetButton::before {
mask-image: url("@vector-im/compound-design-tokens/icons/leave.svg"); mask-image: url("@vector-im/compound-design-tokens/icons/leave.svg");
width: 26px; width: 26px;
+1 -1
View File
@@ -421,4 +421,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
>>>>>>>> 5660d5078528418f362e42d14714004d6f90dce4:res/fonts/Open_Sans/LICENSE.txt >>>>>>>> repomerge/t3chguy/repomerge:res/fonts/Open_Sans/LICENSE.txt
-3
View File
@@ -1,3 +0,0 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.3333 1.85156C10.2958 1.85156 7.83333 4.314 7.83333 7.35156V13.1742H7C5.34315 13.1742 4 14.5174 4 16.1742V27.6666C4 29.3234 5.34315 30.6666 7 30.6666H25C26.6569 30.6666 28 29.3234 28 27.6666V16.1742C28 14.5174 26.6569 13.1742 25 13.1742H24.1667V7.35156C24.1667 4.314 21.7042 1.85156 18.6667 1.85156H13.3333ZM21.1667 13.1742V7.35156C21.1667 5.97085 20.0474 4.85156 18.6667 4.85156H13.3333C11.9526 4.85156 10.8333 5.97085 10.8333 7.35156V13.1742H21.1667Z" fill="currentColor"/>
</svg>

Before

Width:  |  Height:  |  Size: 631 B

-1
View File
@@ -1 +0,0 @@
<svg width="58" height="60" viewBox="26 25 6 6" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-5.9%" y="-7.9%" width="111.8%" height="115.8%" filterUnits="objectBoundingBox" id="a"><feOffset dy="2" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="16" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0.473684211 0 0 0 0 1 0 0 0 0.241258741 0" in="shadowBlurOuter1" result="shadowMatrixOuter1"/><feMerge><feMergeNode in="shadowMatrixOuter1"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><g filter="url(#a)" transform="translate(-406 -215)" stroke="#61708B"><path d="M438 240l-6 6M432 240l6 6"/></g></svg>

Before

Width:  |  Height:  |  Size: 693 B

+219
View File
@@ -0,0 +1,219 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note:
This project was originally contributed to the community under the MIT license and with the following notice:
The MIT License (MIT)
Copyright (c) 2013 ESTOS GmbH
Copyright (c) 2013 BlueJimp SARL
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+12
View File
@@ -8,6 +8,18 @@ const ignore: string[] = [];
ignore.push(...Object.values<string>(JSON.parse(fs.readFileSync(`${__dirname}/../components.json`, "utf-8")))); ignore.push(...Object.values<string>(JSON.parse(fs.readFileSync(`${__dirname}/../components.json`, "utf-8"))));
ignore.push("/index.ts"); ignore.push("/index.ts");
ignore.push("/jest-matrix-react.tsx");
ignore.push("/customisations/");
ignore.push("/test-utils/");
// The following ignores are temporary and false-positives which need to be fixed
ignore.push("/useLocalStorageState.ts");
ignore.push("/blurhash.worker.ts");
ignore.push("/OpenSpotlightPayload.ts");
ignore.push("/PinnedMessageBadge.tsx");
ignore.push("/editor/mock.ts");
ignore.push("DeviceIsolationModeController.ts");
// We ignore js-sdk by default as it may export for other non element-web projects // We ignore js-sdk by default as it may export for other non element-web projects
if (!includeJSSDK) ignore.push("matrix-js-sdk"); if (!includeJSSDK) ignore.push("matrix-js-sdk");
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
#
# script which is run by the CI build (after `yarn test`).
#
# clones element-web develop and runs the tests against our version of react-sdk.
set -ev
scripts/ci/layered.sh
cd element-web
yarn build:genfiles # so the tests can run. Faster version of `build`
yarn test
-32
View File
@@ -1,32 +0,0 @@
#!/bin/bash
# This installs other Matrix dependencies that are often
# developed in parallel with react-sdk, using fetchdep.sh
# for branch matching.
# This will set up a working react-sdk environment, so is
# used for running react-sdk standalone tests. To set up a
# build of element-web, use layered.sh
set -ex
scripts/fetchdep.sh matrix-org matrix-js-sdk develop
pushd matrix-js-sdk
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
yarn link
yarn install --frozen-lockfile $@
popd
scripts/fetchdep.sh matrix-org matrix-analytics-events
# We don't pass a default branch so cloning may fail when we are not in a PR
# This is expected as this project does not share a release cycle but we still branch match it
if [ -d matrix-analytics-events ]; then
pushd matrix-analytics-events
yarn link
yarn install --frozen-lockfile $@
yarn build:ts
popd
fi
yarn link matrix-js-sdk
[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events
yarn install --frozen-lockfile $@
-50
View File
@@ -1,50 +0,0 @@
#!/bin/bash
set -ex
# Creates a layered environment with the full repo for the app and SDKs cloned
# and linked. This gives an element-web dev environment ready to build with
# the current react-sdk branch and any matching branches of react-sdk's dependencies
# so that changes can be tested in element-web.
# Note that this style is different from the recommended developer setup: this
# file nests js-sdk and element-web inside react-sdk, while the local
# development setup places them all at the same level. We are nesting them here
# because some CI systems do not allow moving to a directory above the checkout
# for the primary repo (react-sdk in this case).
# Set up the js-sdk first
scripts/fetchdep.sh matrix-org matrix-js-sdk develop
pushd matrix-js-sdk
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
yarn link
yarn install --frozen-lockfile
popd
# Also set up matrix-analytics-events for branch with matching name
scripts/fetchdep.sh matrix-org matrix-analytics-events
# We don't pass a default branch so cloning may fail when we are not in a PR
# This is expected as this project does not share a release cycle but we still branch match it
if [ -d matrix-analytics-events ]; then
pushd matrix-analytics-events
yarn link
yarn install --frozen-lockfile
yarn build:ts
popd
fi
# Now set up the react-sdk
yarn link matrix-js-sdk
[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events
yarn link
yarn install --frozen-lockfile
# Finally, set up element-web
scripts/fetchdep.sh vector-im element-web develop
pushd element-web
[ -n "$ELEMENT_WEB_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $ELEMENT_WEB_GITHUB_BASE_REF && git checkout $ELEMENT_WEB_GITHUB_BASE_REF
yarn link matrix-js-sdk
yarn link matrix-react-sdk
yarn install --frozen-lockfile
yarn build:res
popd
+5 -8
View File
@@ -9,9 +9,8 @@ import _ from "lodash";
import { util } from "webpack"; import { util } from "webpack";
import { Translations } from "matrix-web-i18n"; import { Translations } from "matrix-web-i18n";
const REACT_I18N_BASE_PATH = "node_modules/matrix-react-sdk/src/i18n/strings/";
const I18N_BASE_PATH = "src/i18n/strings/"; const I18N_BASE_PATH = "src/i18n/strings/";
const INCLUDE_LANGS = [...new Set([...fs.readdirSync(I18N_BASE_PATH), ...fs.readdirSync(REACT_I18N_BASE_PATH)])] const INCLUDE_LANGS = [...new Set([...fs.readdirSync(I18N_BASE_PATH)])]
.filter((fn) => fn.endsWith(".json")) .filter((fn) => fn.endsWith(".json"))
.map((f) => f.slice(0, -5)); .map((f) => f.slice(0, -5));
@@ -43,11 +42,10 @@ const logWatch = (path: string) => {
}; };
function prepareLangFile(lang: string, dest: string): [filename: string, json: string] { function prepareLangFile(lang: string, dest: string): [filename: string, json: string] {
const reactSdkFile = REACT_I18N_BASE_PATH + lang + ".json"; const path = I18N_BASE_PATH + lang + ".json";
const riotWebFile = I18N_BASE_PATH + lang + ".json";
let translations: Translations = {}; let translations: Translations = {};
[reactSdkFile, riotWebFile].forEach(function (f) { [path].forEach(function (f) {
if (fs.existsSync(f)) { if (fs.existsSync(f)) {
try { try {
translations = _.merge(translations, JSON.parse(fs.readFileSync(f).toString())); translations = _.merge(translations, JSON.parse(fs.readFileSync(f).toString()));
@@ -101,8 +99,7 @@ function genLangList(langFileMap: Record<string, string>): void {
* and regenerating languages.json with the new filename * and regenerating languages.json with the new filename
*/ */
function watchLanguage(lang: string, dest: string, langFileMap: Record<string, string>): void { function watchLanguage(lang: string, dest: string, langFileMap: Record<string, string>): void {
const reactSdkFile = REACT_I18N_BASE_PATH + lang + ".json"; const path = I18N_BASE_PATH + lang + ".json";
const riotWebFile = I18N_BASE_PATH + lang + ".json";
// XXX: Use a debounce because for some reason if we read the language // XXX: Use a debounce because for some reason if we read the language
// file immediately after the FS event is received, the file contents // file immediately after the FS event is received, the file contents
@@ -120,7 +117,7 @@ function watchLanguage(lang: string, dest: string, langFileMap: Record<string, s
}, 500); }, 500);
}; };
[reactSdkFile, riotWebFile].forEach(function (f) { [path].forEach(function (f) {
chokidar chokidar
.watch(f, { ignoreInitial: true }) .watch(f, { ignoreInitial: true })
.on("ready", () => { .on("ready", () => {
Regular → Executable
+2 -12
View File
@@ -10,12 +10,11 @@ then
echo "using develop dependencies for react-sdk and js-sdk" echo "using develop dependencies for react-sdk and js-sdk"
USE_CUSTOM_SDKS=true USE_CUSTOM_SDKS=true
JS_SDK_BRANCH='develop' JS_SDK_BRANCH='develop'
REACT_SDK_BRANCH='develop'
fi fi
if [[ $USE_CUSTOM_SDKS == false ]] if [[ $USE_CUSTOM_SDKS == false ]]
then then
echo "skipping react-sdk and js-sdk installs: USE_CUSTOM_SDKS is false" echo "skipping js-sdk install: USE_CUSTOM_SDKS is false"
exit 0 exit 0
fi fi
@@ -26,14 +25,5 @@ yarn link
yarn --network-timeout=100000 install yarn --network-timeout=100000 install
cd ../ cd ../
echo "Linking react-sdk" echo "Setting up element-web with js-sdk package"
git clone --depth 1 --branch $REACT_SDK_BRANCH "$REACT_SDK_REPO" react-sdk
cd react-sdk
yarn link
yarn link matrix-js-sdk yarn link matrix-js-sdk
yarn --network-timeout=100000 install
cd ../
echo "Setting up element-web with react-sdk and js-sdk packages"
yarn link matrix-js-sdk
yarn link matrix-react-sdk
+1 -16
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Fetches the js-sdk and matrix-react-sdk dependencies for development # Fetches the js-sdk dependency for development or testing purposes
# or testing purposes
# If there exists a branch of that dependency with the same name as # If there exists a branch of that dependency with the same name as
# the branch the current checkout is on, use that branch. Otherwise, # the branch the current checkout is on, use that branch. Otherwise,
# use develop. # use develop.
@@ -83,17 +82,3 @@ popd
yarn link matrix-js-sdk yarn link matrix-js-sdk
############################## ##############################
echo 'Setting up matrix-react-sdk'
dodep element-hq matrix-react-sdk
pushd matrix-react-sdk
yarn link
yarn link matrix-js-sdk
yarn install --frozen-lockfile
popd
yarn link matrix-react-sdk
##############################
+2 -2
View File
@@ -11,10 +11,10 @@ rm -r "$defrepo" || true
# figure out where to look for pull requests: # figure out where to look for pull requests:
# - We may have been told an explicit repo via the PR_ORG/PR_REPO/PR_NUMBER env vars # - We may have been told an explicit repo via the PR_ORG/PR_REPO/PR_NUMBER env vars
# - otherwise, check the $GITHUB_ env vars which are set by Github Actions # - otherwise, check the $GITHUB_ env vars which are set by Github Actions
# - failing that, fall back to the matrix-org/matrix-react-sdk repo. # - failing that, fall back to the element-hq/element-web repo.
# #
# in ether case, the PR_NUMBER variable must be set explicitly. # in ether case, the PR_NUMBER variable must be set explicitly.
default_org_repo=${GITHUB_REPOSITORY:-"matrix-org/matrix-react-sdk"} default_org_repo=${GITHUB_REPOSITORY:-"element-hq/element-web"}
PR_ORG=${PR_ORG:-${default_org_repo%%/*}} PR_ORG=${PR_ORG:-${default_org_repo%%/*}}
PR_REPO=${PR_REPO:-${default_org_repo##*/}} PR_REPO=${PR_REPO:-${default_org_repo##*/}}
+1 -2
View File
@@ -6,7 +6,6 @@
set -e set -e
# Since the deps are fetched from git, we can rev-parse # Since the deps are fetched from git, we can rev-parse
REACT_SHA=$(git -C node_modules/matrix-react-sdk rev-parse --short=12 HEAD)
JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD) JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD)
VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop
echo $VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA echo $VECTOR_SHA-js-$JSSDK_SHA
+7 -14
View File
@@ -8,12 +8,12 @@ set -ex
# in element-web. # in element-web.
# Note that this style is different from the recommended developer setup: this # Note that this style is different from the recommended developer setup: this
# file nests js-sdk and matrix-react-sdk inside element-web, while the local # file nests js-sdk inside element-web, while the local
# development setup places them all at the same level. We are nesting them here # development setup places them all at the same level. We are nesting them here
# because some CI systems do not allow moving to a directory above the checkout # because some CI systems do not allow moving to a directory above the checkout
# for the primary repo (element-web in this case). # for the primary repo (element-web in this case).
# Install dependencies, as we'll be using fetchdep.sh from matrix-react-sdk # Install dependencies
yarn install --frozen-lockfile yarn install --frozen-lockfile
# Pass appropriate repo to fetchdep.sh # Pass appropriate repo to fetchdep.sh
@@ -21,14 +21,15 @@ export PR_ORG=element-hq
export PR_REPO=element-web export PR_REPO=element-web
# Set up the js-sdk first # Set up the js-sdk first
node_modules/matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-js-sdk develop scripts/fetchdep.sh matrix-org matrix-js-sdk develop
pushd matrix-js-sdk pushd matrix-js-sdk
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
yarn link yarn link
yarn install --frozen-lockfile yarn install --frozen-lockfile
popd popd
# Also set up matrix-analytics-events for branch with matching name # Also set up matrix-analytics-events for branch with matching name
node_modules/matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-analytics-events scripts/fetchdep.sh matrix-org matrix-analytics-events
# We don't pass a default branch so cloning may fail when we are not in a PR # We don't pass a default branch so cloning may fail when we are not in a PR
# This is expected as this project does not share a release cycle but we still branch match it # This is expected as this project does not share a release cycle but we still branch match it
if [ -d matrix-analytics-events ]; then if [ -d matrix-analytics-events ]; then
@@ -39,15 +40,7 @@ if [ -d matrix-analytics-events ]; then
popd popd
fi fi
# Now set up the react-sdk
node_modules/matrix-react-sdk/scripts/fetchdep.sh element-hq matrix-react-sdk develop
pushd matrix-react-sdk
yarn link
yarn link matrix-js-sdk
[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events
yarn install --frozen-lockfile
popd
# Link the layers into element-web # Link the layers into element-web
yarn link matrix-js-sdk yarn link matrix-js-sdk
yarn link matrix-react-sdk [ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events
yarn install --frozen-lockfile $@
+3 -4
View File
@@ -1,4 +1,4 @@
sonar.projectKey=element-hq_matrix-react-sdk sonar.projectKey=element-web
sonar.organization=element-hq sonar.organization=element-hq
# Encoding of the source code. Default is default system encoding # Encoding of the source code. Default is default system encoding
@@ -6,11 +6,10 @@ sonar.organization=element-hq
sonar.sources=src,res sonar.sources=src,res
sonar.tests=test,playwright sonar.tests=test,playwright
sonar.exclusions=__mocks__,docs sonar.exclusions=__mocks__,docs,element.io,nginx
sonar.cpd.exclusions=src/i18n/strings/*.json sonar.cpd.exclusions=src/i18n/strings/*.json
sonar.typescript.tsconfigPath=./tsconfig.json sonar.typescript.tsconfigPath=./tsconfig.json
sonar.javascript.lcov.reportPaths=coverage/lcov.info sonar.javascript.lcov.reportPaths=coverage/lcov.info
# instrumentation is disabled on SessionLock sonar.coverage.exclusions=test/**/*,playwright/**/*,res/**/*,src/vector/modernizr.js,src/components/views/dialogs/devtools/**/*,src/utils/SessionLock.ts
sonar.coverage.exclusions=test/**/*,playwright/**/*,src/components/views/dialogs/devtools/**/*,src/utils/SessionLock.ts
sonar.testExecutionReportPaths=coverage/jest-sonar-report.xml sonar.testExecutionReportPaths=coverage/jest-sonar-report.xml
+45 -7
View File
@@ -1,5 +1,5 @@
/* /*
Copyright 2024 New Vector Ltd. Copyright 2020-2024 New Vector Ltd.
Copyright 2020, 2021 The Matrix.org Foundation C.I.C. Copyright 2020, 2021 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
@@ -10,6 +10,8 @@ Please see LICENSE files in the repository root for full details.
import "matrix-js-sdk/src/@types/global"; // load matrix-js-sdk's type extensions first import "matrix-js-sdk/src/@types/global"; // load matrix-js-sdk's type extensions first
import "@types/modernizr"; import "@types/modernizr";
import type { Renderer } from "react-dom";
import type { logger } from "matrix-js-sdk/src/logger";
import ContentMessages from "../ContentMessages"; import ContentMessages from "../ContentMessages";
import { IMatrixClientPeg } from "../MatrixClientPeg"; import { IMatrixClientPeg } from "../MatrixClientPeg";
import ToastStore from "../stores/ToastStore"; import ToastStore from "../stores/ToastStore";
@@ -21,7 +23,6 @@ import { IntegrationManagers } from "../integrations/IntegrationManagers";
import { ModalManager } from "../Modal"; import { ModalManager } from "../Modal";
import SettingsStore from "../settings/SettingsStore"; import SettingsStore from "../settings/SettingsStore";
import { Notifier } from "../Notifier"; import { Notifier } from "../Notifier";
import type { Renderer } from "react-dom";
import RightPanelStore from "../stores/right-panel/RightPanelStore"; import RightPanelStore from "../stores/right-panel/RightPanelStore";
import WidgetStore from "../stores/WidgetStore"; import WidgetStore from "../stores/WidgetStore";
import LegacyCallHandler from "../LegacyCallHandler"; import LegacyCallHandler from "../LegacyCallHandler";
@@ -46,9 +47,35 @@ import { DeepReadonly } from "./common";
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
type ElectronChannel =
| "app_onAction"
| "before-quit"
| "check_updates"
| "install_update"
| "ipcCall"
| "ipcReply"
| "loudNotification"
| "preferences"
| "seshat"
| "seshatReply"
| "setBadgeCount"
| "update-downloaded"
| "userDownloadCompleted"
| "userDownloadAction"
| "openDesktopCapturerSourcePicker"
| "userAccessToken"
| "homeserverUrl"
| "serverSupportedVersions";
declare global { declare global {
interface Window { interface Window {
mxSendRageshake: (text: string, withLogs?: boolean) => void;
matrixLogger: typeof logger;
matrixChat: ReturnType<Renderer>; matrixChat: ReturnType<Renderer>;
mxSendSentryReport: (userText: string, issueUrl: string, error: Error) => Promise<void>;
mxLoginWithAccessToken: (hsUrl: string, accessToken: string) => Promise<void>;
mxAutoRageshakeStore?: AutoRageshakeStore;
mxDispatcher: MatrixDispatcher;
mxMatrixClientPeg: IMatrixClientPeg; mxMatrixClientPeg: IMatrixClientPeg;
mxReactSdkConfig: DeepReadonly<IConfigOptions>; mxReactSdkConfig: DeepReadonly<IConfigOptions>;
@@ -93,15 +120,19 @@ declare global {
mxRoomScrollStateStore?: RoomScrollStateStore; mxRoomScrollStateStore?: RoomScrollStateStore;
mxActiveWidgetStore?: ActiveWidgetStore; mxActiveWidgetStore?: ActiveWidgetStore;
mxOnRecaptchaLoaded?: () => void; mxOnRecaptchaLoaded?: () => void;
// electron-only
electron?: Electron; electron?: Electron;
mxSendSentryReport: (userText: string, issueUrl: string, error: Error) => Promise<void>; // opera-only
mxLoginWithAccessToken: (hsUrl: string, accessToken: string) => Promise<void>; opera?: any;
mxAutoRageshakeStore?: AutoRageshakeStore;
mxDispatcher: MatrixDispatcher; // https://developer.mozilla.org/en-US/docs/Web/API/InstallTrigger
InstallTrigger: any;
} }
interface Electron { interface Electron {
// will be extended by element-web downstream on(channel: ElectronChannel, listener: (event: Event, ...args: any[]) => void): void;
send(channel: ElectronChannel, ...args: any[]): void;
} }
interface DesktopCapturerSource { interface DesktopCapturerSource {
@@ -202,4 +233,11 @@ declare global {
var mx_rage_store: IndexedDBLogStore; var mx_rage_store: IndexedDBLogStore;
} }
// add method which is missing from the node typing
declare module "url" {
interface Url {
format(): string;
}
}
/* eslint-enable @typescript-eslint/naming-convention */ /* eslint-enable @typescript-eslint/naming-convention */
+2 -2
View File
@@ -7,9 +7,9 @@ Please see LICENSE files in the repository root for full details.
*/ */
import { ScalableBloomFilter } from "bloom-filters"; import { ScalableBloomFilter } from "bloom-filters";
import { CryptoEvent, HttpApiEvent, MatrixClient, MatrixEventEvent, MatrixEvent } from "matrix-js-sdk/src/matrix"; import { HttpApiEvent, MatrixClient, MatrixEventEvent, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { Error as ErrorEvent } from "@matrix-org/analytics-events/types/typescript/Error"; import { Error as ErrorEvent } from "@matrix-org/analytics-events/types/typescript/Error";
import { DecryptionFailureCode } from "matrix-js-sdk/src/crypto-api"; import { DecryptionFailureCode, CryptoEvent } from "matrix-js-sdk/src/crypto-api";
import { PosthogAnalytics } from "./PosthogAnalytics"; import { PosthogAnalytics } from "./PosthogAnalytics";
import { MEGOLM_ENCRYPTION_ALGORITHM } from "./utils/crypto"; import { MEGOLM_ENCRYPTION_ALGORITHM } from "./utils/crypto";

Some files were not shown because too many files have changed in this diff Show More