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

removes discriminator for pomelo usernames #218

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

oscie57
Copy link
Contributor

@oscie57 oscie57 commented Jul 25, 2023

quick fix, first time attempting anything with handlebars so it can probably be optimised, though it works for now (i think)

@oscie57
Copy link
Contributor Author

oscie57 commented Jul 25, 2023

idk why that random pull request merge is there

Copy link
Member

@jonbarrow jonbarrow left a 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

@@ -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>
Copy link
Member

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 not 0
  • 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 users environment status

Copy link
Contributor Author

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

Copy link
Member

@jonbarrow jonbarrow left a 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 }}
Copy link
Member

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}}
Copy link
Member

@jonbarrow jonbarrow Jul 26, 2023

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}}
&nbsp;#{{ discordUser.discriminator }}
Copy link
Member

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 &nbsp;? This now creates 2 spaces between the username and the discriminator when it is shown

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The &nbsp; is still there btw

@jonbarrow jonbarrow deleted the branch PretendoNetwork:dev April 9, 2024 00:02
@jonbarrow jonbarrow closed this Apr 9, 2024
@jonbarrow
Copy link
Member

Sorry about that. The branch was deleted by mistake. Reopened

@jonbarrow jonbarrow reopened this Apr 9, 2024
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.

3 participants