Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28217/head
Michael Telatynski 2023-09-12 08:35:07 +01:00
parent e54dd60381
commit 68e8fa7c8c
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
3 changed files with 209 additions and 167 deletions

View File

@ -32,6 +32,7 @@ import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutS
import { useRoomState } from "../useRoomState";
import { _t } from "../../languageHandler";
import { isManagedHybridWidget } from "../../widgets/ManagedHybrid";
import { IApp } from "../../stores/WidgetStore";
export type PlatformCallType = "element_call" | "jitsi_or_element_call" | "legacy_or_jitsi";
@ -91,12 +92,14 @@ export const useRoomCall = (
if (mayCreateElementCalls && hasJitsiWidget) {
return "jitsi_or_element_call";
}
if (useElementCallExclusively || mayCreateElementCalls) {
// Looks like for Audio this was previously legacy_or_jitsi
if (useElementCallExclusively) {
return "element_call";
}
if (mayEditWidgets) {
return "jitsi_or_element_call";
if (memberCount <= 2) {
return "legacy_or_jitsi";
}
if (mayCreateElementCalls) {
return "element_call";
}
}
return "legacy_or_jitsi";
@ -106,9 +109,17 @@ export const useRoomCall = (
mayCreateElementCalls,
hasJitsiWidget,
useElementCallExclusively,
mayEditWidgets,
memberCount,
]);
const widget = callType === "element_call" ? groupCall?.widget : jitsiWidget ?? managedHybridWidget;
let widget: IApp | undefined;
if (callType === "legacy_or_jitsi") {
widget = jitsiWidget ?? managedHybridWidget;
} else if (callType === "element_call") {
widget = groupCall?.widget;
} else {
widget = groupCall?.widget ?? jitsiWidget;
}
const [canPinWidget, setCanPinWidget] = useState(false);
const [widgetPinned, setWidgetPinned] = useState(false);
@ -180,7 +191,7 @@ export const useRoomCall = (
switch (state) {
case State.NoPermission:
voiceCallDisabledReason = _t("You do not have permission to start voice calls");
videoCallDisabledReason = _t("You do not have permission to start voice calls");
videoCallDisabledReason = _t("You do not have permission to start video calls");
break;
case State.Ongoing:
voiceCallDisabledReason = _t("Ongoing call");

View File

@ -143,8 +143,10 @@
"public": "Public",
"private": "Private",
"options": "Options",
"integration_manager": "Integration manager",
"message_layout": "Message layout",
"modern": "Modern",
"identity_server": "Identity server",
"success": "Success",
"legal": "Legal",
"credits": "Credits",
@ -203,9 +205,7 @@
"support": "Support",
"room_name": "Room name",
"thread": "Thread",
"accessibility": "Accessibility",
"integration_manager": "Integration manager",
"identity_server": "Identity server"
"accessibility": "Accessibility"
},
"Unable to load! Check your network connectivity and try again.": "Unable to load! Check your network connectivity and try again.",
"The file '%(fileName)s' failed to upload.": "The file '%(fileName)s' failed to upload.",
@ -515,17 +515,17 @@
"m.room.canonical_alias": {
"set": "%(senderName)s set the main address for this room to %(address)s.",
"removed": "%(senderName)s removed the main address for this room.",
"changed_alternative": "%(senderName)s changed the alternative addresses for this room.",
"changed_main_and_alternative": "%(senderName)s changed the main and alternative addresses for this room.",
"changed": "%(senderName)s changed the addresses for this room.",
"alt_added": {
"other": "%(senderName)s added the alternative addresses %(addresses)s for this room.",
"one": "%(senderName)s added alternative address %(addresses)s for this room."
},
"alt_removed": {
"other": "%(senderName)s removed the alternative addresses %(addresses)s for this room.",
"one": "%(senderName)s removed alternative address %(addresses)s for this room."
},
"alt_added": {
"other": "%(senderName)s added the alternative addresses %(addresses)s for this room.",
"one": "%(senderName)s added alternative address %(addresses)s for this room."
}
"changed_alternative": "%(senderName)s changed the alternative addresses for this room.",
"changed_main_and_alternative": "%(senderName)s changed the main and alternative addresses for this room.",
"changed": "%(senderName)s changed the addresses for this room."
},
"m.room.third_party_invite": {
"revoked": "%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.",
@ -538,6 +538,10 @@
"world_readable": "%(senderName)s made future room history visible to anyone.",
"unknown": "%(senderName)s made future room history visible to unknown (%(visibility)s)."
},
"m.room.power_levels": {
"changed": "%(senderName)s changed the power level of %(powerLevelDiffText)s.",
"user_from_to": "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s"
},
"m.room.pinned_events": {
"pinned_link": "%(senderName)s pinned <a>a message</a> to this room. See all <b>pinned messages</b>.",
"pinned": "%(senderName)s pinned a message to this room. See all pinned messages.",
@ -552,6 +556,25 @@
"removed": "%(widgetName)s widget removed by %(senderName)s"
},
"io.element.widgets.layout": "%(senderName)s has updated the room layout",
"mjolnir": {
"removed_rule_users": "%(senderName)s removed the rule banning users matching %(glob)s",
"removed_rule_rooms": "%(senderName)s removed the rule banning rooms matching %(glob)s",
"removed_rule_servers": "%(senderName)s removed the rule banning servers matching %(glob)s",
"removed_rule": "%(senderName)s removed a ban rule matching %(glob)s",
"updated_invalid_rule": "%(senderName)s updated an invalid ban rule",
"updated_rule_users": "%(senderName)s updated the rule banning users matching %(glob)s for %(reason)s",
"updated_rule_rooms": "%(senderName)s updated the rule banning rooms matching %(glob)s for %(reason)s",
"updated_rule_servers": "%(senderName)s updated the rule banning servers matching %(glob)s for %(reason)s",
"updated_rule": "%(senderName)s updated a ban rule matching %(glob)s for %(reason)s",
"created_rule_users": "%(senderName)s created a rule banning users matching %(glob)s for %(reason)s",
"created_rule_rooms": "%(senderName)s created a rule banning rooms matching %(glob)s for %(reason)s",
"created_rule_servers": "%(senderName)s created a rule banning servers matching %(glob)s for %(reason)s",
"created_rule": "%(senderName)s created a ban rule matching %(glob)s for %(reason)s",
"changed_rule_users": "%(senderName)s changed a rule that was banning users matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",
"changed_rule_rooms": "%(senderName)s changed a rule that was banning rooms matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",
"changed_rule_servers": "%(senderName)s changed a rule that was banning servers matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",
"changed_rule_glob": "%(senderName)s updated a ban rule that was matching %(oldGlob)s to matching %(newGlob)s for %(reason)s"
},
"m.location": "%(senderName)s has shared their location",
"self_redaction": "Message deleted",
"redaction": "Message deleted by %(name)s",
@ -706,29 +729,6 @@
"other": "%(oneUser)ssent %(count)s hidden messages",
"one": "%(oneUser)ssent a hidden message"
}
},
"mjolnir": {
"removed_rule_users": "%(senderName)s removed the rule banning users matching %(glob)s",
"removed_rule_rooms": "%(senderName)s removed the rule banning rooms matching %(glob)s",
"removed_rule_servers": "%(senderName)s removed the rule banning servers matching %(glob)s",
"removed_rule": "%(senderName)s removed a ban rule matching %(glob)s",
"updated_invalid_rule": "%(senderName)s updated an invalid ban rule",
"updated_rule_users": "%(senderName)s updated the rule banning users matching %(glob)s for %(reason)s",
"updated_rule_rooms": "%(senderName)s updated the rule banning rooms matching %(glob)s for %(reason)s",
"updated_rule_servers": "%(senderName)s updated the rule banning servers matching %(glob)s for %(reason)s",
"updated_rule": "%(senderName)s updated a ban rule matching %(glob)s for %(reason)s",
"created_rule_users": "%(senderName)s created a rule banning users matching %(glob)s for %(reason)s",
"created_rule_rooms": "%(senderName)s created a rule banning rooms matching %(glob)s for %(reason)s",
"created_rule_servers": "%(senderName)s created a rule banning servers matching %(glob)s for %(reason)s",
"created_rule": "%(senderName)s created a ban rule matching %(glob)s for %(reason)s",
"changed_rule_users": "%(senderName)s changed a rule that was banning users matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",
"changed_rule_rooms": "%(senderName)s changed a rule that was banning rooms matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",
"changed_rule_servers": "%(senderName)s changed a rule that was banning servers matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",
"changed_rule_glob": "%(senderName)s updated a ban rule that was matching %(oldGlob)s to matching %(newGlob)s for %(reason)s"
},
"m.room.power_levels": {
"changed": "%(senderName)s changed the power level of %(powerLevelDiffText)s.",
"user_from_to": "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s"
}
},
"Light high contrast": "Light high contrast",
@ -980,6 +980,16 @@
"creating_output": "Creating output…"
},
"That's fine": "That's fine",
"analytics": {
"consent_migration": "You previously consented to share anonymous usage data with us. We're updating how that works.",
"learn_more": "Share anonymous data to help us identify issues. Nothing personal. No third parties. <LearnMoreLink>Learn More</LearnMoreLink>",
"enable_prompt": "Help improve %(analyticsOwner)s",
"privacy_policy": "You can read all our terms <PrivacyPolicyUrl>here</PrivacyPolicyUrl>",
"pseudonymous_usage_data": "Help us identify issues and improve %(analyticsOwner)s by sharing anonymous usage data. To understand how people use multiple devices, we'll generate a random identifier, shared by your devices.",
"bullet_1": "We <Bold>don't</Bold> record or profile any account data",
"bullet_2": "We <Bold>don't</Bold> share information with third parties",
"disable_prompt": "You can turn this off anytime in settings"
},
"You have unverified sessions": "You have unverified sessions",
"Review to ensure your account is safe": "Review to ensure your account is safe",
"Later": "Later",
@ -1061,13 +1071,18 @@
"Could not find user in room": "Could not find user in room",
"Define the power level of a user": "Define the power level of a user",
"Deops user with given id": "Deops user with given id",
"Profile": "Profile",
"Spaces": "Spaces",
"Widgets": "Widgets",
"Rooms": "Rooms",
"Voice & Video": "Voice & Video",
"Encryption": "Encryption",
"labs": {
"group_messaging": "Messaging",
"group_profile": "Profile",
"group_spaces": "Spaces",
"group_widgets": "Widgets",
"group_rooms": "Rooms",
"group_voip": "Voice & Video",
"group_moderation": "Moderation",
"group_themes": "Themes",
"group_encryption": "Encryption",
"group_experimental": "Experimental",
"group_developer": "Developer",
"video_rooms": "Video rooms",
"video_rooms_a_new_way_to_chat": "A new way to chat over voice and video in %(brand)s.",
"video_rooms_always_on_voip_channels": "Video rooms are always-on VoIP channels embedded within a room in %(brand)s.",
@ -1105,18 +1120,7 @@
"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",
"group_widgets": "Widgets",
"group_voip": "Voice & Video",
"group_themes": "Themes",
"group_spaces": "Spaces",
"group_rooms": "Rooms",
"group_profile": "Profile",
"group_moderation": "Moderation",
"group_messaging": "Messaging",
"group_experimental": "Experimental",
"group_encryption": "Encryption",
"group_developer": "Developer"
"new_room_decoration_ui": "New room header & details interface"
},
"Thank you for trying the beta, please go into as much detail as you can so we can improve it.": "Thank you for trying the beta, please go into as much detail as you can so we can improve it.",
"Notification Settings": "Notification Settings",
@ -1125,6 +1129,24 @@
"settings": {
"disable_historical_profile": "Show current profile picture and name for users in message history",
"send_read_receipts": "Send read receipts",
"appearance": {
"font_size": "Font size",
"match_system_theme": "Match system theme",
"custom_font": "Use a system font",
"custom_font_name": "System font name",
"timeline_image_size": "Image size in the timeline",
"layout_irc": "IRC (Experimental)",
"layout_bubbles": "Message bubbles",
"custom_theme_invalid": "Invalid theme schema.",
"custom_theme_error_downloading": "Error downloading theme information.",
"custom_theme_success": "Theme added!",
"use_high_contrast": "Use high contrast",
"custom_theme_url": "Custom theme URL",
"custom_theme_add_button": "Add theme",
"custom_font_description": "Set the name of a font installed on your system & %(brand)s will attempt to use it.",
"heading": "Customise your appearance",
"subheading": "Appearance Settings only affect this %(brand)s session."
},
"emoji_autocomplete": "Enable Emoji suggestions while typing",
"show_stickers_button": "Show stickers button",
"insert_trailing_colon_mentions": "Insert a trailing colon after user mentions at the start of a message",
@ -1173,34 +1195,16 @@
"rule_call": "Call invitation",
"rule_suppress_notices": "Messages sent by bot",
"rule_tombstone": "When rooms are upgraded",
"show_message_desktop_notification": "Show message in desktop notification",
"messages_containing_keywords": "Messages containing keywords",
"error_saving_detail": "An error occurred whilst saving your notification preferences.",
"error_saving": "Error saving notification preferences",
"enable_notifications_device": "Enable notifications for this device",
"enable_notifications_account_detail": "Turn off to disable notifications on all your devices and sessions",
"error_saving_detail": "An error occurred whilst saving your notification preferences.",
"enable_notifications_account": "Enable notifications for this account",
"enable_notifications_account_detail": "Turn off to disable notifications on all your devices and sessions",
"enable_email_notifications": "Enable email notifications for %(email)s",
"enable_notifications_device": "Enable notifications for this device",
"enable_desktop_notifications_session": "Enable desktop notifications for this session",
"show_message_desktop_notification": "Show message in desktop notification",
"enable_audible_notifications_session": "Enable audible notifications for this session"
},
"appearance": {
"font_size": "Font size",
"match_system_theme": "Match system theme",
"custom_font": "Use a system font",
"custom_font_name": "System font name",
"timeline_image_size": "Image size in the timeline",
"layout_irc": "IRC (Experimental)",
"layout_bubbles": "Message bubbles",
"custom_theme_invalid": "Invalid theme schema.",
"custom_theme_error_downloading": "Error downloading theme information.",
"custom_theme_success": "Theme added!",
"use_high_contrast": "Use high contrast",
"custom_theme_url": "Custom theme URL",
"custom_theme_add_button": "Add theme",
"custom_font_description": "Set the name of a font installed on your system & %(brand)s will attempt to use it.",
"heading": "Customise your appearance",
"subheading": "Appearance Settings only affect this %(brand)s session."
}
},
"Your server doesn't support disabling sending read receipts.": "Your server doesn't support disabling sending read receipts.",
@ -1255,12 +1259,12 @@
"description": "Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.",
"submit_debug_logs": "Submit debug logs",
"matrix_security_issue": "To report a Matrix-related security issue, please read the Matrix.org <a>Security Disclosure Policy</a>.",
"create_new_issue": "Please <newIssueLink>create a new issue</newIssueLink> on GitHub so that we can investigate this bug.",
"before_submitting": "Before submitting logs, you must <a>create a GitHub issue</a> to describe your problem.",
"download_logs": "Download logs",
"github_issue": "GitHub issue",
"additional_context": "If there is additional context that would help in analysing the issue, such as what you were doing at the time, room IDs, user IDs, etc., please include those things here.",
"send_logs": "Send logs",
"create_new_issue": "Please <newIssueLink>create a new issue</newIssueLink> on GitHub so that we can investigate this bug."
"send_logs": "Send logs"
},
"Waiting for response from server": "Waiting for response from server",
"My Ban List": "My Ban List",
@ -1303,10 +1307,24 @@
"you_did_it": "You did it!",
"complete_these": "Complete these to get the most out of %(brand)s"
},
"Ongoing call": "Ongoing call",
"You do not have permission to start video calls": "You do not have permission to start video calls",
"There's no one here to call": "There's no one here to call",
"You do not have permission to start voice calls": "You do not have permission to start voice calls",
"You do not have permission to start video calls": "You do not have permission to start video calls",
"Ongoing call": "Ongoing call",
"There's no one here to call": "There's no one here to call",
"chat_effects": {
"confetti_description": "Sends the given message with confetti",
"confetti_message": "sends confetti",
"fireworks_description": "Sends the given message with fireworks",
"fireworks_message": "sends fireworks",
"rainfall_description": "Sends the given message with rainfall",
"rainfall_message": "sends rainfall",
"snowfall_description": "Sends the given message with snowfall",
"snowfall_message": "sends snowfall",
"spaceinvaders_description": "Sends the given message with a space themed effect",
"spaceinvaders_message": "sends space invaders",
"hearts_description": "Sends the given message with hearts",
"hearts_message": "sends hearts"
},
"Server error": "Server error",
"Command error": "Command error",
"Server unavailable, overloaded, or something else went wrong.": "Server unavailable, overloaded, or something else went wrong.",
@ -1324,6 +1342,22 @@
"Hide sidebar": "Hide sidebar",
"Show sidebar": "Show sidebar",
"More": "More",
"encryption": {
"verification": {
"other_party_cancelled": "The other party cancelled the verification.",
"complete_title": "Verified!",
"complete_description": "You've successfully verified this user.",
"sas_no_match": "They don't match",
"sas_match": "They match",
"in_person": "To be secure, do this in person or use a trusted way to communicate.",
"no_support_qr_emoji": "The device you are trying to verify doesn't support scanning a QR code or emoji verification, which is what %(brand)s supports. Try with a different client.",
"qr_prompt": "Scan this unique code",
"sas_prompt": "Compare unique emoji",
"sas_description": "Compare a unique set of emoji if you don't have a camera on either device",
"qr_or_sas": "%(qrCode)s or %(emojiCompare)s",
"qr_or_sas_header": "Verify this device by completing one of the following:"
}
},
"Secure messages with this user are end-to-end encrypted and not able to be read by third parties.": "Secure messages with this user are end-to-end encrypted and not able to be read by third parties.",
"Got It": "Got It",
"Confirm the emoji below are displayed on both devices, in the same order:": "Confirm the emoji below are displayed on both devices, in the same order:",
@ -1364,6 +1398,7 @@
"You can change these anytime.": "You can change these anytime.",
"Creating…": "Creating…",
"Show all rooms": "Show all rooms",
"Spaces": "Spaces",
"Click to copy": "Click to copy",
"Copied!": "Copied!",
"Failed to copy": "Failed to copy",
@ -1436,6 +1471,7 @@
"Cryptography": "Cryptography",
"Session ID:": "Session ID:",
"Session key:": "Session key:",
"Encryption": "Encryption",
"Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.": "Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.",
"Securely cache encrypted messages locally for them to appear in search results, using %(size)s to store messages from %(rooms)s rooms.": {
"other": "Securely cache encrypted messages locally for them to appear in search results, using %(size)s to store messages from %(rooms)s rooms.",
@ -1484,6 +1520,8 @@
"Space members": "Space members",
"Ask to join": "Ask to join",
"People cannot join unless access is granted.": "People cannot join unless access is granted.",
"Make this space visible in the public room directory.": "Make this space visible in the public room directory.",
"Make this room visible in the public room directory.": "Make this room visible in the public room directory.",
"This room is in some spaces you're not an admin of. In those spaces, the old room will still be shown, but people will be prompted to join the new one.": "This room is in some spaces you're not an admin of. In those spaces, the old room will still be shown, but people will be prompted to join the new one.",
"This upgrade will allow members of selected spaces access to this room without an invite.": "This upgrade will allow members of selected spaces access to this room without an invite.",
"Mark all as read": "Mark all as read",
@ -1500,6 +1538,7 @@
"There was an error loading your notification settings.": "There was an error loading your notification settings.",
"Failed to save your profile": "Failed to save your profile",
"The operation could not be completed": "The operation could not be completed",
"Profile": "Profile",
"Display Name": "Display Name",
"Profile picture": "Profile picture",
"Delete Backup": "Delete Backup",
@ -1675,6 +1714,7 @@
"No Audio Outputs detected": "No Audio Outputs detected",
"No Microphones detected": "No Microphones detected",
"No Webcams detected": "No Webcams detected",
"Voice & Video": "Voice & Video",
"Voice settings": "Voice settings",
"Automatically adjust the microphone volume": "Automatically adjust the microphone volume",
"Video settings": "Video settings",
@ -2092,6 +2132,7 @@
"Explore public rooms": "Explore public rooms",
"Add room": "Add room",
"Saved Items": "Saved Items",
"Rooms": "Rooms",
"Low priority": "Low priority",
"Historical": "Historical",
"Suggested Rooms": "Suggested Rooms",
@ -2123,6 +2164,8 @@
"Forget this space": "Forget this space",
"Forget this room": "Forget this room",
"Re-join": "Re-join",
"You have been denied access": "You have been denied access",
"As you have been denied access, you cannot rejoin unless you are invited by the admin or moderator of the group.": "As you have been denied access, you cannot rejoin unless you are invited by the admin or moderator of the group.",
"You were banned from %(roomName)s by %(memberName)s": "You were banned from %(roomName)s by %(memberName)s",
"You were banned by %(memberName)s": "You were banned by %(memberName)s",
"Something went wrong with your invite to %(roomName)s": "Something went wrong with your invite to %(roomName)s",
@ -2291,6 +2334,7 @@
"Unpin this widget to view it in this panel": "Unpin this widget to view it in this panel",
"Close this widget to view it in this panel": "Close this widget to view it in this panel",
"Set my room layout for everyone": "Set my room layout for everyone",
"Widgets": "Widgets",
"Edit widgets, bridges & bots": "Edit widgets, bridges & bots",
"Add widgets, bridges & bots": "Add widgets, bridges & bots",
"Not encrypted": "Not encrypted",
@ -2528,6 +2572,19 @@
"My live location": "My live location",
"Drop a Pin": "Drop a Pin",
"What location type do you want to share?": "What location type do you want to share?",
"emoji": {
"category_frequently_used": "Frequently Used",
"category_smileys_people": "Smileys & People",
"category_animals_nature": "Animals & Nature",
"category_food_drink": "Food & Drink",
"category_activities": "Activities",
"category_travel_places": "Travel & Places",
"category_objects": "Objects",
"category_symbols": "Symbols",
"category_flags": "Flags",
"categories": "Categories",
"quick_reactions": "Quick Reactions"
},
"Cancel search": "Cancel search",
"Any of the following data may be shared:": "Any of the following data may be shared:",
"Your display name": "Your display name",
@ -2725,7 +2782,6 @@
"Anyone will be able to find and join this room.": "Anyone will be able to find and join this room.",
"Only people invited will be able to find and join this room.": "Only people invited will be able to find and join this room.",
"Anyone can request to join, but admins or moderators need to grant access. You can change this later.": "Anyone can request to join, but admins or moderators need to grant access. You can change this later.",
"Make this room visible in the public room directory.": "Make this room visible in the public room directory.",
"You can't disable this later. The room will be encrypted but the embedded call will not.": "You can't disable this later. The room will be encrypted but the embedded call will not.",
"You can't disable this later. Bridges & most bots won't work yet.": "You can't disable this later. Bridges & most bots won't work yet.",
"Your server requires encryption to be enabled in private rooms.": "Your server requires encryption to be enabled in private rooms.",
@ -3695,61 +3751,5 @@
"Activate selected button": "Activate selected button",
"New line": "New line",
"Force complete": "Force complete",
"Search (must be enabled)": "Search (must be enabled)",
"encryption": {
"verification": {
"other_party_cancelled": "The other party cancelled the verification.",
"complete_title": "Verified!",
"complete_description": "You've successfully verified this user.",
"sas_no_match": "They don't match",
"sas_match": "They match",
"in_person": "To be secure, do this in person or use a trusted way to communicate.",
"no_support_qr_emoji": "The device you are trying to verify doesn't support scanning a QR code or emoji verification, which is what %(brand)s supports. Try with a different client.",
"qr_prompt": "Scan this unique code",
"sas_prompt": "Compare unique emoji",
"sas_description": "Compare a unique set of emoji if you don't have a camera on either device",
"qr_or_sas": "%(qrCode)s or %(emojiCompare)s",
"qr_or_sas_header": "Verify this device by completing one of the following:"
}
},
"emoji": {
"category_frequently_used": "Frequently Used",
"category_smileys_people": "Smileys & People",
"category_animals_nature": "Animals & Nature",
"category_food_drink": "Food & Drink",
"category_activities": "Activities",
"category_travel_places": "Travel & Places",
"category_objects": "Objects",
"category_symbols": "Symbols",
"category_flags": "Flags",
"categories": "Categories",
"quick_reactions": "Quick Reactions"
},
"chat_effects": {
"confetti_description": "Sends the given message with confetti",
"confetti_message": "sends confetti",
"fireworks_description": "Sends the given message with fireworks",
"fireworks_message": "sends fireworks",
"rainfall_description": "Sends the given message with rainfall",
"rainfall_message": "sends rainfall",
"snowfall_description": "Sends the given message with snowfall",
"snowfall_message": "sends snowfall",
"spaceinvaders_description": "Sends the given message with a space themed effect",
"spaceinvaders_message": "sends space invaders",
"hearts_description": "Sends the given message with hearts",
"hearts_message": "sends hearts"
},
"analytics": {
"consent_migration": "You previously consented to share anonymous usage data with us. We're updating how that works.",
"learn_more": "Share anonymous data to help us identify issues. Nothing personal. No third parties. <LearnMoreLink>Learn More</LearnMoreLink>",
"enable_prompt": "Help improve %(analyticsOwner)s",
"privacy_policy": "You can read all our terms <PrivacyPolicyUrl>here</PrivacyPolicyUrl>",
"pseudonymous_usage_data": "Help us identify issues and improve %(analyticsOwner)s by sharing anonymous usage data. To understand how people use multiple devices, we'll generate a random identifier, shared by your devices.",
"bullet_1": "We <Bold>don't</Bold> record or profile any account data",
"bullet_2": "We <Bold>don't</Bold> share information with third parties",
"disable_prompt": "You can turn this off anytime in settings"
},
"You have been denied access": "You have been denied access",
"Make this space visible in the public room directory.": "Make this space visible in the public room directory.",
"As you have been denied access, you cannot rejoin unless you are invited by the admin or moderator of the group.": "As you have been denied access, you cannot rejoin unless you are invited by the admin or moderator of the group."
}
"Search (must be enabled)": "Search (must be enabled)"
}

