@oxyhq/core 3.4.15 → 3.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,13 +21,9 @@ exports.formatPublicKeyHandle = formatPublicKeyHandle;
21
21
  * Resolve a friendly display name for a user.
22
22
  *
23
23
  * Order of preference:
24
- * 1. `name.full`, or composed `name.first name.last` (FIRST-NAME-ONLY SAFE —
25
- * a user with only a first name resolves to that first name, never to the
26
- * lowercase username; this is the exact drift bug the auth app hit).
27
- * 2. `name` (when stored as a plain string)
28
- * 3. `displayName` (server `displayName` virtual — `username || truncatedKey`).
29
- * Placed AFTER the structured name on purpose: the server virtual ignores
30
- * `name`, so preferring it first would re-introduce the first-only bug.
24
+ * 1. `displayName` from the API contract.
25
+ * 2. `name.full`, or composed `name.first name.last` for local unsaved shapes.
26
+ * 3. `name` when stored as a plain string.
31
27
  * 4. `username`
32
28
  * 5. `Account 0x12345678…` (derived from publicKey, when present)
33
29
  * 6. Translated fallback (e.g. "Unnamed")
@@ -39,6 +35,8 @@ const getAccountDisplayName = (user, locale) => {
39
35
  if (!user)
40
36
  return (0, i18n_1.translate)(locale, 'common.unnamed');
41
37
  const { name, displayName, username, publicKey } = user;
38
+ if (typeof displayName === 'string' && displayName.trim())
39
+ return displayName.trim();
42
40
  if (name && typeof name === 'object') {
43
41
  if (typeof name.full === 'string' && name.full.trim())
44
42
  return name.full.trim();
@@ -51,8 +49,6 @@ const getAccountDisplayName = (user, locale) => {
51
49
  else if (typeof name === 'string' && name.trim()) {
52
50
  return name.trim();
53
51
  }
54
- if (typeof displayName === 'string' && displayName.trim())
55
- return displayName.trim();
56
52
  if (typeof username === 'string' && username.trim())
57
53
  return username.trim();
58
54
  if (typeof publicKey === 'string' && publicKey.length > 0) {