You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +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:
@@ -178,7 +178,7 @@ describe("<SendMessageComposer/>", () => {
|
||||
const content: IContent = {};
|
||||
attachMentions("@alice:test", content, model, undefined);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.mentions": {},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -187,7 +187,7 @@ describe("<SendMessageComposer/>", () => {
|
||||
const content: IContent = {};
|
||||
attachMentions("@alice:test", content, model, undefined);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": { user_ids: ["@bob:test"] },
|
||||
"m.mentions": { user_ids: ["@bob:test"] },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -198,13 +198,13 @@ describe("<SendMessageComposer/>", () => {
|
||||
type: "m.room.message",
|
||||
user: "@bob:test",
|
||||
room: "!abc:test",
|
||||
content: { "org.matrix.msc3952.mentions": {} },
|
||||
content: { "m.mentions": {} },
|
||||
event: true,
|
||||
});
|
||||
let content: IContent = {};
|
||||
attachMentions("@alice:test", content, model, replyToEvent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": { user_ids: ["@bob:test"] },
|
||||
"m.mentions": { user_ids: ["@bob:test"] },
|
||||
});
|
||||
|
||||
// It also adds any other mentioned users, but removes yourself.
|
||||
@@ -212,13 +212,13 @@ describe("<SendMessageComposer/>", () => {
|
||||
type: "m.room.message",
|
||||
user: "@bob:test",
|
||||
room: "!abc:test",
|
||||
content: { "org.matrix.msc3952.mentions": { user_ids: ["@alice:test", "@charlie:test"] } },
|
||||
content: { "m.mentions": { user_ids: ["@alice:test", "@charlie:test"] } },
|
||||
event: true,
|
||||
});
|
||||
content = {};
|
||||
attachMentions("@alice:test", content, model, replyToEvent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": { user_ids: ["@bob:test", "@charlie:test"] },
|
||||
"m.mentions": { user_ids: ["@bob:test", "@charlie:test"] },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -227,7 +227,7 @@ describe("<SendMessageComposer/>", () => {
|
||||
const content: IContent = {};
|
||||
attachMentions("@alice:test", content, model, undefined);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": { room: true },
|
||||
"m.mentions": { room: true },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -238,13 +238,13 @@ describe("<SendMessageComposer/>", () => {
|
||||
type: "m.room.message",
|
||||
user: "@alice:test",
|
||||
room: "!abc:test",
|
||||
content: { "org.matrix.msc3952.mentions": { room: true } },
|
||||
content: { "m.mentions": { room: true } },
|
||||
event: true,
|
||||
});
|
||||
const content: IContent = {};
|
||||
attachMentions("@alice:test", content, model, replyToEvent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.mentions": {},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -256,13 +256,13 @@ describe("<SendMessageComposer/>", () => {
|
||||
user: "@alice:test",
|
||||
room: "!abc:test",
|
||||
// @ts-ignore - Purposefully testing invalid data.
|
||||
content: { "org.matrix.msc3952.mentions": { user_ids: "@bob:test" } },
|
||||
content: { "m.mentions": { user_ids: "@bob:test" } },
|
||||
event: true,
|
||||
});
|
||||
const content: IContent = {};
|
||||
attachMentions("@alice:test", content, model, replyToEvent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.mentions": {},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -273,8 +273,8 @@ describe("<SendMessageComposer/>", () => {
|
||||
const prevContent: IContent = {};
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": {} },
|
||||
"m.mentions": {},
|
||||
"m.new_content": { "m.mentions": {} },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -282,12 +282,12 @@ describe("<SendMessageComposer/>", () => {
|
||||
const model = new EditorModel([], partsCreator);
|
||||
const content: IContent = { "m.new_content": {} };
|
||||
const prevContent: IContent = {
|
||||
"org.matrix.msc3952.mentions": { user_ids: ["@bob:test"], room: true },
|
||||
"m.mentions": { user_ids: ["@bob:test"], room: true },
|
||||
};
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": {} },
|
||||
"m.mentions": {},
|
||||
"m.new_content": { "m.mentions": {} },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -297,19 +297,19 @@ describe("<SendMessageComposer/>", () => {
|
||||
const prevContent: IContent = {};
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": { user_ids: ["@bob:test"] },
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": { user_ids: ["@bob:test"] } },
|
||||
"m.mentions": { user_ids: ["@bob:test"] },
|
||||
"m.new_content": { "m.mentions": { user_ids: ["@bob:test"] } },
|
||||
});
|
||||
});
|
||||
|
||||
it("test prev user mentions", () => {
|
||||
const model = new EditorModel([partsCreator.userPill("Bob", "@bob:test")], partsCreator);
|
||||
const content: IContent = { "m.new_content": {} };
|
||||
const prevContent: IContent = { "org.matrix.msc3952.mentions": { user_ids: ["@bob:test"] } };
|
||||
const prevContent: IContent = { "m.mentions": { user_ids: ["@bob:test"] } };
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": { user_ids: ["@bob:test"] } },
|
||||
"m.mentions": {},
|
||||
"m.new_content": { "m.mentions": { user_ids: ["@bob:test"] } },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -319,19 +319,19 @@ describe("<SendMessageComposer/>", () => {
|
||||
const prevContent: IContent = {};
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": { room: true },
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": { room: true } },
|
||||
"m.mentions": { room: true },
|
||||
"m.new_content": { "m.mentions": { room: true } },
|
||||
});
|
||||
});
|
||||
|
||||
it("test prev room mention", () => {
|
||||
const model = new EditorModel([partsCreator.atRoomPill("@room")], partsCreator);
|
||||
const content: IContent = { "m.new_content": {} };
|
||||
const prevContent: IContent = { "org.matrix.msc3952.mentions": { room: true } };
|
||||
const prevContent: IContent = { "m.mentions": { room: true } };
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": { room: true } },
|
||||
"m.mentions": {},
|
||||
"m.new_content": { "m.mentions": { room: true } },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -340,11 +340,11 @@ describe("<SendMessageComposer/>", () => {
|
||||
const model = new EditorModel([], partsCreator);
|
||||
const content: IContent = { "m.new_content": {} };
|
||||
// @ts-ignore - Purposefully testing invalid data.
|
||||
const prevContent: IContent = { "org.matrix.msc3952.mentions": { user_ids: "@bob:test" } };
|
||||
const prevContent: IContent = { "m.mentions": { user_ids: "@bob:test" } };
|
||||
attachMentions("@alice:test", content, model, undefined, prevContent);
|
||||
expect(content).toEqual({
|
||||
"org.matrix.msc3952.mentions": {},
|
||||
"m.new_content": { "org.matrix.msc3952.mentions": {} },
|
||||
"m.mentions": {},
|
||||
"m.new_content": { "m.mentions": {} },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user