Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/web/playwright/e2e/crypto/history-sharing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { createRoom, sendMessageInCurrentRoom } from "./utils";

test.use({
displayName: "Alice",
labsFlags: ["feature_share_history_on_invite"],
});

/** Tests for MSC4268: encrypted history sharing */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ export default function RoomHeader({
const roomName = useRoomName(room);
const joinRule = useRoomState(room, (state) => state.getJoinRule());
const historyVisibility = useRoomState(room, (state) => state.getHistoryVisibility());
const historySharingEnabled = useFeatureEnabled("feature_share_history_on_invite");
const dmMember = useDmMember(room);
const isDirectMessage = !!dmMember;
const isRoomEncrypted = useIsEncrypted(client, room);
Expand Down Expand Up @@ -532,7 +531,7 @@ export default function RoomHeader({
</Tooltip>
)}

{isRoomEncrypted && historySharingEnabled && historyVisibilityIcon(historyVisibility)}
{isRoomEncrypted && historyVisibilityIcon(historyVisibility)}
</Text>
</Box>
</button>
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1577,9 +1577,6 @@
"report_to_moderators": "Report to moderators",
"report_to_moderators_description": "In rooms that support moderation, the “Report” button will let you report abuse to room moderators.",
"room_list_sections": "Room list sections",
"share_history_on_invite": "Share encrypted history with new members",
"share_history_on_invite_description": "When inviting a user to an encrypted room that has history visibility set to \"shared\", share encrypted history with that user, and accept encrypted history when you are invited to such a room.",
"share_history_on_invite_warning": "This feature is EXPERIMENTAL and not all security precautions are implemented. Do not enable on production accounts.",
"sliding_sync": "Sliding Sync mode",
"sliding_sync_description": "Under active development, cannot be disabled. Currently, not compatible with Element Call.",
"sliding_sync_disabled_notice": "Sign in again to disable",
Expand Down
24 changes: 0 additions & 24 deletions apps/web/src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export interface Settings {
"feature_mjolnir": IFeature;
"feature_custom_themes": IFeature;
"feature_exclude_insecure_devices": IFeature;
"feature_share_history_on_invite": IFeature;
"feature_html_topic": IFeature;
"feature_bridge_state": IFeature;
"feature_jump_to_date": IFeature;
Expand Down Expand Up @@ -522,29 +521,6 @@ export const SETTINGS: Settings = {
supportedLevelsAreOrdered: true,
default: false,
},
"feature_share_history_on_invite": {
Comment thread
richvdh marked this conversation as resolved.
isFeature: true,
labsGroup: LabGroup.Encryption,
displayName: _td("labs|share_history_on_invite"),
description: () => (
<>
{_t("labs|share_history_on_invite_description")}
<div className="mx_SettingsFlag_microcopy">
{_t(
"settings|warning",
{},
{
w: (sub) => <span className="mx_SettingsTab_microcopy_warning">{sub}</span>,
description: _t("labs|share_history_on_invite_warning"),
},
)}
</div>
</>
),
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG_PRIORITISED,
supportedLevelsAreOrdered: true,
default: false,
},
// Defaulted to true Feb 26, intention is to remove entirely, all being well,
// as this fixes bugs where display name / avatar are missing and also makes
// Element Web consistent with Element X.
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/stores/RoomViewStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,9 @@ export class RoomViewStore extends EventEmitter {

const joinOpts: IJoinRoomOpts = {
viaServers,
acceptSharedHistory: true,
...(payload.opts ?? {}),
};
if (SettingsStore.getValue("feature_share_history_on_invite")) {
joinOpts.acceptSharedHistory = true;
}
try {
const cli = MatrixClientPeg.safeGet();
await retry<Room, MatrixError>(
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/utils/MultiInviter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ export default class MultiInviter {
}
}

const opts: InviteOpts = {};
const opts: InviteOpts = {
shareEncryptedHistory: true,
};
if (this.reason !== undefined) opts.reason = this.reason;
if (SettingsStore.getValue("feature_share_history_on_invite")) opts.shareEncryptedHistory = true;

return this.matrixClient.invite(roomId, addr, opts);
} else {
throw new Error("Unsupported address");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,25 +723,9 @@
],
{ addToState: true },
);
let featureEnabled = true;
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(flag) => flag === "feature_share_history_on_invite" && featureEnabled,
);

render(<RoomHeader room={room} />, getWrapper());
await waitFor(() => getByLabelText(document.body, "New members see history"));

// Disable the labs flag and check the icon disappears
featureEnabled = false;
act(() =>
defaultWatchManager.notifyUpdate(
"feature_share_history_on_invite",
null,
SettingLevel.DEVICE,
featureEnabled,
),
);
expect(queryByLabelText(document.body, "New members see history")).not.toBeInTheDocument();
});

it("shows a user icon if the room is encrypted and has world readable history", async () => {
Expand All @@ -758,10 +742,6 @@
],
{ addToState: true },
);
const featureEnabled = true;
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(flag) => flag === "feature_share_history_on_invite" && featureEnabled,
);

render(<RoomHeader room={room} />, getWrapper());
await waitFor(() => getByLabelText(document.body, "Anyone can see history"));
Expand Down Expand Up @@ -819,7 +799,7 @@
});
const { asFragment } = render(<RoomHeader room={room} />, getWrapper());

expect(asFragment()).toMatchSnapshot();

Check failure on line 802 in apps/web/test/unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx

View workflow job for this annotation

GitHub Actions / Jest (Element Web) (2)

RoomHeader › dm › does not show the face pile for DMs

expect(received).toMatchSnapshot() Snapshot name: `RoomHeader dm does not show the face pile for DMs 1` - Snapshot - 4 + Received + 4 @@ -51,11 +51,11 @@ <div class="_indicator-icon_147l5_17" style="--cpd-icon-button-size: 100%;" > <svg - aria-labelledby="_r_13s_" + aria-labelledby="_r_14k_" fill="currentColor" height="1em" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg" @@ -78,11 +78,11 @@ <div class="_indicator-icon_147l5_17" style="--cpd-icon-button-size: 100%;" > <svg - aria-labelledby="_r_141_" + aria-labelledby="_r_14p_" fill="currentColor" height="1em" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg" @@ -93,11 +93,11 @@ </svg> </div> </button> <button aria-label="Threads" - aria-labelledby="_r_146_" + aria-labelledby="_r_14u_" class="_icon-button_1215g_8" data-kind="primary" role="button" style="--cpd-icon-button-size: 32px;" tabindex="0" @@ -120,11 +120,11 @@ </svg> </div> </button> <button aria-label="Room info" - aria-labelledby="_r_14b_" + aria-labelledby="_r_153_" class="_icon-button_1215g_8" data-kind="primary" role="button" style="--cpd-icon-button-size: 32px;" tabindex="0" at Object.toMatchSnapshot (test/unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx:802:34)
});

it("updates the icon when the encryption status changes", async () => {
Expand Down
6 changes: 1 addition & 5 deletions apps/web/test/unit-tests/stores/RoomViewStore-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
dis.dispatch({ action: Action.ViewRoom, room_id: roomId });
dis.dispatch({ action: Action.JoinRoom });
await untilDispatch(Action.JoinRoomReady, dis);
expect(mockClient.joinRoom).toHaveBeenCalledWith(roomId, { viaServers: [] });

Check failure on line 216 in apps/web/test/unit-tests/stores/RoomViewStore-test.ts

View workflow job for this annotation

GitHub Actions / Jest (Element Web) (2)

RoomViewStore › can be used to view a room by ID and join

expect(jest.fn()).toHaveBeenCalledWith(...expected) - Expected + Received "!randomcharacters:aser.ver", Object { + "acceptSharedHistory": true, "viaServers": Array [], }, Number of calls: 1 at Object.toHaveBeenCalledWith (test/unit-tests/stores/RoomViewStore-test.ts:216:37)
expect(roomViewStore.isJoining()).toBe(true);
});

