Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Default intentional mentions (#11602)
Browse files Browse the repository at this point in the history
* Default intentional mentions

* wait for autocomplete to settle before submitting edit

* lint

* Update strings

---------

Co-authored-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Johennes and Kerry Archibald authored Sep 14, 2023
1 parent 237038a commit 3608d52
Show file tree
Hide file tree
Showing 9 changed files with 266 additions and 333 deletions.
7 changes: 3 additions & 4 deletions src/components/views/rooms/SendMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ export function attachMentions(
replyToEvent: MatrixEvent | undefined,
editedContent: IContent | null = null,
): void {
// If this feature is disabled, do nothing.
if (!SettingsStore.getValue("feature_intentional_mentions")) {
return;
}
// We always attach the mentions even if the home server doesn't yet support
// intentional mentions. This is safe because m.mentions is an additive change
// that should simply be ignored by incapable home servers.

// The mentions property *always* gets included to disable legacy push rules.
const mentions: IMentions = (content["m.mentions"] = {});
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,6 @@
"voice_broadcast": "Voice broadcast",
"rust_crypto": "Rust cryptography implementation",
"hidebold": "Hide notification dot (only display counters badges)",
"intentional_mentions": "Enable intentional mentions",
"ask_to_join": "Enable ask to join",
"new_room_decoration_ui": "New room header & details interface",
"beta_feature": "This is a beta feature",
Expand Down
14 changes: 0 additions & 14 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -531,20 +531,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
labsGroup: LabGroup.Rooms,
default: false,
},
// MSC3952 intentional mentions support.
"feature_intentional_mentions": {
isFeature: true,
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
displayName: _td("labs|intentional_mentions"),
labsGroup: LabGroup.Rooms,
default: false,
controller: new ServerSupportUnstableFeatureController(
"feature_intentional_mentions",
defaultWatchManager,
[["org.matrix.msc3952_intentional_mentions"]],
"v1.7",
),
},
"feature_ask_to_join": {
default: false,
displayName: _td("labs|ask_to_join"),
Expand Down
5 changes: 0 additions & 5 deletions test/ContentMessages-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import ContentMessages, { UploadCanceledError, uploadFile } from "../src/Content
import { doMaybeLocalRoomAction } from "../src/utils/local-room";
import { createTestClient, mkEvent } from "./test-utils";
import { BlurhashEncoder } from "../src/BlurhashEncoder";
import SettingsStore from "../src/settings/SettingsStore";

jest.mock("matrix-encrypt-attachment", () => ({ encryptAttachment: jest.fn().mockResolvedValue({}) }));

Expand Down Expand Up @@ -278,10 +277,6 @@ describe("ContentMessages", () => {
});

it("properly handles replies", async () => {
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(settingName) => settingName === "feature_intentional_mentions",
);

mocked(client.uploadContent).mockResolvedValue({ content_uri: "mxc://server/file" });
const file = new File([], "fileName", { type: "image/jpeg" });
const replyToEvent = mkEvent({
Expand Down
1 change: 1 addition & 0 deletions test/components/structures/ThreadView-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe("ThreadView", () => {
"rel_type": RelationType.Thread,
},
"msgtype": MsgType.Text,
"m.mentions": {},
};
}

Expand Down
Loading

0 comments on commit 3608d52

Please sign in to comment.