diff --git a/playwright/e2e/invite/invite-dialog.spec.ts b/playwright/e2e/invite/invite-dialog.spec.ts index cdf877f95e5..49139af3346 100644 --- a/playwright/e2e/invite/invite-dialog.spec.ts +++ b/playwright/e2e/invite/invite-dialog.spec.ts @@ -113,6 +113,8 @@ test.describe("Invite dialog", function () { "rgba(0, 0, 0, 0)", ); + await expect(page.locator(".mx_RoomView")).toMatchScreenshot("send_your_first_message_view.png"); + // Send a message to invite the bots const composer = app.getComposer().locator("[contenteditable]"); await composer.fill("Hello}"); diff --git a/playwright/snapshots/invite/invite-dialog.spec.ts/send-your-first-message-view-linux.png b/playwright/snapshots/invite/invite-dialog.spec.ts/send-your-first-message-view-linux.png new file mode 100644 index 00000000000..ec2d8d5443e Binary files /dev/null and b/playwright/snapshots/invite/invite-dialog.spec.ts/send-your-first-message-view-linux.png differ diff --git a/src/components/views/rooms/RoomHeader/RoomHeader.tsx b/src/components/views/rooms/RoomHeader/RoomHeader.tsx index 7e88a31eac0..5a8bd77cf85 100644 --- a/src/components/views/rooms/RoomHeader/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader/RoomHeader.tsx @@ -54,13 +54,14 @@ import { RoomSettingsTab } from "../../dialogs/RoomSettingsDialog.tsx"; import { useScopedRoomContext } from "../../../../contexts/ScopedRoomContext.tsx"; import { ToggleableIcon } from "./toggle/ToggleableIcon.tsx"; import { CurrentRightPanelPhaseContextProvider } from "../../../../contexts/CurrentRightPanelPhaseContext.tsx"; +import { type LocalRoom } from "../../../../models/LocalRoom.ts"; export default function RoomHeader({ room, additionalButtons, oobData, }: { - room: Room; + room: Room | LocalRoom; additionalButtons?: ViewRoomOpts["buttons"]; oobData?: IOOBData; }): JSX.Element { diff --git a/src/hooks/room/useRoomCall.tsx b/src/hooks/room/useRoomCall.tsx index 39e77256594..92f68d02f83 100644 --- a/src/hooks/room/useRoomCall.tsx +++ b/src/hooks/room/useRoomCall.tsx @@ -36,6 +36,7 @@ import { isVideoRoom } from "../../utils/video-rooms"; import { UIFeature } from "../../settings/UIFeature"; import { type InteractionName } from "../../PosthogTrackers"; import { ElementCallMemberEventType } from "../../call-types"; +import { LocalRoom, LocalRoomState } from "../../models/LocalRoom"; export enum PlatformCallType { ElementCall, @@ -83,7 +84,7 @@ const enum State { * @returns the call button attributes for the given room */ export const useRoomCall = ( - room: Room, + room: Room | LocalRoom, ): { voiceCallDisabledReason: string | null; voiceCallClick(evt: React.MouseEvent | undefined, selectedType: PlatformCallType): void; @@ -274,11 +275,16 @@ export const useRoomCall = ( }); }, [isViewingCall, room.roomId]); + const roomDoesNotExist = room instanceof LocalRoom && room.state !== LocalRoomState.CREATED; + // We hide the voice call button if it'd have the same effect as the video call button let hideVoiceCallButton = isManagedHybridWidgetEnabled(room) || !callOptions.includes(PlatformCallType.LegacyCall); let hideVideoCallButton = false; - // We hide both buttons if they require widgets but widgets are disabled, or if the Voip feature is disabled. - if ((memberCount > 2 && !widgetsFeatureEnabled) || !voipFeatureEnabled) { + // We hide both buttons if: + // - they require widgets but widgets are disabled + // - if the Voip feature is disabled. + // - The room is not created yet (rendering "send first message view") + if ((memberCount > 2 && !widgetsFeatureEnabled) || !voipFeatureEnabled || roomDoesNotExist) { hideVoiceCallButton = true; hideVideoCallButton = true; } diff --git a/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap b/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap index c36a22d0664..350f3d9b60e 100644 --- a/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap +++ b/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`RoomView for a local room in state CREATING should match the snapshot 1`] = `