See https://github.com/discourse/discourse/security/advisories/GHSA-rcc5-28r3-23rr
This commit centralizes 'display name' generation into a helper, and updates it to respect core preferences for `enable_names` and `prioritize_username_in_ux`.