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

Fixing short discord names #1134

Merged
merged 8 commits into from
Aug 18, 2023
Merged

Fixing short discord names #1134

merged 8 commits into from
Aug 18, 2023

Conversation

kkatusic
Copy link
Collaborator

@kkatusic kkatusic commented Aug 17, 2023

Fix #1132

@kristoferlund check if everything ok. I checked only on two places is required for username length, user schema and user_account schema.

There isn't any test required by name length, on front and bot side.

Only that is somehow suspicion to me is this bot code, cc @Vyvy-vi

https://github.com/givepraise/praise/blob/main/packages/discord-bot/src/utils/dmTargets.ts#L105

I don't know why we have here 24 fixed number.

@kristoferlund
Copy link
Member

kristoferlund commented Aug 17, 2023

Yes, that looks a bit suspicious :)

Let's unify username and useraccount.names lengths to 2-32 characters.

@kkatusic You need to look at users.service as well:

generateUserNameFromAccount
generateValidUsername

@kkatusic
Copy link
Collaborator Author

@kristoferlund I checked that inside users username schema and set minimum of 2 character as well.

And confirm this that you want on our side set up to 32 max character? Asking this because we have some regex for that:

const pattern = /^[a-z0-9][a-z0-9_.-]{2,48}[a-z0-9]$/;

:)

@kristoferlund
Copy link
Member

@kkatusic Oh yes, forgot. We use eth address as username in some cases, when user logs in to dashboard without first activating their account. So let's not change username maxlength.

@kkatusic
Copy link
Collaborator Author

@kristoferlund than this is done?

@Vyvy-vi
Copy link
Collaborator

Vyvy-vi commented Aug 18, 2023

Would we also need to account for the twitter length limit? (2-15)

@kristoferlund kristoferlund self-requested a review August 18, 2023 07:04
Copy link
Member

@kristoferlund kristoferlund left a comment

Choose a reason for hiding this comment

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

All looks good, tests passing. I added 2-32 requirements to dashboard as well.

@kristoferlund kristoferlund merged commit f034661 into main Aug 18, 2023
4 checks passed
@Vyvy-vi Vyvy-vi deleted the fix_discord_shortname branch September 1, 2023 07:56
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.

Unable to praise to users with short usernames
3 participants