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

Make sure self messages are never highlighted #157

Merged
merged 2 commits into from
Mar 8, 2016

Conversation

astorije
Copy link
Member

@astorije astorije commented Mar 7, 2016

Fixes #156.

@astorije astorije added Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. second review needed labels Mar 7, 2016
@dgw
Copy link
Contributor

dgw commented Mar 7, 2016

I was thinking about this yesterday and didn't get around to making an issue for it, and here's a PR all set to fix it. 👍

@astorije
Copy link
Member Author

astorije commented Mar 7, 2016

This is a quick fix, but maybe a wee bit longer-term solution should be to parse and trigger on the client instead, like #152 is doing, no?

@maxpoulin64
Copy link
Member

Wouldn't it be better to check for self before the loop and avoid splitting the message entirely instead of doing it and overriding it right after?

Also, my PR doesn't actually touch that. This function is only responsible of turning IRC messages into HTML. If we want to handle highlights on the client, it would fit more in the msg handler. One minor thing for client-side highlights: if the user changes nicks and reload the page, the previous highlights will no longer be highlighted. Storing it in the server object has the benefit of making it permanent.

@xPaw
Copy link
Member

xPaw commented Mar 7, 2016

@maxpoulin64 is right, check for self and then avoiding message splitting would be a better way.

@AlMcKinlay
Copy link
Member

Does this remove the need for #146 ?

I actually think it's a much nicer way of doing it, rather than hacking in the client as to which highlight messages we actually show.

@xPaw
Copy link
Member

xPaw commented Mar 7, 2016

Hm, looks like yes, it does.

@AlMcKinlay
Copy link
Member

Yeah, that's fine. I think it's better dealing with it this way, especially for this issue.

@astorije
Copy link
Member Author

astorije commented Mar 7, 2016

Good point guys, I'll fix that. Also, I have a decent (well, in my opinion :p) idea how to make these testable, will post here when I get to it. Edit: Not doable at the moment (but that I knew), I'll see in a future PR.

@astorije astorije force-pushed the astorije/no-highlight-self branch from 6089cd6 to 855f7ce Compare March 8, 2016 06:51
@astorije astorije force-pushed the astorije/no-highlight-self branch from 855f7ce to 6a6c417 Compare March 8, 2016 06:54
@astorije
Copy link
Member Author

astorije commented Mar 8, 2016

Hi all, took your comments into consideration to make things nicer. Thanks for looking carefully and sorry for being reckless in the first place :p
So now, the highlight lookup is only done if this is not a message from self. Also, I added something else: using some(), I stop the lookup early when one of the words matches. @maxpoulin64, I specifically thought of your addition to performance matters while doing so :D

@maxpoulin64
Copy link
Member

👍 looks all good to me

maxpoulin64 added a commit that referenced this pull request Mar 8, 2016
Make sure self messages are never highlighted
@maxpoulin64 maxpoulin64 merged commit 0306c97 into master Mar 8, 2016
@astorije astorije deleted the astorije/no-highlight-self branch March 8, 2016 08:23
@astorije astorije added this to the 1.4.0 milestone Oct 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants