Skip to content
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

Merged
merged 3 commits into from
Nov 22, 2023

Conversation

hopperelec
Copy link
Contributor

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

Slight relevant refactor in AuthorLabel
@github-actions
Copy link

github-actions bot commented Oct 24, 2023

⚡ Preview for this PR: https://pr-93.chat-analytics.pages.dev
📊 Demo

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (33696f2) 71.96% compared to head (cd99f45) 71.93%.
Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@mlomb
Copy link
Owner

mlomb commented Oct 26, 2023

We should hide the discriminator if it is 0

name = (
<>
{n}
{discr && <span className="Label__discriminator">#{`${isDemo ? 0 : discr}`.padStart(4, "0")}</span>}
Copy link
Owner

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Owner

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

@hopperelec
Copy link
Contributor Author

We should hide the discriminator if it is 0

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

@mlomb
Copy link
Owner

mlomb commented Nov 22, 2023

You are right about data efficiency but since this is for older reports its ok

@mlomb mlomb merged commit 8bcf36e into mlomb:main Nov 22, 2023
9 checks passed
@hopperelec hopperelec deleted the pseudoremove-discrim branch November 22, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants