You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
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 <7t3chguy@gmail.com> --------- Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -469,11 +469,6 @@ export interface IStartClientOpts {
|
|||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
slidingSync?: SlidingSync;
|
slidingSync?: SlidingSync;
|
||||||
|
|
||||||
/**
|
|
||||||
* @experimental
|
|
||||||
*/
|
|
||||||
intentionalMentions?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IStoredClientOpts extends IStartClientOpts {}
|
export interface IStoredClientOpts extends IStartClientOpts {}
|
||||||
@@ -9635,11 +9630,11 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper to determine intentional mentions support
|
* A helper to determine intentional mentions support
|
||||||
* @returns a boolean to determine if intentional mentions are enabled
|
* @returns a boolean to determine if intentional mentions are enabled on the server
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
public supportsIntentionalMentions(): boolean {
|
public supportsIntentionalMentions(): boolean {
|
||||||
return this.clientOpts?.intentionalMentions || false;
|
return this.canSupport.get(Feature.IntentionalMentions) !== ServerSupport.Unsupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export enum Feature {
|
|||||||
RelationBasedRedactions = "RelationBasedRedactions",
|
RelationBasedRedactions = "RelationBasedRedactions",
|
||||||
AccountDataDeletion = "AccountDataDeletion",
|
AccountDataDeletion = "AccountDataDeletion",
|
||||||
RelationsRecursion = "RelationsRecursion",
|
RelationsRecursion = "RelationsRecursion",
|
||||||
|
IntentionalMentions = "IntentionalMentions",
|
||||||
}
|
}
|
||||||
|
|
||||||
type FeatureSupportCondition = {
|
type FeatureSupportCondition = {
|
||||||
@@ -60,6 +61,9 @@ const featureSupportResolver: Record<string, FeatureSupportCondition> = {
|
|||||||
[Feature.RelationsRecursion]: {
|
[Feature.RelationsRecursion]: {
|
||||||
unstablePrefixes: ["org.matrix.msc3981"],
|
unstablePrefixes: ["org.matrix.msc3981"],
|
||||||
},
|
},
|
||||||
|
[Feature.IntentionalMentions]: {
|
||||||
|
unstablePrefixes: ["org.matrix.msc3952_intentional_mentions"],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> {
|
export async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user