-
Notifications
You must be signed in to change notification settings - Fork 78
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
removes discriminator for pomelo usernames #218
base: dev
Are you sure you want to change the base?
Conversation
idk why that random pull request merge is 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.
Please test your code before making PRs
views/account/account.handlebars
Outdated
@@ -145,7 +145,7 @@ | |||
<div class="setting-card"> | |||
<h2 class="header">{{ locale.account.settings.settingCards.discord }}</h2> | |||
{{#if discordUser}} | |||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }}#{{ discordUser.discriminator }}</p> | |||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }}{{#ifCond discordUser.discriminator '#0'}}{{else}}#{{ discordUser.discriminator }}{{/ifCond}}</p> |
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.
- There is no handlebars function called
ifCond
. This crashes - Even if this didn't crash,
discordUser.discriminator
is a number, it does not contain the#
, which is why it is added here. These checks would always fail since you seem to be checking for#0
and not0
- We prefer to use full blocks for if statements instead of single lines. See the
#if
checks earlier in this same view for checking the usersenvironment
status
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.
should be fixed, however i was unable to rehost the website as i was missing critical files for the account server and didnt know how to get them
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.
Please test your code before comitting. Somehow. Set up a local account server, run a basic handlebars server that only tests this code, etc. However it has to be done for you and your setup, it doesn't matter, but it needs to be tested before trying to commit and PR
@@ -145,7 +145,10 @@ | |||
<div class="setting-card"> | |||
<h2 class="header">{{ locale.account.settings.settingCards.discord }}</h2> | |||
{{#if discordUser}} | |||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }}{{#ifCond discordUser.discriminator '#0'}}{{else}}#{{ discordUser.discriminator }}{{/ifCond}}</p> | |||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }} |
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.
Putting these on separate lines like this creates a space between the username and the discriminator when it is displayed
@@ -145,7 +145,10 @@ | |||
<div class="setting-card"> | |||
<h2 class="header">{{ locale.account.settings.settingCards.discord }}</h2> | |||
{{#if discordUser}} | |||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }}{{#ifCond discordUser.discriminator '#0'}}{{else}}#{{ discordUser.discriminator }}{{/ifCond}}</p> | |||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }} | |||
{{#if discordUser.discriminator}} |
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.
Again, see the above #if
checks for how to actually check if a value is matching another. This always resolves to true since the value will always exist even if it's the string 0
I pointed you in the direction of the environment
checks for a reason, as it shows how you should handle these #if
statements in our codebase. The #if
blocks should contain separate states of the elements
{{#if (eq environment 'prod')}}
<input type="radio" id="prod" name="server_selection" value="prod" checked>
{{else}}
<input type="radio" id="prod" name="server_selection" value="prod">
{{/if}}
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }}{{#ifCond discordUser.discriminator '#0'}}{{else}}#{{ discordUser.discriminator }}{{/ifCond}}</p> | ||
<p>{{ locale.account.settings.settingCards.connectedToDiscord }} {{ discordUser.username }} | ||
{{#if discordUser.discriminator}} | ||
#{{ discordUser.discriminator }} |
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.
Why exactly is there an extra space here in the form of
? This now creates 2 spaces between the username and the discriminator when it is shown
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.
that mustve been an accident, will remove
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
is still there btw
Sorry about that. The branch was deleted by mistake. Reopened |
quick fix, first time attempting anything with handlebars so it can probably be optimised, though it works for now (i think)