fix(frontend): account phone stored with a plus is not shown with two

This commit is contained in:
hh committed 2026-10-19 05:47:09 +00:00
1 parent aff8a9e443
commit e228d999dd
4 files changed
+10 -5

No files matched your search

@@ -18,6 +18,7 @@
import ProfileSection from "#lib/components/profile/ProfileSection.svelte";
import Icon from "#lib/components/ui/Icon.svelte";
import { formatDate, formatFull } from "#lib/format/datetime.js";
import { formatPhone } from "#lib/format/peer.js";
import { t } from "#lib/i18n/locale.svelte.js";
import { accounts } from "#lib/stores/accounts.svelte.js";
import { peers } from "#lib/stores/peers.svelte.js";
@@ -56,7 +57,7 @@
result.push({
icon: "phone",
label: t("profile.phone"),
value: `+${peer.phone}`,
value: formatPhone(peer.phone),
});
}
if (peer?.username) {
@@ -9,7 +9,7 @@
import Avatar from "#lib/components/ui/Avatar.svelte";
import EmptyState from "#lib/components/ui/EmptyState.svelte";
import Icon from "#lib/components/ui/Icon.svelte";
import { peerName } from "#lib/format/peer.js";
import { formatPhone, peerName } from "#lib/format/peer.js";
import { t } from "#lib/i18n/locale.svelte.js";
import type { MessageKey } from "#lib/i18n/messages.js";
import { accounts } from "#lib/stores/accounts.svelte.js";
@@ -73,7 +73,7 @@
if (peer?.username) {
return `@${peer.username}`;
}
return peer?.phone ? `+${peer.phone}` : `ID ${targetId}`;
return peer?.phone ? formatPhone(peer.phone) : `ID ${targetId}`;
}
const count = chat?.message_count ?? 0;
return count > 0 ? t("profile.messages", { count }) : t("profile.group");
@@ -7,7 +7,7 @@
import SettingsItem from "#lib/components/settings/SettingsItem.svelte";
import Button from "#lib/components/ui/Button.svelte";
import Icon from "#lib/components/ui/Icon.svelte";
import { accountName } from "#lib/format/peer.js";
import { accountName, formatPhone } from "#lib/format/peer.js";
import { t } from "#lib/i18n/locale.svelte.js";
import { accounts } from "#lib/stores/accounts.svelte.js";
@@ -78,7 +78,7 @@
<AccountAvatar account={current} size={5} />
<div class="name">{accountName(current)}</div>
{#if current.phone}
<div class="phone">+{current.phone}</div>
<div class="phone">{formatPhone(current.phone)}</div>
{/if}
{#if !current.is_active}
<div class="inactive">{t("account.inactive")}</div>