Skip to content

Commit accd4a5

Browse files
Kerryt3chguy
authored andcommitted
use cli.canSupport to determine intentional mentions support (#3445)
* use cli.canSupport to determine intentional mentions support * more specific comment * Update src/client.ts Co-authored-by: Michael Telatynski <[email protected]> --------- Co-authored-by: Michael Telatynski <[email protected]>
1 parent 4c219cf commit accd4a5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/client.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,6 @@ export interface IStartClientOpts {
469469
* @experimental
470470
*/
471471
slidingSync?: SlidingSync;
472-
473-
/**
474-
* @experimental
475-
*/
476-
intentionalMentions?: boolean;
477472
}
478473

479474
export interface IStoredClientOpts extends IStartClientOpts {}
@@ -9635,11 +9630,11 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
96359630

96369631
/**
96379632
* A helper to determine intentional mentions support
9638-
* @returns a boolean to determine if intentional mentions are enabled
9633+
* @returns a boolean to determine if intentional mentions are enabled on the server
96399634
* @experimental
96409635
*/
96419636
public supportsIntentionalMentions(): boolean {
9642-
return this.clientOpts?.intentionalMentions || false;
9637+
return this.canSupport.get(Feature.IntentionalMentions) !== ServerSupport.Unsupported;
96439638
}
96449639

96459640
/**

src/feature.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export enum Feature {
3232
RelationBasedRedactions = "RelationBasedRedactions",
3333
AccountDataDeletion = "AccountDataDeletion",
3434
RelationsRecursion = "RelationsRecursion",
35+
IntentionalMentions = "IntentionalMentions",
3536
}
3637

3738
type FeatureSupportCondition = {
@@ -60,6 +61,9 @@ const featureSupportResolver: Record<string, FeatureSupportCondition> = {
6061
[Feature.RelationsRecursion]: {
6162
unstablePrefixes: ["org.matrix.msc3981"],
6263
},
64+
[Feature.IntentionalMentions]: {
65+
unstablePrefixes: ["org.matrix.msc3952_intentional_mentions"],
66+
},
6367
};
6468

6569
export async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> {

0 commit comments

Comments
 (0)