You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-10-20 18:32:32 +03:00
Stabilize support for MSC3952: intentional mentions (#10967)
* enable feature_intentional_mentions with v1.7 * org.matrix.msc3952.mentions -> m.mentions * update push rules test util * only support stable version 1.7 * use stable values for msc3952 push rules * use stable intentional mentions rule sin test models * unstable feature in settings controller
This commit is contained in:
@@ -89,7 +89,7 @@ export function attachMentions(
|
||||
}
|
||||
|
||||
// The mentions property *always* gets included to disable legacy push rules.
|
||||
const mentions: IMentions = (content["org.matrix.msc3952.mentions"] = {});
|
||||
const mentions: IMentions = (content["m.mentions"] = {});
|
||||
|
||||
const userMentions = new Set<string>();
|
||||
let roomMention = false;
|
||||
@@ -100,7 +100,7 @@ export function attachMentions(
|
||||
userMentions.add(replyToEvent.sender!.userId);
|
||||
// TODO What do we do if the reply event *doeesn't* have this property?
|
||||
// Try to fish out replies from the contents?
|
||||
const userIds = replyToEvent.getContent()["org.matrix.msc3952.mentions"]?.user_ids;
|
||||
const userIds = replyToEvent.getContent()["m.mentions"]?.user_ids;
|
||||
if (Array.isArray(userIds)) {
|
||||
userIds.forEach((userId) => userMentions.add(userId));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export function attachMentions(
|
||||
if (editedContent) {
|
||||
// First, the new event content gets the *full* set of users.
|
||||
const newContent = content["m.new_content"];
|
||||
const newMentions: IMentions = (newContent["org.matrix.msc3952.mentions"] = {});
|
||||
const newMentions: IMentions = (newContent["m.mentions"] = {});
|
||||
|
||||
// Only include the users/room if there is any content.
|
||||
if (userMentions.size) {
|
||||
@@ -139,7 +139,7 @@ export function attachMentions(
|
||||
|
||||
// Fetch the mentions from the original event and remove any previously
|
||||
// mentioned users.
|
||||
const prevMentions = editedContent["org.matrix.msc3952.mentions"];
|
||||
const prevMentions = editedContent["m.mentions"];
|
||||
if (Array.isArray(prevMentions?.user_ids)) {
|
||||
prevMentions!.user_ids.forEach((userId) => userMentions.delete(userId));
|
||||
}
|
||||
|
@@ -552,9 +552,12 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
||||
displayName: _td("Enable intentional mentions"),
|
||||
labsGroup: LabGroup.Rooms,
|
||||
default: false,
|
||||
controller: new ServerSupportUnstableFeatureController("feature_intentional_mentions", defaultWatchManager, [
|
||||
["org.matrix.msc3952_intentional_mentions"],
|
||||
]),
|
||||
controller: new ServerSupportUnstableFeatureController(
|
||||
"feature_intentional_mentions",
|
||||
defaultWatchManager,
|
||||
[["org.matrix.msc3952_intentional_mentions"]],
|
||||
"v1.7",
|
||||
),
|
||||
},
|
||||
"feature_ask_to_join": {
|
||||
default: false,
|
||||
|
Reference in New Issue
Block a user