@rocapine/community-core 0.11.0 → 0.11.1

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.
package/lib/models.d.ts CHANGED
@@ -180,10 +180,13 @@ export interface ThreadComment {
180
180
  /**
181
181
  * Public display name, with a host-configured fallback for profiles not yet named.
182
182
  * Accepts either a raw username or any profile-shaped object carrying one (a row's
183
- * `.profiles`, a `ProfileRow`, or a previously-mapped `CommunityProfile`).
183
+ * `.profiles`, a `ProfileRow`, or a previously-mapped `CommunityProfile`). An unnamed
184
+ * profile that picked a handle shows the handle before the fallback (handles are only
185
+ * auto-assigned once a username exists, so this only kicks in for a chosen one).
184
186
  */
185
187
  export declare function displayName(profile: string | null | undefined | {
186
188
  username?: string | null;
189
+ handle?: string | null;
187
190
  }, fallback: string): string;
188
191
  /**
189
192
  * The topic column is app-defined free text. Unlike the mold (which dropped topics
package/lib/models.js CHANGED
@@ -42,12 +42,14 @@ exports.EMPTY_REACTION_DATA = {
42
42
  /**
43
43
  * Public display name, with a host-configured fallback for profiles not yet named.
44
44
  * Accepts either a raw username or any profile-shaped object carrying one (a row's
45
- * `.profiles`, a `ProfileRow`, or a previously-mapped `CommunityProfile`).
45
+ * `.profiles`, a `ProfileRow`, or a previously-mapped `CommunityProfile`). An unnamed
46
+ * profile that picked a handle shows the handle before the fallback (handles are only
47
+ * auto-assigned once a username exists, so this only kicks in for a chosen one).
46
48
  */
47
49
  function displayName(profile, fallback) {
48
- const raw = typeof profile === "string" || profile == null ? profile : profile.username;
49
- const trimmed = raw?.trim();
50
- return trimmed ? trimmed : fallback;
50
+ if (typeof profile === "string" || profile == null)
51
+ return profile?.trim() || fallback;
52
+ return profile.username?.trim() || profile.handle?.trim() || fallback;
51
53
  }
52
54
  /**
53
55
  * The topic column is app-defined free text. Unlike the mold (which dropped topics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocapine/community-core",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Headless Supabase-backed community backend: identity, feed/thread/moderation services, and React Query hooks.",
5
5
  "license": "MIT",
6
6
  "repository": {