Skip to content

Commit 2a6db46

Browse files
committed
Merge tag 'v19.0.0' into sc
* Remove unused sessionStore ([\matrix-org#2455](matrix-org#2455)). * Implement MSC3827: Filtering of `/publicRooms` by room type ([\matrix-org#2469](matrix-org#2469)). * expose latestLocationEvent on beacon model ([\matrix-org#2467](matrix-org#2467)). Contributed by @kerryarchibald. * Live location share - add start time leniency ([\matrix-org#2465](matrix-org#2465)). Contributed by @kerryarchibald. * Log real errors and not just their messages, traces are useful ([\matrix-org#2464](matrix-org#2464)). * Various changes to `src/crypto` files for correctness ([\matrix-org#2137](matrix-org#2137)). Contributed by @ShadowJonathan. * Update MSC3786 implementation: Check the `state_key` ([\matrix-org#2429](matrix-org#2429)). * Timeline needs to refresh when we see a MSC2716 marker event ([\matrix-org#2299](matrix-org#2299)). Contributed by @MadLittleMods. * Try to load keys from key backup when a message fails to decrypt ([\matrix-org#2373](matrix-org#2373)). Fixes element-hq/element-web#21026. Contributed by @duxovni. * Send call version `1` as a string ([\matrix-org#2471](matrix-org#2471)). Fixes element-hq/element-web#22629. * Fix issue with `getEventTimeline` returning undefined for thread roots in main timeline ([\matrix-org#2454](matrix-org#2454)). Fixes element-hq/element-web#22539. * Add missing `type` property on `IAuthData` ([\matrix-org#2463](matrix-org#2463)). * Clearly indicate that `lastReply` on a Thread can return falsy ([\matrix-org#2462](matrix-org#2462)). * Fix issues with getEventTimeline and thread roots ([\matrix-org#2444](matrix-org#2444)). Fixes element-hq/element-web#21613. * Live location sharing - monitor liveness of beacons yet to start ([\matrix-org#2437](matrix-org#2437)). Contributed by @kerryarchibald. * Refactor Relations to not be per-EventTimelineSet ([\matrix-org#2412](matrix-org#2412)). Fixes matrix-org#2399 and element-hq/element-web#22298. * Add tests for sendEvent threadId handling ([\matrix-org#2435](matrix-org#2435)). Fixes element-hq/element-web#22433. * Make sure `encryptAndSendKeysToDevices` assumes devices are unique per-user. ([\matrix-org#2136](matrix-org#2136)). Fixes matrix-org#2135. Contributed by @ShadowJonathan. * Don't bug the user while re-checking key backups after decryption failures ([\matrix-org#2430](matrix-org#2430)). Fixes element-hq/element-web#22416. Contributed by @duxovni.
2 parents ee15b18 + 1cb32c1 commit 2a6db46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4429
-2517
lines changed

.github/workflows/notify-downstream.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
concurrency: ${{ github.workflow }}-${{ github.ref }}
66
jobs:
77
notify-downstream:
8+
# Only respect triggers from our develop branch, ignore that of forks
9+
if: github.repository == 'matrix-org/matrix-js-sdk'
810
continue-on-error: true
911
strategy:
1012
fail-fast: false

.github/workflows/pr_details.yml

-49
This file was deleted.

.github/workflows/pull_request.yaml

+72-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ name: Pull Request
22
on:
33
pull_request_target:
44
types: [ opened, edited, labeled, unlabeled, synchronize ]
5+
workflow_call:
6+
inputs:
7+
labels:
8+
type: string
9+
default: "T-Defect,T-Deprecation,T-Enhancement,T-Task"
10+
required: false
11+
description: "No longer used, uses allchange logic now, will be removed at a later date"
12+
secrets:
13+
ELEMENT_BOT_TOKEN:
14+
required: true
515
concurrency: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
616
jobs:
717
changelog:
@@ -12,15 +22,71 @@ jobs:
1222
- uses: matrix-org/allchange@main
1323
with:
1424
ghToken: ${{ secrets.GITHUB_TOKEN }}
25+
requireLabel: true
1526

16-
enforce-label:
17-
name: Enforce Labels
27+
prevent-blocked:
28+
name: Prevent Blocked
1829
runs-on: ubuntu-latest
1930
permissions:
2031
pull-requests: read
2132
steps:
22-
- uses: yogevbd/[email protected]
33+
- name: Add notice
34+
uses: actions/github-script@v5
35+
if: contains(github.event.pull_request.labels.*.name, 'X-Blocked')
2336
with:
24-
REQUIRED_LABELS_ANY: "T-Defect,T-Deprecation,T-Enhancement,T-Task"
25-
BANNED_LABELS: "X-Blocked"
26-
BANNED_LABELS_DESCRIPTION: "Preventing merge whilst PR is marked blocked!"
37+
script: |
38+
core.setFailed("Preventing merge whilst PR is marked blocked!");
39+
40+
community-prs:
41+
name: Label Community PRs
42+
runs-on: ubuntu-latest
43+
if: github.event.action == 'opened'
44+
steps:
45+
- name: Check membership
46+
uses: tspascoal/get-user-teams-membership@v1
47+
id: teams
48+
with:
49+
username: ${{ github.event.pull_request.user.login }}
50+
organization: matrix-org
51+
team: Core Team
52+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
53+
54+
- name: Add label
55+
if: ${{ steps.teams.outputs.isTeamMember == 'false' }}
56+
uses: actions/github-script@v5
57+
with:
58+
script: |
59+
github.rest.issues.addLabels({
60+
issue_number: context.issue.number,
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
labels: ['Z-Community-PR']
64+
});
65+
66+
close-if-fork-develop:
67+
name: Forbid develop branch fork contributions
68+
runs-on: ubuntu-latest
69+
if: >
70+
github.event.action == 'opened' &&
71+
github.event.pull_request.head.ref == 'develop' &&
72+
github.event.pull_request.head.repo.full_name != github.repository
73+
steps:
74+
- name: Close pull request
75+
uses: actions/github-script@v5
76+
with:
77+
script: |
78+
github.rest.issues.createComment({
79+
issue_number: context.issue.number,
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
body: "Thanks for opening this pull request, unfortunately we do not accept contributions from the main" +
83+
" branch of your fork, please re-open once you switch to an alternative branch for everyone's sanity." +
84+
" See https://github.com/matrix-org/matrix-js-sdk/blob/develop/CONTRIBUTING.md",
85+
});
86+
87+
github.rest.pulls.update({
88+
pull_number: context.issue.number,
89+
owner: context.repo.owner,
90+
repo: context.repo.repo,
91+
state: 'closed'
92+
});

.github/workflows/sonarcloud.yml

+12-80
Original file line numberDiff line numberDiff line change
@@ -2,91 +2,23 @@
22
name: SonarCloud
33
on:
44
workflow_call:
5-
inputs:
6-
repo:
7-
type: string
8-
required: true
9-
description: The full name of the repo in org/repo format
10-
head_branch:
11-
type: string
12-
required: true
13-
description: The name of the head branch
14-
# We cannot use ${{ github.sha }} here as for pull requests it'll be a simulated merge commit instead
15-
revision:
16-
type: string
17-
required: true
18-
description: The git revision with which this sonar run should be associated
19-
20-
# Coverage specific parameters, assumes coverage reports live in a /coverage/ directory
21-
coverage_workflow_name:
22-
type: string
23-
required: false
24-
description: The name of the workflow which uploaded the `coverage` artifact, if any
25-
coverage_run_id:
26-
type: string
27-
required: false
28-
description: The run_id of the workflow which upload the coverage relevant to this run
29-
30-
# PR specific parameters
31-
pr_id:
32-
type: string
33-
required: false
34-
description: The ID number of the PR if this workflow is being triggered due to one
35-
base_branch:
36-
type: string
37-
required: false
38-
description: The base branch of the PR if this workflow is being triggered due to one
395
secrets:
406
SONAR_TOKEN:
417
required: true
428
jobs:
43-
analysis:
44-
name: Analysis
9+
sonarqube:
4510
runs-on: ubuntu-latest
11+
if: github.event.workflow_run.conclusion == 'success'
4612
steps:
47-
- name: "🧮 Checkout code"
48-
uses: actions/checkout@v3
49-
with:
50-
repository: ${{ inputs.repo }}
51-
ref: ${{ inputs.head_branch }} # checkout commit that triggered this workflow
52-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
53-
54-
# Fetch base branch from the upstream repo so that Sonar can identify new code in PR builds
55-
- name: "📕 Fetch upstream base branch"
56-
# workflow_call retains the github context of the caller, so `repository` will be upstream always due
57-
# to it running on `workflow_run` which is called from the context of the target repo and not the fork.
58-
if: inputs.base_branch
59-
run: |
60-
git remote add upstream https://github.com/${{ github.repository }}
61-
git rev-parse HEAD
62-
git fetch upstream ${{ inputs.base_branch }}:${{ inputs.base_branch }}
63-
git status
64-
git rev-parse HEAD
65-
66-
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
67-
# (https://github.com/actions/download-artifact/issues/60) so instead we get this alternative:
68-
- name: "📥 Download Coverage Report"
69-
uses: dawidd6/action-download-artifact@v2
70-
if: inputs.coverage_workflow_name
71-
with:
72-
workflow: ${{ inputs.coverage_workflow_name }}
73-
run_id: ${{ inputs.coverage_run_id }}
74-
name: coverage
75-
path: coverage
76-
77-
- name: "🔍 Read package.json version"
78-
id: version
79-
uses: martinbeentjes/npm-get-version-action@main
80-
8113
- name: "🩻 SonarCloud Scan"
82-
uses: SonarSource/sonarcloud-github-action@master
14+
uses: matrix-org/sonarcloud-workflow-action@v2.2
8315
with:
84-
args: >
85-
-Dsonar.projectVersion=${{ steps.version.outputs.current-version }}
86-
-Dsonar.scm.revision=${{ inputs.revision }}
87-
-Dsonar.pullrequest.key=${{ inputs.pr_id }}
88-
-Dsonar.pullrequest.branch=${{ inputs.pr_id && inputs.head_branch }}
89-
-Dsonar.pullrequest.base=${{ inputs.pr_id && inputs.base_branch }}
90-
env:
91-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
92-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
16+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
17+
is_pr: ${{ github.event.workflow_run.event == 'pull_request' }}
18+
version_cmd: 'cat package.json | jq -r .version'
19+
branch: ${{ github.event.workflow_run.head_branch }}
20+
revision: ${{ github.event.workflow_run.head_sha }}
21+
token: ${{ secrets.SONAR_TOKEN }}
22+
coverage_run_id: ${{ github.event.workflow_run.id }}
23+
coverage_workflow_name: tests.yml
24+
coverage_extract_path: coverage

.github/workflows/sonarqube.yml

-22
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,8 @@ concurrency:
88
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
99
cancel-in-progress: true
1010
jobs:
11-
prdetails:
12-
name: ℹ️ PR Details
13-
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
14-
uses: matrix-org/matrix-js-sdk/.github/workflows/pr_details.yml@develop
15-
with:
16-
owner: ${{ github.event.workflow_run.head_repository.owner.login }}
17-
branch: ${{ github.event.workflow_run.head_branch }}
18-
1911
sonarqube:
2012
name: 🩻 SonarQube
21-
needs: prdetails
22-
# Only wait for prdetails if it isn't skipped
23-
if: |
24-
always() &&
25-
(needs.prdetails.result == 'success' || needs.prdetails.result == 'skipped') &&
26-
github.event.workflow_run.conclusion == 'success'
2713
uses: matrix-org/matrix-js-sdk/.github/workflows/sonarcloud.yml@develop
28-
with:
29-
repo: ${{ github.event.workflow_run.head_repository.full_name }}
30-
pr_id: ${{ needs.prdetails.outputs.pr_id }}
31-
head_branch: ${{ needs.prdetails.outputs.head_branch || github.event.workflow_run.head_branch }}
32-
base_branch: ${{ needs.prdetails.outputs.base_branch }}
33-
revision: ${{ github.event.workflow_run.head_sha }}
34-
coverage_workflow_name: tests.yml
35-
coverage_run_id: ${{ github.event.workflow_run.id }}
3614
secrets:
3715
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
Changes in [19.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v19.0.0) (2022-07-05)
2+
==================================================================================================
3+
4+
## 🚨 BREAKING CHANGES
5+
* Remove unused sessionStore ([\#2455](https://github.com/matrix-org/matrix-js-sdk/pull/2455)).
6+
7+
## ✨ Features
8+
* Implement MSC3827: Filtering of `/publicRooms` by room type ([\#2469](https://github.com/matrix-org/matrix-js-sdk/pull/2469)).
9+
* expose latestLocationEvent on beacon model ([\#2467](https://github.com/matrix-org/matrix-js-sdk/pull/2467)). Contributed by @kerryarchibald.
10+
* Live location share - add start time leniency ([\#2465](https://github.com/matrix-org/matrix-js-sdk/pull/2465)). Contributed by @kerryarchibald.
11+
* Log real errors and not just their messages, traces are useful ([\#2464](https://github.com/matrix-org/matrix-js-sdk/pull/2464)).
12+
* Various changes to `src/crypto` files for correctness ([\#2137](https://github.com/matrix-org/matrix-js-sdk/pull/2137)). Contributed by @ShadowJonathan.
13+
* Update MSC3786 implementation: Check the `state_key` ([\#2429](https://github.com/matrix-org/matrix-js-sdk/pull/2429)).
14+
* Timeline needs to refresh when we see a MSC2716 marker event ([\#2299](https://github.com/matrix-org/matrix-js-sdk/pull/2299)). Contributed by @MadLittleMods.
15+
* Try to load keys from key backup when a message fails to decrypt ([\#2373](https://github.com/matrix-org/matrix-js-sdk/pull/2373)). Fixes vector-im/element-web#21026. Contributed by @duxovni.
16+
17+
## 🐛 Bug Fixes
18+
* Send call version `1` as a string ([\#2471](https://github.com/matrix-org/matrix-js-sdk/pull/2471)). Fixes vector-im/element-web#22629.
19+
* Fix issue with `getEventTimeline` returning undefined for thread roots in main timeline ([\#2454](https://github.com/matrix-org/matrix-js-sdk/pull/2454)). Fixes vector-im/element-web#22539.
20+
* Add missing `type` property on `IAuthData` ([\#2463](https://github.com/matrix-org/matrix-js-sdk/pull/2463)).
21+
* Clearly indicate that `lastReply` on a Thread can return falsy ([\#2462](https://github.com/matrix-org/matrix-js-sdk/pull/2462)).
22+
* Fix issues with getEventTimeline and thread roots ([\#2444](https://github.com/matrix-org/matrix-js-sdk/pull/2444)). Fixes vector-im/element-web#21613.
23+
* Live location sharing - monitor liveness of beacons yet to start ([\#2437](https://github.com/matrix-org/matrix-js-sdk/pull/2437)). Contributed by @kerryarchibald.
24+
* Refactor Relations to not be per-EventTimelineSet ([\#2412](https://github.com/matrix-org/matrix-js-sdk/pull/2412)). Fixes #2399 and vector-im/element-web#22298.
25+
* Add tests for sendEvent threadId handling ([\#2435](https://github.com/matrix-org/matrix-js-sdk/pull/2435)). Fixes vector-im/element-web#22433.
26+
* Make sure `encryptAndSendKeysToDevices` assumes devices are unique per-user. ([\#2136](https://github.com/matrix-org/matrix-js-sdk/pull/2136)). Fixes #2135. Contributed by @ShadowJonathan.
27+
* Don't bug the user while re-checking key backups after decryption failures ([\#2430](https://github.com/matrix-org/matrix-js-sdk/pull/2430)). Fixes vector-im/element-web#22416. Contributed by @duxovni.
28+
129
Changes in [18.1.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v18.1.0) (2022-06-07)
230
==================================================================================================
331

CONTRIBUTING.md

+30-6
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,25 @@ Things that should go into your PR description:
2323
* A changelog entry in the `Notes` section (see below)
2424
* References to any bugs fixed by the change (in GitHub's `Fixes` notation)
2525
* Describe the why and what is changing in the PR description so it's easy for
26-
onlookers and reviewers to onboard and context switch.
26+
onlookers and reviewers to onboard and context switch. This information is
27+
also helpful when we come back to look at this in 6 months and ask "why did
28+
we do it like that?" we have a chance of finding out.
29+
* Why didn't it work before? Why does it work now? What use cases does it
30+
unlock?
31+
* If you find yourself adding information on how the code works or why you
32+
chose to do it the way you did, make sure this information is instead
33+
written as comments in the code itself.
34+
* Sometimes a PR can change considerably as it is developed. In this case,
35+
the description should be updated to reflect the most recent state of
36+
the PR. (It can be helpful to retain the old content under a suitable
37+
heading, for additional context.)
2738
* Include both **before** and **after** screenshots to easily compare and discuss
2839
what's changing.
2940
* Include a step-by-step testing strategy so that a reviewer can check out the
3041
code locally and easily get to the point of testing your change.
3142
* Add comments to the diff for the reviewer that might help them to understand
3243
why the change is necessary or how they might better understand and review it.
3344

34-
Things that should *not* go into your PR description:
35-
* Any information on how the code works or why you chose to do it the way
36-
you did. If this isn't obvious from your code, you haven't written enough
37-
comments.
38-
3945
We rely on information in pull request to populate the information that goes
4046
into the changelogs our users see, both for the JS SDK itself and also for some
4147
projects based on it. This is picked up from both labels on the pull request and
@@ -129,6 +135,16 @@ When writing unit tests, please aim for a high level of test coverage
129135
for new code - 80% or greater. If you cannot achieve that, please document
130136
why it's not possible in your PR.
131137

138+
Some sections of code are not sensible to add coverage for, such as those
139+
which explicitly inhibit noisy logging for tests. Which can be hidden using
140+
an istanbul magic comment as [documented here][1]. See example:
141+
```javascript
142+
/* istanbul ignore if */
143+
if (process.env.NODE_ENV !== "test") {
144+
logger.error("Log line that is noisy enough in tests to want to skip");
145+
}
146+
```
147+
132148
Tests validate that your change works as intended and also document
133149
concisely what is being changed. Ideally, your new tests fail
134150
prior to your change, and succeed once it has been applied. You may
@@ -244,6 +260,12 @@ on Git 2.17+ you can mass signoff using rebase:
244260
git rebase --signoff origin/develop
245261
```
246262

263+
Review expectations
264+
===================
265+
266+
See https://github.com/vector-im/element-meta/wiki/Review-process
267+
268+
247269
Merge Strategy
248270
==============
249271

@@ -258,3 +280,5 @@ When stacking pull requests, you may wish to do the following:
258280
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.
259281
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.
260282

283+
284+
[1]: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md

0 commit comments

Comments
 (0)