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

Correct nick validation #1114

Merged
merged 10 commits into from
Aug 17, 2020
Merged

Correct nick validation #1114

merged 10 commits into from
Aug 17, 2020

Conversation

dalcde
Copy link
Contributor

@dalcde dalcde commented Aug 17, 2020

According to RFC 2812 § 2.3.1 is allowed to start with either a letter or a
special character. Previously, this followed the older RFC 1459 that only
allowed letters (but the rest of the logic follows RFC 2812).

Fixes #467. Supersedes #552.

This allows for easier unit testing. Tests were not added for the "nick
must start with a letter" condition, because this will be changed in the
next commit.

Signed-off-by: Dexter Chua <dec41@srcf.net>
According to RFC 2812 § 2.3.1 is allowed to start with either a letter or a
special character. Previously, this followed the older RFC 1459 that only
allowed letters (but the rest of the logic follows RFC 2812).

Fixes matrix-org#467

Signed-off-by: Dexter Chua <dec41@srcf.net>
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

This is great stuff, thank you for taking the time with the tests too. Only a few language suggestions from me.

src/irc/BridgedClient.ts Show resolved Hide resolved
spec/unit/BridgedClient.spec.js Outdated Show resolved Hide resolved
spec/unit/BridgedClient.spec.js Outdated Show resolved Hide resolved
spec/unit/BridgedClient.spec.js Outdated Show resolved Hide resolved
spec/unit/BridgedClient.spec.js Outdated Show resolved Hide resolved
spec/unit/BridgedClient.spec.js Outdated Show resolved Hide resolved
describe("BridgedClient", function() {
describe("getValidNick", function() {
it("valid nick unchanged", function() {
expect(BridgedClient.getValidNick("foobar", true, STATE_DISC)).toBe("foobar");
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be good to have more valid examples here containing numbers and special characters

spec/unit/BridgedClient.spec.js Outdated Show resolved Hide resolved
changelog.d/1114.bugfix Outdated Show resolved Hide resolved
changelog.d/1114.bugfix Outdated Show resolved Hide resolved
changelog.d/1114.bugfix Outdated Show resolved Hide resolved
dalcde and others added 8 commits August 17, 2020 16:49
Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Will Hunt <will@half-shot.uk>
@Half-Shot Half-Shot merged commit 348042a into matrix-org:develop Aug 17, 2020
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.

None yet

2 participants