You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Component to render pronouns in the chat timeline.
289
+
* It also filters them.
290
+
*/
283
291
constPronouns=as<
284
292
'span',
285
293
{
@@ -295,6 +303,13 @@ const Pronouns = as<
295
303
.map((lang)=>lang.trim().toLowerCase())
296
304
.filter(Boolean);
297
305
306
+
/**
307
+
* filter the pronouns based on the user's language settings.
308
+
* If filtering is enabled, only show pronouns that match the selected languages.
309
+
* If filtering is disabled, show all pronouns but still apply the language filter to determine which pronouns to show if there are multiple sets of pronouns for different languages.
310
+
* If there are multiple sets of pronouns and filtering is enabled, only show the ones that match the selected languages.
311
+
* If there are no pronouns that match the selected languages, show all pronouns.
312
+
*/
298
313
constvisiblePronouns=filterPronounsByLanguage(
299
314
pronouns,
300
315
languageFilterEnabled,
@@ -365,22 +380,42 @@ function MessageInternal(
365
380
constmx=useMatrixClient();
366
381
constuseAuthentication=useMediaAuthentication();
367
382
368
-
constpmp=useMemo(
383
+
/**
384
+
* We read the per-message profile from the event content here.
385
+
* We have to do this in the message component because the per-message profile can be different for each message, and we need to read it for each message individually.
386
+
* We also want to avoid reading and parsing the per-message profile in a parent component like the timeline, because that would be inefficient and would cause unnecessary re-renders of the entire timeline whenever a per-message profile changes.
* If there is a per-message profile, we want to use the per message pronouns,
414
+
* otherwise we fall back to the profile pronouns.
415
+
* This allows users to set pronouns on a per-message basis, while still falling back to their profile pronouns if they don't set any for a specific message.
0 commit comments