-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pseudo-remove Discord discriminators #93
Conversation
Slight relevant refactor in AuthorLabel
⚡ Preview for this PR: https://pr-93.chat-analytics.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
==========================================
- Coverage 71.96% 71.93% -0.04%
==========================================
Files 60 60
Lines 2440 2444 +4
Branches 513 514 +1
==========================================
+ Hits 1756 1758 +2
- Misses 624 626 +2
Partials 60 60 ☔ View full report in Codecov by Sentry. |
We should hide the discriminator if it is 0 |
name = ( | ||
<> | ||
{n} | ||
{discr && <span className="Label__discriminator">#{`${isDemo ? 0 : discr}`.padStart(4, "0")}</span>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new version does not have the padStart
when the discriminator is less than 1000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? It works for me, for example on the Demo the #0000 shows correctly, and I've tried my own reports where I didn't see anything like #900 for #0900
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, do you mean the padStart isn't needed anymore? Can't test that right now, but looks like that's fair enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh just realised that the code you referenced was the old code, I already removed it 😅As I say though, it works for me, because the discr is being kept as a string rather than being parsed to an integer first meaning the padding is already there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, message.author.discriminator
is already padded
Oh btw, if you're saying this because of the demo, it only shows in the demo because I'm removing it from the name itself, which is slightly more data-efficient, but the author names for the demo have of course already been calculated for the report_data, so the report_data will need to be reproduced |
You are right about data efficiency but since this is for older reports its ok |
Technically the Discord API still supports discriminators, and I am still a strong advocate for supporting legacy exports to a limited extent, so I don't think support for them should be removed entirely. However, having the #0000 at the end of every username is a bit redundant. May want to consider adding a "@" before the username, but that's really up to personal preference so I haven't included it