Expand All @@ -229,14 +229,14 @@
}),
);
await untilDispatch(Action.JoinRoomReady, dis);
expect(mockClient.joinRoom).toHaveBeenCalledWith(alias, { viaServers: ["server1"] });

Check failure on line 232 in apps/web/test/unit-tests/stores/RoomViewStore-test.ts

View workflow job for this annotation

GitHub Actions / Jest (Element Web) (2)

RoomViewStore › can be used to view a room by alias with auto_join

expect(jest.fn()).toHaveBeenCalledWith(...expected) - Expected + Received "#alias12345:server", Object { + "acceptSharedHistory": true, "viaServers": Array [ "server1", ], }, Number of calls: 1 at Object.toHaveBeenCalledWith (test/unit-tests/stores/RoomViewStore-test.ts:232:37)
expect(roomViewStore.isJoining()).toBe(true);
});

it("can auto-join a room", async () => {
dis.dispatch({ action: Action.ViewRoom, room_id: roomId, auto_join: true });
await untilDispatch(Action.JoinRoomReady, dis);
expect(mockClient.joinRoom).toHaveBeenCalledWith(roomId, { viaServers: [] });

Check failure on line 239 in apps/web/test/unit-tests/stores/RoomViewStore-test.ts

View workflow job for this annotation

GitHub Actions / Jest (Element Web) (2)

RoomViewStore › can auto-join a room

expect(jest.fn()).toHaveBeenCalledWith(...expected) - Expected + Received "!randomcharacters:aser.ver", Object { + "acceptSharedHistory": true, "viaServers": Array [], }, Number of calls: 1 at Object.toHaveBeenCalledWith (test/unit-tests/stores/RoomViewStore-test.ts:239:37)
expect(roomViewStore.isJoining()).toBe(true);
});

Expand Down Expand Up @@ -282,7 +282,7 @@
await untilDispatch(Action.JoinRoomReady, dis);

expect(roomViewStore.isJoining()).toBeTruthy();
expect(mockClient.joinRoom).toHaveBeenCalledWith(alias, { viaServers: [] });

Check failure on line 285 in apps/web/test/unit-tests/stores/RoomViewStore-test.ts

View workflow job for this annotation

GitHub Actions / Jest (Element Web) (2)

RoomViewStore › can be used to view a room by alias and join

expect(jest.fn()).toHaveBeenCalledWith(...expected) - Expected + Received "#somealias2:aser.ver", Object { + "acceptSharedHistory": true, "viaServers": Array [], }, Number of calls: 1 at Object.toHaveBeenCalledWith (test/unit-tests/stores/RoomViewStore-test.ts:285:37)
});

it("emits ViewRoomError if the alias lookup fails", async () => {
Expand Down Expand Up @@ -548,11 +548,7 @@
expect(mocked(dis.dispatch).mock.calls[2][0]).toEqual({ action: "prompt_ask_to_join" });
});

it("sets 'acceptSharedHistory' if that option is enabled", async () => {
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName, roomId, value) => {
return settingName === "feature_share_history_on_invite"; // this is enabled, everything else is disabled.
});

it("sets 'acceptSharedHistory'", async () => {
dis.dispatch({ action: Action.ViewRoom, room_id: roomId });
dis.dispatch({ action: Action.JoinRoom });
await untilDispatch(Action.JoinRoomReady, dis);
Expand Down
7 changes: 1 addition & 6 deletions apps/web/test/unit-tests/utils/MultiInviter-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,7 @@ describe("MultiInviter", () => {
);
});

it("should set shareEncryptedHistory if that setting is enabled", async () => {
mocked(SettingsStore.getValue).mockImplementation((settingName, roomId, value) => {
return settingName === "feature_share_history_on_invite"; // this is enabled, everything else is disabled.
});
await inviter.invite([MXID1]);

it("should set shareEncryptedHistory", async () => {
expect(client.invite).toHaveBeenCalledTimes(1);
expect(client.invite).toHaveBeenNthCalledWith(1, ROOMID, MXID1, { shareEncryptedHistory: true });
});
Expand Down
Loading