View File

@ -15,12 +15,19 @@ limitations under the License.
*/
import React from "react";
import userEvent from "@testing-library/user-event";
import { CallType, MatrixCall } from "matrix-js-sdk/src/webrtc/call";
import { EventType, JoinRule, MatrixClient, MatrixEvent, PendingEventOrdering, Room } from "matrix-js-sdk/src/matrix";
import { getAllByLabelText, getByLabelText, getByText, render, screen, waitFor } from "@testing-library/react";
import {
fireEvent,
getAllByLabelText,
getByLabelText,
getByText,
render,
screen,
waitFor,
} from "@testing-library/react";
import { mkEvent, stubClient, withClientContextRenderOptions } from "../../../test-utils";
import { filterConsole, mkEvent, stubClient, withClientContextRenderOptions } from "../../../test-utils";
import RoomHeader from "../../../../src/components/views/rooms/RoomHeader";
import DMRoomMap from "../../../../src/utils/DMRoomMap";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
@ -33,10 +40,13 @@ import dispatcher from "../../../../src/dispatcher/dispatcher";
import { CallStore } from "../../../../src/stores/CallStore";
import { Call, ElementCall } from "../../../../src/models/Call";
import * as ShieldUtils from "../../../../src/utils/ShieldUtils";
import { Container, WidgetLayoutStore } from "../../../../src/stores/widgets/WidgetLayoutStore";
jest.mock("../../../../src/utils/ShieldUtils");
describe("RoomHeader", () => {
filterConsole("[getType] Room !1:example.org does not have an m.room.create event");
let room: Room;
const ROOM_ID = "!1:example.org";
@ -94,7 +104,7 @@ describe("RoomHeader", () => {
withClientContextRenderOptions(MatrixClientPeg.get()!),
);
await userEvent.click(getByText(container, ROOM_ID));
fireEvent.click(getByText(container, ROOM_ID));
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.RoomSummary });
});
@ -184,7 +194,7 @@ describe("RoomHeader", () => {
const facePile = getByLabelText(container, "4 members");
expect(facePile).toHaveTextContent("4");
await userEvent.click(facePile);
fireEvent.click(facePile);
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.RoomMemberList });
});
@ -195,7 +205,7 @@ describe("RoomHeader", () => {
withClientContextRenderOptions(MatrixClientPeg.get()!),
);
await userEvent.click(getByLabelText(container, "Threads"));
fireEvent.click(getByLabelText(container, "Threads"));
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.ThreadPanel });
});
@ -205,7 +215,7 @@ describe("RoomHeader", () => {
withClientContextRenderOptions(MatrixClientPeg.get()!),
);
await userEvent.click(getByLabelText(container, "Notifications"));
fireEvent.click(getByLabelText(container, "Notifications"));
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.NotificationPanel });
});
@ -234,10 +244,10 @@ describe("RoomHeader", () => {
const placeCallSpy = jest.spyOn(LegacyCallHandler.instance, "placeCall");
await userEvent.click(voiceButton);
fireEvent.click(voiceButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Voice);
await userEvent.click(videoButton);
fireEvent.click(videoButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Video);
});
@ -275,8 +285,12 @@ describe("RoomHeader", () => {
<RoomHeader room={room} />,
withClientContextRenderOptions(MatrixClientPeg.get()!),
);
expect(getByLabelText(container, "You do not have permission to start voice calls")).toBeDisabled();
expect(getByLabelText(container, "You do not have permission to start video calls")).toBeDisabled();
expect(
getByLabelText(container, "You do not have permission to start voice calls", { selector: "button" }),
).toBeDisabled();
expect(
getByLabelText(container, "You do not have permission to start video calls", { selector: "button" }),
).toBeDisabled();
});
});
@ -286,6 +300,7 @@ describe("RoomHeader", () => {
});
it("renders only the video call element", async () => {
mockRoomMembers(room, 3);
jest.spyOn(SdkConfig, "get").mockReturnValue({ use_exclusively: true });
// allow element calls
jest.spyOn(room.currentState, "mayClientSendStateEvent").mockReturnValue(true);
@ -302,17 +317,18 @@ describe("RoomHeader", () => {
const dispatcherSpy = jest.spyOn(dispatcher, "dispatch");
await userEvent.click(getByLabelText(container, "Video call"));
fireEvent.click(getByLabelText(container, "Video call"));
expect(dispatcherSpy).toHaveBeenCalledWith(expect.objectContaining({ view_call: true }));
});
it("can call if there's an ongoing call", () => {
it("can't call if there's an ongoing (pinned) call", () => {
jest.spyOn(SdkConfig, "get").mockReturnValue({ use_exclusively: true });
// allow element calls
jest.spyOn(room.currentState, "mayClientSendStateEvent").mockReturnValue(true);
jest.spyOn(WidgetLayoutStore.instance, "isInContainer").mockReturnValue(true);
jest.spyOn(CallStore.instance, "getCall").mockReturnValue({} as Call);
jest.spyOn(CallStore.instance, "getCall").mockReturnValue({ widget: {} } as Call);
const { container } = render(
<RoomHeader room={room} />,
@ -321,6 +337,25 @@ describe("RoomHeader", () => {
expect(getByLabelText(container, "Ongoing call")).toBeDisabled();
});
it("clicking on ongoing (unpinned) call re-pins it", () => {
jest.spyOn(SdkConfig, "get").mockReturnValue({ use_exclusively: true });
// allow element calls
jest.spyOn(room.currentState, "mayClientSendStateEvent").mockReturnValue(true);
jest.spyOn(WidgetLayoutStore.instance, "isInContainer").mockReturnValue(false);
const spy = jest.spyOn(WidgetLayoutStore.instance, "moveToContainer");
const widget = {};
jest.spyOn(CallStore.instance, "getCall").mockReturnValue({ widget } as Call);
const { container } = render(
<RoomHeader room={room} />,
withClientContextRenderOptions(MatrixClientPeg.get()!),
);
expect(getByLabelText(container, "Video call")).not.toBeDisabled();
fireEvent.click(getByLabelText(container, "Video call"));
expect(spy).toHaveBeenCalledWith(room, widget, Container.Top);
});
it("disables calling if there's a jitsi call", () => {
mockRoomMembers(room, 2);
jest.spyOn(LegacyCallHandler.instance, "getCallForRoom").mockReturnValue(
@ -360,10 +395,10 @@ describe("RoomHeader", () => {
expect(videoButton).not.toBeDisabled();
const placeCallSpy = jest.spyOn(LegacyCallHandler.instance, "placeCall");
await userEvent.click(voiceButton);
fireEvent.click(voiceButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Voice);
await userEvent.click(videoButton);
fireEvent.click(videoButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Video);
});
@ -386,10 +421,10 @@ describe("RoomHeader", () => {
expect(videoButton).not.toBeDisabled();
const placeCallSpy = jest.spyOn(LegacyCallHandler.instance, "placeCall");
await userEvent.click(voiceButton);
fireEvent.click(voiceButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Voice);
await userEvent.click(videoButton);
fireEvent.click(videoButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Video);
});
@ -412,12 +447,8 @@ describe("RoomHeader", () => {
expect(voiceButton).not.toBeDisabled();
expect(videoButton).not.toBeDisabled();
const placeCallSpy = jest.spyOn(LegacyCallHandler.instance, "placeCall");
await userEvent.click(voiceButton);
expect(placeCallSpy).toHaveBeenLastCalledWith(room.roomId, CallType.Voice);
const dispatcherSpy = jest.spyOn(dispatcher, "dispatch");
await userEvent.click(videoButton);
fireEvent.click(videoButton);
expect(dispatcherSpy).toHaveBeenCalledWith(expect.objectContaining({ view_call: true }));
});
});