Together-100Devs / Together

Together is a group calendar application using the MERN stack intended to bring discord communities closer!
https://together.cyclic.app/
MIT License
167 stars 112 forks source link

New style Discord usernames are not displayed correctly #426

Closed intelagense closed 11 months ago

intelagense commented 12 months ago

Describe the bug

User names that have been updated with Discord's new username policy will show a trailing "#0" after the name of the event author on posted events and when creating events.

To Reproduce

Steps to reproduce the behavior:

  1. Have a username that does not include a Discord tag/discriminator.
  2. Create an event.
  3. When creating or displaying the event the event author will show with a trailing "#0"

Expected behavior

The username should be consistent with Discord.

Screenshots

Example event that has the author name with extra characters.

Which Branch should this fix be Pulled into?

PR into [branchName]

Device Information

N/A

Additional context

This appears to be normal behavior on Discord's part: https://discord.com/developers/docs/change-log#identifying-migrated-users

Names seem to be stored in the Together database as a string with the Discord tag attached. https://github.com/Together-100Devs/Together/blob/951a6d8a5c667e8dd854ad30e95be24dd2af2abc/server/config/passport.js#L30

https://github.com/Together-100Devs/Together/blob/951a6d8a5c667e8dd854ad30e95be24dd2af2abc/server/config/passport.js#L44-L62

Splitting displayName at the "#" symbol and examining the length of the second element could be enough. If the second element does not consist of a four-digit discriminator, we can exclude showing the "#" symbol and number on the affected pages.

devlarabar commented 12 months ago

Hi Eric, I'd like to help with this issue!

intelagense commented 12 months ago

It is yours.