fix(app): do not crash when the browser translates the page (#2624)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-09 01:24:14 +02:00
1 parent 044a2c101d
commit d729f641ff
83 files changed
+3774 -1080

No files matched your search

@@ -182,7 +182,9 @@ export const ReplyBar = observer(function ReplyBar({
data-flx="channel.reply-bar.switch.toggle-mention"
>
<AtIcon weight="bold" className={styles.mentionIcon} data-flx="channel.reply-bar.mention-icon" />
{shouldMention ? i18n._(ON_DESCRIPTOR) : i18n._(OFF_DESCRIPTOR)}
<flx-i18n data-flx="channel.channel-reply-bar.reply-bar.flx-i18n">
{shouldMention ? i18n._(ON_DESCRIPTOR) : i18n._(OFF_DESCRIPTOR)}
</flx-i18n>
</button>
</FocusRing>
</Tooltip>
@@ -223,8 +223,7 @@ export const ReplyPreview = observer(
data-guild-id={resolvedGuildId}
data-flx="channel.reply-preview.replied-username"
>
{message.mentions.some((mention) => mention.id === referencedMessage.author.id) && '@'}
{NicknameUtils.getNickname(referencedMessage.author, resolvedGuildId)}
{`${message.mentions.some((mention) => mention.id === referencedMessage.author.id) ? '@' : ''}${NicknameUtils.getNickname(referencedMessage.author, resolvedGuildId)}`}
</span>
</PreloadableUserPopout>
<FocusRing offset={-2} data-flx="channel.reply-preview.focus-ring">
@@ -68,6 +68,7 @@ export const DEFAULT_DEVELOPER_OPTIONS = {
mockTitlebarPlatformOverride: 'auto',
mockAttachmentStates: {},
noOpInAppReports: false,
disableTranslationDomGuard: false,
} satisfies DeveloperOptionsState;
const PREMIUM_SCENARIO_OVERRIDE_KEYS = new Set<keyof DeveloperOptionsState>([
'premiumTypeOverride',
@@ -81,10 +81,11 @@ export function CsvAttachmentTablePanel({
data-flx="channel.embeds.attachments.csv-attachment-table-panel.warning-circle-icon"
/>
<span data-flx="channel.embeds.attachments.csv-attachment-table-panel.span">
{previewError?.type === 'size'
? i18n._(FILE_IS_TOO_LARGE_FOR_INLINE_PREVIEW_LIMIT_DESCRIPTOR, {previewLimitKb: PREVIEW_LIMIT_KB})
: i18n._(UNABLE_TO_LOAD_PREVIEW_DESCRIPTOR)}
{previewError?.type === 'network' && previewError.message ? ` ${previewError.message}` : ''}
{`${
previewError?.type === 'size'
? i18n._(FILE_IS_TOO_LARGE_FOR_INLINE_PREVIEW_LIMIT_DESCRIPTOR, {previewLimitKb: PREVIEW_LIMIT_KB})
: i18n._(UNABLE_TO_LOAD_PREVIEW_DESCRIPTOR)
}${previewError?.type === 'network' && previewError.message ? ` ${previewError.message}` : ''}`}
</span>
</div>
</div>
@@ -64,10 +64,11 @@ export function TextualAttachmentCodePanel({
data-flx="channel.embeds.attachments.textual-attachment-code-panel.warning-circle-icon"
/>
<span data-flx="channel.embeds.attachments.textual-attachment-code-panel.span">
{previewError?.type === 'size'
? i18n._(FILE_IS_TOO_LARGE_FOR_INLINE_PREVIEW_LIMIT_DESCRIPTOR, {previewLimitKb: PREVIEW_LIMIT_KB})
: i18n._(UNABLE_TO_LOAD_PREVIEW_DESCRIPTOR)}
{previewError?.type === 'network' && previewError.message ? ` ${previewError.message}` : ''}
{`${
previewError?.type === 'size'
? i18n._(FILE_IS_TOO_LARGE_FOR_INLINE_PREVIEW_LIMIT_DESCRIPTOR, {previewLimitKb: PREVIEW_LIMIT_KB})
: i18n._(UNABLE_TO_LOAD_PREVIEW_DESCRIPTOR)
}${previewError?.type === 'network' && previewError.message ? ` ${previewError.message}` : ''}`}
</span>
</div>
</div>
@@ -116,7 +116,9 @@ export const FiltersSection: React.FC<FiltersSectionProps> = observer(
size={remFromPx(12)}
data-flx="channel.message-search-bar.filter-option.filters-section.funnel-icon"
/>
{title || i18n._(SEARCH_FILTERS_DESCRIPTOR)}
<flx-i18n data-flx="channel.message-search-bar.filter-option.filters-section.flx-i18n">
{title || i18n._(SEARCH_FILTERS_DESCRIPTOR)}
</flx-i18n>
</span>
</div>
{options.map((option: SearchFilterOption, index) => (
@@ -91,7 +91,9 @@ export const PlaintextSection: React.FC<PlaintextSectionProps> = observer(
data-flx="channel.message-search-bar.plaintext-section.magnifying-glass-icon"
/>
)}
{group === 'filter-key' ? i18n._(SEARCH_FILTERS_DESCRIPTOR) : `${group}:`}
<flx-i18n data-flx="channel.message-search-bar.plaintext-section.flx-i18n">
{group === 'filter-key' ? i18n._(SEARCH_FILTERS_DESCRIPTOR) : `${group}:`}
</flx-i18n>
</span>
</div>
{entries.map(({row, index}) => {
@@ -84,7 +84,8 @@ export const UnaddableRecipientsConfirmModal = observer(
<ul data-flx="channel.unaddable-recipients-confirm-modal.ul">
{rows.map((row) => (
<li key={row.userId} data-flx="channel.unaddable-recipients-confirm-modal.li">
<strong data-flx="channel.unaddable-recipients-confirm-modal.strong">{row.name}</strong>: {row.reasonText}
<strong data-flx="channel.unaddable-recipients-confirm-modal.strong">{row.name}</strong>
<span data-flx="channel.unaddable-recipients-confirm-modal.span">{`: ${row.reasonText}`}</span>
</li>
))}
</ul>