Skip to content

Commit 0c0854b

Browse files
committed
Merge tag 'v23.4.0' into sc
* Add easy way to determine if the decryption failure is due to "DecryptionError: The sender has disabled encrypting to unverified devices." ([\matrix-org#3167](matrix-org#3167)). Contributed by @florianduros. * Polls: expose end event id on poll model ([\matrix-org#3160](matrix-org#3160)). Contributed by @kerryarchibald. * Polls: count undecryptable poll relations ([\matrix-org#3163](matrix-org#3163)). Contributed by @kerryarchibald. * Fix spec compliance issue around encrypted `m.relates_to` ([\matrix-org#3178](matrix-org#3178)). * Fix reactions in threads sometimes causing stuck notifications ([\matrix-org#3146](matrix-org#3146)). Fixes element-hq/element-web#24000. Contributed by @justjanne. * Better type guard parseTopicContent ([\matrix-org#3165](matrix-org#3165)). Fixes matrix-org/element-web-rageshakes#20177 and matrix-org/element-web-rageshakes#20178. * Fix a bug where events in encrypted rooms would sometimes erroneously increment the total unread counter after being processed locally. ([\matrix-org#3130](matrix-org#3130)). Fixes element-hq/element-web#24448. Contributed by @Half-Shot. * Stop the ICE disconnected timer on call terminate ([\matrix-org#3147](matrix-org#3147)). * Clear notifications when we can infer read status from receipts ([\matrix-org#3139](matrix-org#3139)). Fixes element-hq/element-web#23991. * Messages sent out of order after one message fails ([\matrix-org#3131](matrix-org#3131)). Fixes element-hq/element-web#22885 and element-hq/element-web#18942. Contributed by @justjanne.
2 parents f94634a + 2a5e5e6 commit 0c0854b

Some content is hidden

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

63 files changed

+2931
-1746
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ indent_size = 4
2323
trim_trailing_whitespace = true
2424

2525
[*.{yml,yaml}]
26-
indent_size = 2
26+
indent_size = 4

.eslintrc.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
plugins: ["matrix-org", "import", "jsdoc"],
3-
extends: ["plugin:matrix-org/babel", "plugin:import/typescript"],
3+
extends: ["plugin:matrix-org/babel", "plugin:matrix-org/jest", "plugin:import/typescript"],
44
parserOptions: {
55
project: ["./tsconfig.json"],
66
},
@@ -63,6 +63,23 @@ module.exports = {
6363
],
6464
},
6565
],
66+
// Disabled tests are a reality for now but as soon as all of the xits are
67+
// eliminated, we should enforce this.
68+
"jest/no-disabled-tests": "off",
69+
// TODO: There are many tests with invalid expects that should be fixed,
70+
// https://github.com/matrix-org/matrix-js-sdk/issues/2976
71+
"jest/valid-expect": "off",
72+
// TODO: There are many cases to refactor away,
73+
// https://github.com/matrix-org/matrix-js-sdk/issues/2978
74+
"jest/no-conditional-expect": "off",
75+
// Also treat "oldBackendOnly" as a test function.
76+
// Used in some crypto tests.
77+
"jest/no-standalone-expect": [
78+
"error",
79+
{
80+
additionalTestBlockFunctions: ["beforeAll", "beforeEach", "oldBackendOnly"],
81+
},
82+
],
6683
},
6784
overrides: [
6885
{

.github/workflows/static_analysis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Static Analysis
22
on:
33
pull_request: {}
4+
merge_group:
5+
types: [checks_requested]
46
push:
57
branches: [develop, master]
68
concurrency:

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
Changes in [23.4.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v23.4.0) (2023-02-28)
2+
==================================================================================================
3+
4+
## ✨ Features
5+
* Add easy way to determine if the decryption failure is due to "DecryptionError: The sender has disabled encrypting to unverified devices." ([\#3167](https://github.com/matrix-org/matrix-js-sdk/pull/3167)). Contributed by @florianduros.
6+
* Polls: expose end event id on poll model ([\#3160](https://github.com/matrix-org/matrix-js-sdk/pull/3160)). Contributed by @kerryarchibald.
7+
* Polls: count undecryptable poll relations ([\#3163](https://github.com/matrix-org/matrix-js-sdk/pull/3163)). Contributed by @kerryarchibald.
8+
9+
## 🐛 Bug Fixes
10+
* Fix spec compliance issue around encrypted `m.relates_to` ([\#3178](https://github.com/matrix-org/matrix-js-sdk/pull/3178)).
11+
* Fix reactions in threads sometimes causing stuck notifications ([\#3146](https://github.com/matrix-org/matrix-js-sdk/pull/3146)). Fixes vector-im/element-web#24000. Contributed by @justjanne.
12+
* Better type guard parseTopicContent ([\#3165](https://github.com/matrix-org/matrix-js-sdk/pull/3165)). Fixes matrix-org/element-web-rageshakes#20177 and matrix-org/element-web-rageshakes#20178.
13+
* Fix a bug where events in encrypted rooms would sometimes erroneously increment the total unread counter after being processed locally. ([\#3130](https://github.com/matrix-org/matrix-js-sdk/pull/3130)). Fixes vector-im/element-web#24448. Contributed by @Half-Shot.
14+
* Stop the ICE disconnected timer on call terminate ([\#3147](https://github.com/matrix-org/matrix-js-sdk/pull/3147)).
15+
* Clear notifications when we can infer read status from receipts ([\#3139](https://github.com/matrix-org/matrix-js-sdk/pull/3139)). Fixes vector-im/element-web#23991.
16+
* Messages sent out of order after one message fails ([\#3131](https://github.com/matrix-org/matrix-js-sdk/pull/3131)). Fixes vector-im/element-web#22885 and vector-im/element-web#18942. Contributed by @justjanne.
17+
118
Changes in [23.3.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v23.3.0) (2023-02-14)
219
==================================================================================================
320

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-js-sdk",
3-
"version": "23.3.0",
3+
"version": "23.4.0",
44
"description": "Matrix Client-Server SDK for Javascript",
55
"engines": {
66
"node": ">=16.0.0"
@@ -84,6 +84,7 @@
8484
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz",
8585
"@types/bs58": "^4.0.1",
8686
"@types/content-type": "^1.1.5",
87+
"@types/debug": "^4.1.7",
8788
"@types/domexception": "^4.0.0",
8889
"@types/jest": "^29.0.0",
8990
"@types/node": "18",
@@ -96,15 +97,17 @@
9697
"babelify": "^10.0.0",
9798
"better-docs": "^2.4.0-beta.9",
9899
"browserify": "^17.0.0",
100+
"debug": "^4.3.4",
99101
"docdash": "^2.0.0",
100102
"domexception": "^4.0.0",
101-
"eslint": "8.32.0",
103+
"eslint": "8.33.0",
102104
"eslint-config-google": "^0.14.0",
103105
"eslint-config-prettier": "^8.5.0",
104106
"eslint-import-resolver-typescript": "^3.5.1",
105107
"eslint-plugin-import": "^2.26.0",
108+
"eslint-plugin-jest": "^27.1.6",
106109
"eslint-plugin-jsdoc": "^39.6.4",
107-
"eslint-plugin-matrix-org": "^0.10.0",
110+
"eslint-plugin-matrix-org": "^1.0.0",
108111
"eslint-plugin-tsdoc": "^0.2.17",
109112
"eslint-plugin-unicorn": "^45.0.0",
110113
"exorcist": "^2.0.0",

spec/TestClient.ts

+25-2
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,35 @@ See the License for the specific language governing permissions and
1616
limitations under the License.
1717
*/
1818

19+
// `expect` is allowed in helper functions which are called within `test`/`it` blocks
20+
/* eslint-disable jest/no-standalone-expect */
21+
1922
// load olm before the sdk if possible
2023
import "./olm-loader";
2124

2225
import MockHttpBackend from "matrix-mock-request";
2326

27+
import type { IDeviceKeys, IOneTimeKey } from "../src/@types/crypto";
28+
import type { IE2EKeyReceiver } from "./test-utils/E2EKeyReceiver";
2429
import { LocalStorageCryptoStore } from "../src/crypto/store/localStorage-crypto-store";
2530
import { logger } from "../src/logger";
2631
import { syncPromise } from "./test-utils/test-utils";
2732
import { createClient, IStartClientOpts } from "../src/matrix";
2833
import { ICreateClientOpts, IDownloadKeyResult, MatrixClient, PendingEventOrdering } from "../src/client";
2934
import { MockStorageApi } from "./MockStorageApi";
3035
import { encodeUri } from "../src/utils";
31-
import { IDeviceKeys, IOneTimeKey } from "../src/crypto/dehydration";
3236
import { IKeyBackupSession } from "../src/crypto/keybackup";
3337
import { IKeysUploadResponse, IUploadKeysRequest } from "../src/client";
38+
import { ISyncResponder } from "./test-utils/SyncResponder";
3439

3540
/**
3641
* Wrapper for a MockStorageApi, MockHttpBackend and MatrixClient
42+
*
43+
* @deprecated Avoid using this; it is tied too tightly to matrix-mock-request and is generally inconvenient to use.
44+
* Instead, construct a MatrixClient manually, use fetch-mock-jest to intercept the HTTP requests, and
45+
* use things like {@link E2EKeyReceiver} and {@link SyncResponder} to manage the requests.
3746
*/
38-
export class TestClient {
47+
export class TestClient implements IE2EKeyReceiver, ISyncResponder {
3948
public readonly httpBackend: MockHttpBackend;
4049
public readonly client: MatrixClient;
4150
public deviceKeys?: IDeviceKeys | null;
@@ -240,8 +249,22 @@ export class TestClient {
240249
return this.deviceKeys!.keys[keyId];
241250
}
242251

252+
/** Next time we see a sync request (or immediately, if there is one waiting), send the given response
253+
*
254+
* Calling this will register a response for `/sync`, and then, in the background, flush a single `/sync` request.
255+
* Try calling {@link syncPromise} to wait for the sync to complete.
256+
*
257+
* @param response - response to /sync request
258+
*/
259+
public sendOrQueueSyncResponse(syncResponse: object): void {
260+
this.httpBackend.when("GET", "/sync").respond(200, syncResponse);
261+
this.httpBackend.flush("/sync", 1);
262+
}
263+
243264
/**
244265
* flush a single /sync request, and wait for the syncing event
266+
*
267+
* @deprecated: prefer to use {@link #sendOrQueueSyncResponse} followed by {@link syncPromise}.
245268
*/
246269
public flushSync(): Promise<void> {
247270
logger.log(`${this}: flushSync`);

0 commit comments

Comments
 (0)