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

When there is space in user name he won't get mentions on his name. #308

Open
inliquid opened this issue Jul 11, 2014 · 21 comments
Open

When there is space in user name he won't get mentions on his name. #308

inliquid opened this issue Jul 11, 2014 · 21 comments
Milestone

Comments

@inliquid
Copy link
Contributor

Subj.

@inliquid
Copy link
Contributor Author

The problem is within getMentions().

  1. regexp should be fixed f.i. {2,20} -> {2,40}, see User avatar displays corrupted symbol when username is multibyte #305
  2. Function will not work on names which contain spaces because it gets raw $content from the form.

The solution:
$content = htmlentities($content);

@tobyzerner
Copy link
Member

I don't understand the issue?

@tobyzerner tobyzerner added this to the 1.0.0g5 milestone Jul 28, 2014
@inliquid
Copy link
Contributor Author

Okay. Create user with user name '@user User' -> there is space in his name. Try to mention him using '@'. He won't get any notification, until you add this fix:

$content = htmlentities($content);

in getMentions().

@inliquid inliquid changed the title When there is space in user name it won't get mentions on his name. When there is space in user name he won't get mentions on his name. Jul 28, 2014
@tvb
Copy link
Contributor

tvb commented Nov 24, 2014

@inliquid You mean like so:

public function getMentions($content)
{
    $content = htmlentities($content);

    preg_match_all('/(^|[\s,\.:\]])@([^\s[\]]{2,40})\b/iu', $content, $matches, PREG_SET_ORDER);
    $names = array();
    foreach ($matches as $k => $v) $names[] = str_replace(" ", " ", $v[2]);

    return $names;
}

@inliquid
Copy link
Contributor Author

@tvb yes, exactly.

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

Ok, nice. There are still problems with @ mentioning usernames containing spaces and special characters.

The username Dirk Jan is linked in a mention as follows:

http://www.esotalk.org/member/name/DirkJan

Unfortunately the profile is not correctly linked and cannot be loaded.

@inliquid
Copy link
Contributor Author

I can't reproduce this on my system. There should be member id after name/, like this http://www.esotalk.org/member/name/999-Dirk-Jan. Maybe it wasn't space (ascii 0x20) when entering name?

@inliquid
Copy link
Contributor Author

Look at this oneas well #306

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

Sec. I'll make a screenshot.

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

Screenshot:
screen shot 2014-11-25 at 09 10 17

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

This one also breaks:
screen shot 2014-11-25 at 09 14 02

note that user @Mike and @Mandy are correctly linked to there profile and working.

@inliquid
Copy link
Contributor Author

I was wrong - it's a search string, so no need for member Id here.
However I do not have such problem, my site works fine even with unicode (with some fix):

1

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

What are those fixes? And can you try to reproduce it with username Martin & Tina just to be sure?

@inliquid
Copy link
Contributor Author

I'd fixed slug function, I think this fix is now included in development branch, plus these fixes of #306, I have written in description there. Just a minute will try this user name.

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

I am running dev version so the fix should be included already..

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

And added the{2,20} to {2,40} fix already

@inliquid
Copy link
Contributor Author

2

I have developed a simple filter for user name based on regexp, so anything different from alphanumeric plus spaces '-' and '' is transformed to ''. Mentions with '&' will be broken. I have also opened a ticket few months ago. Will try to find.

@inliquid
Copy link
Contributor Author

Look at #311

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

I don't want to block characters from username, it should work in all cases.

@inliquid
Copy link
Contributor Author

It will not work with existing mechanism with any special character. (And I'm not sure it's possible - you have to somehow understand that here is the end of nickname, righ now it's   sequence that will not be transformed, but real space or puctuation breaks the line.

@tvb
Copy link
Contributor

tvb commented Nov 25, 2014

I understand it is somewhat impossible with the current implementation. Hmmm

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

No branches or pull requests

3 participants