1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Implement MSC3952: intentional mentions (#3092)

* Add experimental push rules.

* Update for changes to MSC3952: Use event_property_is and event_property_contains.

* Revert custom user/room mention conditions.

* Skip legacy rule processing if mentions exist.

* Add client option for intentional mentions.

* Fix tests.

* Test leagcy behavior with intentional mentions.

* Handle simple review comments.
This commit is contained in:
Patrick Cloke
2023-03-22 16:22:34 -04:00
committed by GitHub
parent f795577e14
commit fc55c4c72a
5 changed files with 117 additions and 5 deletions

View File

@@ -461,6 +461,11 @@ export interface IStartClientOpts {
* @experimental
*/
slidingSync?: SlidingSync;
/**
* @experimental
*/
intentionalMentions?: boolean;
}
export interface IStoredClientOpts extends IStartClientOpts {}
@@ -8575,7 +8580,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
*/
public setPushRules(rules: IPushRules): void {
// Fix-up defaults, if applicable.
this.pushRules = PushProcessor.rewriteDefaultRules(rules);
this.pushRules = PushProcessor.rewriteDefaultRules(rules, this.getUserId()!);
// Pre-calculate any necessary caches.
this.pushProcessor.updateCachedPushRuleKeys(this.pushRules);
}
@@ -9472,6 +9477,15 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
return this.clientOpts?.threadSupport || false;
}
/**
* A helper to determine intentional mentions support
* @returns a boolean to determine if intentional mentions are enabled
* @experimental
*/
public supportsIntentionalMentions(): boolean {
return this.clientOpts?.intentionalMentions || false;
}
/**
* Fetches the summary of a room as defined by an initial version of MSC3266 and implemented in Synapse
* Proposed at https://github.com/matrix-org/matrix-doc/pull/3266