@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 +4 -1
- package/lib/models.js +6 -4
- package/package.json +1 -1
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
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
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