Skip to content

Commit 6128de1

Browse files
committed
Merge tag 'v21.2.0' into sc
* Make calls go back to 'connecting' state when media lost ([\matrix-org#2880](matrix-org#2880)). * Add ability to send unthreaded receipt ([\matrix-org#2878](matrix-org#2878)). * Add way to abort search requests ([\matrix-org#2877](matrix-org#2877)). * sliding sync: add custom room subscriptions support ([\matrix-org#2834](matrix-org#2834)). * webrtc: add advanced audio settings ([\matrix-org#2434](matrix-org#2434)). Contributed by @MrAnno. * Add support for group calls using MSC3401 ([\matrix-org#2553](matrix-org#2553)). * Make the js-sdk conform to tsc --strict ([\matrix-org#2835](matrix-org#2835)). Fixes matrix-org#2112 matrix-org#2116 and matrix-org#2124. * Let leave requests outlive the window ([\matrix-org#2815](matrix-org#2815)). Fixes element-hq/element-call#639. * Add event and message capabilities to RoomWidgetClient ([\matrix-org#2797](matrix-org#2797)). * Misc fixes for group call widgets ([\matrix-org#2657](matrix-org#2657)). * Support nested Matrix clients via the widget API ([\matrix-org#2473](matrix-org#2473)). * Set max average bitrate on PTT calls ([\matrix-org#2499](matrix-org#2499)). Fixes element-hq/element-call#440. * Add config option for e2e group call signalling ([\matrix-org#2492](matrix-org#2492)). * Enable DTX on audio tracks in calls ([\matrix-org#2482](matrix-org#2482)). * Don't ignore call member events with a distant future expiration date ([\matrix-org#2466](matrix-org#2466)). * Expire call member state events after 1 hour ([\matrix-org#2446](matrix-org#2446)). * Emit unknown device errors for group call participants without e2e ([\matrix-org#2447](matrix-org#2447)). * Mute disconnected peers in PTT mode ([\matrix-org#2421](matrix-org#2421)). * Add support for sending encrypted to-device events with OLM ([\matrix-org#2322](matrix-org#2322)). Contributed by @robertlong. * Support for PTT group call mode ([\matrix-org#2338](matrix-org#2338)). * Fix registration add phone number not working ([\matrix-org#2876](matrix-org#2876)). Contributed by @bagvand. * Use an underride rule for Element Call notifications ([\matrix-org#2873](matrix-org#2873)). Fixes element-hq/element-web#23691. * Fixes unwanted highlight notifications with encrypted threads ([\matrix-org#2862](matrix-org#2862)). * Extra insurance that we don't mix events in the wrong timelines - v2 ([\matrix-org#2856](matrix-org#2856)). Contributed by @MadLittleMods. * Hide pending events in thread timelines ([\matrix-org#2843](matrix-org#2843)). Fixes element-hq/element-web#23684. * Fix pagination token tracking for mixed room timelines ([\matrix-org#2855](matrix-org#2855)). Fixes element-hq/element-web#23695. * Extra insurance that we don't mix events in the wrong timelines ([\matrix-org#2848](matrix-org#2848)). Contributed by @MadLittleMods. * Do not freeze state in `initialiseState()` ([\matrix-org#2846](matrix-org#2846)). * Don't remove our own member for a split second when entering a call ([\matrix-org#2844](matrix-org#2844)). * Resolve races between `initLocalCallFeed` and `leave` ([\matrix-org#2826](matrix-org#2826)). * Add throwOnFail to groupCall.setScreensharingEnabled ([\matrix-org#2787](matrix-org#2787)). * Fix connectivity regressions ([\matrix-org#2780](matrix-org#2780)). * Fix screenshare failing after several attempts ([\matrix-org#2771](matrix-org#2771)). Fixes element-hq/element-call#625. * Don't block muting/unmuting on network requests ([\matrix-org#2754](matrix-org#2754)). Fixes element-hq/element-call#592. * Fix ICE restarts ([\matrix-org#2702](matrix-org#2702)). * Target widget actions at a specific room ([\matrix-org#2670](matrix-org#2670)). * Add tests for ice candidate sending ([\matrix-org#2674](matrix-org#2674)). * Prevent exception when muting ([\matrix-org#2667](matrix-org#2667)). Fixes element-hq/element-call#578. * Fix race in creating calls ([\matrix-org#2662](matrix-org#2662)). * Add client.waitUntilRoomReadyForGroupCalls() ([\matrix-org#2641](matrix-org#2641)). * Wait for client to start syncing before making group calls ([\matrix-org#2632](matrix-org#2632)). Fixes matrix-org#2589. * Add GroupCallEventHandlerEvent.Room ([\matrix-org#2631](matrix-org#2631)). * Add missing events from reemitter to GroupCall ([\matrix-org#2527](matrix-org#2527)). Contributed by @toger5. * Prevent double mute status changed events ([\matrix-org#2502](matrix-org#2502)). * Don't mute the remote side immediately in PTT calls ([\matrix-org#2487](matrix-org#2487)). Fixes element-hq/element-call#425. * Fix some MatrixCall leaks and use a shared AudioContext ([\matrix-org#2484](matrix-org#2484)). Fixes element-hq/element-call#412. * Don't block muting on determining whether the device exists ([\matrix-org#2461](matrix-org#2461)). * Only clone streams on Safari ([\matrix-org#2450](matrix-org#2450)). Fixes element-hq/element-call#267. * Set PTT mode on call correctly ([\matrix-org#2445](matrix-org#2445)). Fixes element-hq/element-call#382. * Wait for mute event to send in PTT mode ([\matrix-org#2401](matrix-org#2401)). * Handle other members having no e2e keys ([\matrix-org#2383](matrix-org#2383)). Fixes element-hq/element-call#338. * Fix races when muting/unmuting ([\matrix-org#2370](matrix-org#2370)).
2 parents 1474204 + 3702ac5 commit 6128de1

File tree

92 files changed

+9722
-2059
lines changed

Some content is hidden

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

92 files changed

+9722
-2059
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy documentation PR preview
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Static Analysis" ]
6+
types:
7+
- completed
8+
9+
jobs:
10+
netlify:
11+
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
12+
runs-on: ubuntu-latest
13+
steps:
14+
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
15+
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
16+
- name: 📥 Download artifact
17+
uses: dawidd6/action-download-artifact@b12b127cf24433d14b4f93cee62f5465076ba82a # v2.24.1
18+
with:
19+
workflow: static_analysis.yml
20+
run_id: ${{ github.event.workflow_run.id }}
21+
name: docs
22+
path: docs
23+
24+
- name: 📤 Deploy to Netlify
25+
uses: matrix-org/netlify-pr-preview@v1
26+
with:
27+
path: docs
28+
owner: ${{ github.event.workflow_run.head_repository.owner.login }}
29+
branch: ${{ github.event.workflow_run.head_branch }}
30+
revision: ${{ github.event.workflow_run.head_sha }}
31+
token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
32+
site_id: ${{ secrets.NETLIFY_SITE_ID }}
33+
desc: Documentation preview
34+
deployment_env: PR Documentation Preview

.github/workflows/static_analysis.yml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,11 @@ jobs:
6464

6565
- name: Generate Docs
6666
run: "yarn run gendoc"
67-
68-
tsc-strict:
69-
name: Typescript Strict Error Checker
70-
if: github.event_name == 'pull_request'
71-
runs-on: ubuntu-latest
72-
permissions:
73-
pull-requests: read
74-
checks: write
75-
steps:
76-
- uses: actions/checkout@v3
77-
78-
- name: Get diff lines
79-
id: diff
80-
uses: Equip-Collaboration/[email protected]
81-
with:
82-
include: '["\\.tsx?$"]'
83-
84-
- name: Detecting files changed
85-
id: files
86-
uses: futuratrepadeira/[email protected]
87-
with:
88-
repo-token: ${{ secrets.GITHUB_TOKEN }}
89-
pattern: '^.*\.tsx?$'
90-
91-
- uses: t3chguy/typescript-check-action@main
67+
68+
- name: Upload Artifact
69+
uses: actions/upload-artifact@v2
9270
with:
93-
repo-token: ${{ secrets.GITHUB_TOKEN }}
94-
use-check: false
95-
check-fail-mode: added
96-
output-behaviour: annotate
97-
ts-extra-args: '--strict'
98-
files-changed: ${{ steps.files.outputs.files_updated }}
99-
files-added: ${{ steps.files.outputs.files_created }}
100-
files-deleted: ${{ steps.files.outputs.files_deleted }}
101-
line-numbers: ${{ steps.diff.outputs.lineNumbers }}
71+
name: docs
72+
path: _docs
73+
# We'll only use this in a workflow_run, then we're done with it
74+
retention-days: 1

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/.jsdocbuild
2-
/.jsdoc
1+
/_docs
2+
.DS_Store
33

44
node_modules
55
/.npmrc

CHANGELOG.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1+
Changes in [21.2.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v21.2.0) (2022-11-22)
2+
==================================================================================================
3+
4+
## ✨ Features
5+
* Make calls go back to 'connecting' state when media lost ([\#2880](https://github.com/matrix-org/matrix-js-sdk/pull/2880)).
6+
* Add ability to send unthreaded receipt ([\#2878](https://github.com/matrix-org/matrix-js-sdk/pull/2878)).
7+
* Add way to abort search requests ([\#2877](https://github.com/matrix-org/matrix-js-sdk/pull/2877)).
8+
* sliding sync: add custom room subscriptions support ([\#2834](https://github.com/matrix-org/matrix-js-sdk/pull/2834)).
9+
* webrtc: add advanced audio settings ([\#2434](https://github.com/matrix-org/matrix-js-sdk/pull/2434)). Contributed by @MrAnno.
10+
* Add support for group calls using MSC3401 ([\#2553](https://github.com/matrix-org/matrix-js-sdk/pull/2553)).
11+
* Make the js-sdk conform to tsc --strict ([\#2835](https://github.com/matrix-org/matrix-js-sdk/pull/2835)). Fixes #2112 #2116 and #2124.
12+
* Let leave requests outlive the window ([\#2815](https://github.com/matrix-org/matrix-js-sdk/pull/2815)). Fixes vector-im/element-call#639.
13+
* Add event and message capabilities to RoomWidgetClient ([\#2797](https://github.com/matrix-org/matrix-js-sdk/pull/2797)).
14+
* Misc fixes for group call widgets ([\#2657](https://github.com/matrix-org/matrix-js-sdk/pull/2657)).
15+
* Support nested Matrix clients via the widget API ([\#2473](https://github.com/matrix-org/matrix-js-sdk/pull/2473)).
16+
* Set max average bitrate on PTT calls ([\#2499](https://github.com/matrix-org/matrix-js-sdk/pull/2499)). Fixes vector-im/element-call#440.
17+
* Add config option for e2e group call signalling ([\#2492](https://github.com/matrix-org/matrix-js-sdk/pull/2492)).
18+
* Enable DTX on audio tracks in calls ([\#2482](https://github.com/matrix-org/matrix-js-sdk/pull/2482)).
19+
* Don't ignore call member events with a distant future expiration date ([\#2466](https://github.com/matrix-org/matrix-js-sdk/pull/2466)).
20+
* Expire call member state events after 1 hour ([\#2446](https://github.com/matrix-org/matrix-js-sdk/pull/2446)).
21+
* Emit unknown device errors for group call participants without e2e ([\#2447](https://github.com/matrix-org/matrix-js-sdk/pull/2447)).
22+
* Mute disconnected peers in PTT mode ([\#2421](https://github.com/matrix-org/matrix-js-sdk/pull/2421)).
23+
* Add support for sending encrypted to-device events with OLM ([\#2322](https://github.com/matrix-org/matrix-js-sdk/pull/2322)). Contributed by @robertlong.
24+
* Support for PTT group call mode ([\#2338](https://github.com/matrix-org/matrix-js-sdk/pull/2338)).
25+
26+
## 🐛 Bug Fixes
27+
* Fix registration add phone number not working ([\#2876](https://github.com/matrix-org/matrix-js-sdk/pull/2876)). Contributed by @bagvand.
28+
* Use an underride rule for Element Call notifications ([\#2873](https://github.com/matrix-org/matrix-js-sdk/pull/2873)). Fixes vector-im/element-web#23691.
29+
* Fixes unwanted highlight notifications with encrypted threads ([\#2862](https://github.com/matrix-org/matrix-js-sdk/pull/2862)).
30+
* Extra insurance that we don't mix events in the wrong timelines - v2 ([\#2856](https://github.com/matrix-org/matrix-js-sdk/pull/2856)). Contributed by @MadLittleMods.
31+
* Hide pending events in thread timelines ([\#2843](https://github.com/matrix-org/matrix-js-sdk/pull/2843)). Fixes vector-im/element-web#23684.
32+
* Fix pagination token tracking for mixed room timelines ([\#2855](https://github.com/matrix-org/matrix-js-sdk/pull/2855)). Fixes vector-im/element-web#23695.
33+
* Extra insurance that we don't mix events in the wrong timelines ([\#2848](https://github.com/matrix-org/matrix-js-sdk/pull/2848)). Contributed by @MadLittleMods.
34+
* Do not freeze state in `initialiseState()` ([\#2846](https://github.com/matrix-org/matrix-js-sdk/pull/2846)).
35+
* Don't remove our own member for a split second when entering a call ([\#2844](https://github.com/matrix-org/matrix-js-sdk/pull/2844)).
36+
* Resolve races between `initLocalCallFeed` and `leave` ([\#2826](https://github.com/matrix-org/matrix-js-sdk/pull/2826)).
37+
* Add throwOnFail to groupCall.setScreensharingEnabled ([\#2787](https://github.com/matrix-org/matrix-js-sdk/pull/2787)).
38+
* Fix connectivity regressions ([\#2780](https://github.com/matrix-org/matrix-js-sdk/pull/2780)).
39+
* Fix screenshare failing after several attempts ([\#2771](https://github.com/matrix-org/matrix-js-sdk/pull/2771)). Fixes vector-im/element-call#625.
40+
* Don't block muting/unmuting on network requests ([\#2754](https://github.com/matrix-org/matrix-js-sdk/pull/2754)). Fixes vector-im/element-call#592.
41+
* Fix ICE restarts ([\#2702](https://github.com/matrix-org/matrix-js-sdk/pull/2702)).
42+
* Target widget actions at a specific room ([\#2670](https://github.com/matrix-org/matrix-js-sdk/pull/2670)).
43+
* Add tests for ice candidate sending ([\#2674](https://github.com/matrix-org/matrix-js-sdk/pull/2674)).
44+
* Prevent exception when muting ([\#2667](https://github.com/matrix-org/matrix-js-sdk/pull/2667)). Fixes vector-im/element-call#578.
45+
* Fix race in creating calls ([\#2662](https://github.com/matrix-org/matrix-js-sdk/pull/2662)).
46+
* Add client.waitUntilRoomReadyForGroupCalls() ([\#2641](https://github.com/matrix-org/matrix-js-sdk/pull/2641)).
47+
* Wait for client to start syncing before making group calls ([\#2632](https://github.com/matrix-org/matrix-js-sdk/pull/2632)). Fixes #2589.
48+
* Add GroupCallEventHandlerEvent.Room ([\#2631](https://github.com/matrix-org/matrix-js-sdk/pull/2631)).
49+
* Add missing events from reemitter to GroupCall ([\#2527](https://github.com/matrix-org/matrix-js-sdk/pull/2527)). Contributed by @toger5.
50+
* Prevent double mute status changed events ([\#2502](https://github.com/matrix-org/matrix-js-sdk/pull/2502)).
51+
* Don't mute the remote side immediately in PTT calls ([\#2487](https://github.com/matrix-org/matrix-js-sdk/pull/2487)). Fixes vector-im/element-call#425.
52+
* Fix some MatrixCall leaks and use a shared AudioContext ([\#2484](https://github.com/matrix-org/matrix-js-sdk/pull/2484)). Fixes vector-im/element-call#412.
53+
* Don't block muting on determining whether the device exists ([\#2461](https://github.com/matrix-org/matrix-js-sdk/pull/2461)).
54+
* Only clone streams on Safari ([\#2450](https://github.com/matrix-org/matrix-js-sdk/pull/2450)). Fixes vector-im/element-call#267.
55+
* Set PTT mode on call correctly ([\#2445](https://github.com/matrix-org/matrix-js-sdk/pull/2445)). Fixes vector-im/element-call#382.
56+
* Wait for mute event to send in PTT mode ([\#2401](https://github.com/matrix-org/matrix-js-sdk/pull/2401)).
57+
* Handle other members having no e2e keys ([\#2383](https://github.com/matrix-org/matrix-js-sdk/pull/2383)). Fixes vector-im/element-call#338.
58+
* Fix races when muting/unmuting ([\#2370](https://github.com/matrix-org/matrix-js-sdk/pull/2370)).
59+
160
Changes in [21.1.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v21.1.0) (2022-11-08)
261
==================================================================================================
362

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ API Reference
296296
A hosted reference can be found at
297297
http://matrix-org.github.io/matrix-js-sdk/index.html
298298

299-
This SDK uses JSDoc3 style comments. You can manually build and
299+
This SDK uses [Typedoc](https://typedoc.org/guides/doccomments) doc comments. You can manually build and
300300
host the API reference from the source files like this:
301301

302302
```
303303
$ yarn gendoc
304-
$ cd .jsdoc
304+
$ cd _docs
305305
$ python -m http.server 8005
306306
```
307307

jsdoc.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

package.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-js-sdk",
3-
"version": "21.1.0",
3+
"version": "21.2.0",
44
"description": "Matrix Client-Server SDK for Javascript",
55
"engines": {
66
"node": ">=16.0.0"
@@ -16,7 +16,7 @@
1616
"build:compile": "babel -d lib --verbose --extensions \".ts,.js\" src",
1717
"build:compile-browser": "mkdirp dist && browserify -d src/browser-index.js -p [ tsify -p ./tsconfig-build.json ] -t [ babelify --sourceMaps=inline --presets [ @babel/preset-env @babel/preset-typescript ] ] | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js",
1818
"build:minify-browser": "terser dist/browser-matrix.js --compress --mangle --source-map --output dist/browser-matrix.min.js",
19-
"gendoc": "jsdoc -c jsdoc.json -P package.json",
19+
"gendoc": "typedoc",
2020
"lint": "yarn lint:types && yarn lint:js",
2121
"lint:js": "eslint --max-warnings 0 src spec",
2222
"lint:js-fix": "eslint --fix src spec",
@@ -54,13 +54,16 @@
5454
],
5555
"dependencies": {
5656
"@babel/runtime": "^7.12.5",
57+
"@types/sdp-transform": "^2.4.5",
5758
"another-json": "^0.2.0",
5859
"bs58": "^5.0.0",
5960
"content-type": "^1.0.4",
6061
"loglevel": "^1.7.1",
61-
"matrix-events-sdk": "^0.0.1-beta.7",
62+
"matrix-events-sdk": "0.0.1",
63+
"matrix-widget-api": "^1.0.0",
6264
"p-retry": "4",
6365
"qs": "^6.9.6",
66+
"sdp-transform": "^2.14.1",
6467
"unhomoglyph": "^1.0.6"
6568
},
6669
"devDependencies": {
@@ -76,6 +79,7 @@
7679
"@babel/preset-env": "^7.12.11",
7780
"@babel/preset-typescript": "^7.12.7",
7881
"@babel/register": "^7.12.10",
82+
"@casualbot/jest-sonar-reporter": "^2.2.5",
7983
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.13.tgz",
8084
"@types/bs58": "^4.0.1",
8185
"@types/content-type": "^1.1.5",
@@ -91,7 +95,7 @@
9195
"browserify": "^17.0.0",
9296
"docdash": "^1.2.0",
9397
"domexception": "^4.0.0",
94-
"eslint": "8.25.0",
98+
"eslint": "8.26.0",
9599
"eslint-config-google": "^0.14.0",
96100
"eslint-import-resolver-typescript": "^3.5.1",
97101
"eslint-plugin-import": "^2.26.0",
@@ -100,14 +104,15 @@
100104
"exorcist": "^2.0.0",
101105
"fake-indexeddb": "^4.0.0",
102106
"jest": "^29.0.0",
107+
"jest-environment-jsdom": "^28.1.3",
103108
"jest-localstorage-mock": "^2.4.6",
104109
"jest-mock": "^29.0.0",
105-
"jest-sonar-reporter": "^2.0.0",
106-
"jsdoc": "^3.6.6",
107110
"matrix-mock-request": "^2.5.0",
108111
"rimraf": "^3.0.2",
109112
"terser": "^5.5.1",
110113
"tsify": "^5.0.2",
114+
"typedoc": "^0.23.20",
115+
"typedoc-plugin-missing-exports": "^1.0.0",
111116
"typescript": "^4.5.3"
112117
},
113118
"jest": {
@@ -125,11 +130,12 @@
125130
"text-summary",
126131
"lcov"
127132
],
128-
"testResultsProcessor": "jest-sonar-reporter"
133+
"testResultsProcessor": "@casualbot/jest-sonar-reporter"
129134
},
130-
"jestSonar": {
131-
"reportPath": "coverage",
132-
"sonar56x": true
135+
"@casualbot/jest-sonar-reporter": {
136+
"outputDirectory": "coverage",
137+
"outputName": "jest-sonar-report.xml",
138+
"relativePaths": true
133139
},
134140
"typings": "./lib/index.d.ts"
135141
}

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ sonar.exclusions=docs,examples,git-hooks
1111
sonar.typescript.tsconfigPath=./tsconfig.json
1212
sonar.javascript.lcov.reportPaths=coverage/lcov.info
1313
sonar.coverage.exclusions=spec/**/*
14-
sonar.testExecutionReportPaths=coverage/test-report.xml
14+
sonar.testExecutionReportPaths=coverage/jest-sonar-report.xml
1515

1616
sonar.lang.patterns.ts=**/*.ts,**/*.tsx

spec/browserify/setupTests.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
import "../../dist/browser-matrix"; // uses browser-matrix instead of the src
18+
import type { MatrixClient, ClientEvent } from "../../src";
19+
20+
declare global {
21+
// eslint-disable-next-line @typescript-eslint/no-namespace
22+
namespace NodeJS {
23+
interface Global {
24+
matrixcs: {
25+
MatrixClient: typeof MatrixClient;
26+
ClientEvent: typeof ClientEvent;
27+
};
28+
}
29+
}
30+
}
31+
1732
// stub for browser-matrix browserify tests
1833
// @ts-ignore
1934
global.XMLHttpRequest = jest.fn();
@@ -23,3 +38,9 @@ afterAll(() => {
2338
// @ts-ignore
2439
global.XMLHttpRequest = undefined;
2540
});
41+
42+
// Akin to spec/setupTests.ts - but that won't affect the browser-matrix bundle
43+
global.matrixcs = {
44+
...global.matrixcs,
45+
timeoutSignal: () => new AbortController().signal,
46+
};

spec/browserify/sync-browserify.spec.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,14 @@ limitations under the License.
1616

1717
import HttpBackend from "matrix-mock-request";
1818

19-
import "./setupTests";
20-
import "../../dist/browser-matrix"; // uses browser-matrix instead of the src
21-
import type { MatrixClient, ClientEvent } from "../../src";
19+
import "./setupTests";// uses browser-matrix instead of the src
20+
import type { MatrixClient } from "../../src";
2221

2322
const USER_ID = "@user:test.server";
2423
const DEVICE_ID = "device_id";
2524
const ACCESS_TOKEN = "access_token";
2625
const ROOM_ID = "!room_id:server.test";
2726

28-
declare global {
29-
// eslint-disable-next-line @typescript-eslint/no-namespace
30-
namespace NodeJS {
31-
interface Global {
32-
matrixcs: {
33-
MatrixClient: typeof MatrixClient;
34-
ClientEvent: typeof ClientEvent;
35-
};
36-
}
37-
}
38-
}
39-
4027
describe("Browserify Test", function() {
4128
let client: MatrixClient;
4229
let httpBackend: HttpBackend;

spec/integ/matrix-client-event-timeline.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ import * as utils from "../test-utils/test-utils";
1818
import {
1919
ClientEvent,
2020
Direction,
21+
EventStatus,
2122
EventTimeline,
2223
EventTimelineSet,
2324
Filter,
2425
IEvent,
2526
MatrixClient,
2627
MatrixEvent,
28+
PendingEventOrdering,
2729
Room,
2830
} from "../../src/matrix";
2931
import { logger } from "../../src/logger";
@@ -1162,6 +1164,25 @@ describe("MatrixClient event timelines", function() {
11621164
httpBackend.when("GET", "/sync").respond(200, INITIAL_SYNC_DATA);
11631165
await flushHttp(room.fetchRoomThreads());
11641166
});
1167+
1168+
it("should prevent displaying pending events", async function() {
1169+
const room = new Room("room123", client, "john", {
1170+
pendingEventOrdering: PendingEventOrdering.Detached,
1171+
});
1172+
const timelineSets = await room!.createThreadsTimelineSets();
1173+
expect(timelineSets).not.toBeNull();
1174+
1175+
const event = utils.mkMessage({
1176+
room: roomId, user: userId, msg: "a body", event: true,
1177+
});
1178+
event.status = EventStatus.SENDING;
1179+
room.addPendingEvent(event, "txn");
1180+
1181+
const [allThreads, myThreads] = timelineSets!;
1182+
expect(allThreads.getPendingEvents()).toHaveLength(0);
1183+
expect(myThreads.getPendingEvents()).toHaveLength(0);
1184+
expect(room.getPendingEvents()).toHaveLength(1);
1185+
});
11651186
});
11661187

11671188
describe("without server compatibility", function() {

0 commit comments

Comments
 (0)