Fixed Copying and Pasting @Tags does not alert user

Divvens

Well-known member
I had this issue come up recently on my board using the [bd]Tag add-on, I tested to see if this is a issue with xF core tagging as well, it seems it is. I have tested it in this test thread with an account of my friend (to which I have access as well) - http://xenforo.com/community/threads/testing-tagging.55122/

If a tag is copied and pasted, it does not alert user.
If you type in @Freeze, it would alert the user. But if you copy and paste the tag (say from another post) the @tag doesn't alert the user, since the username is considered a "hyperlink" and it doesn't turn into the user BB code that is produced from tagging.

To reproduce:
1. Tag a user. Check the tagged account for alert.
2. Copy and paste the tag, user is not alerted for that tag.

Clicking "edit" on the 2nd message also shows that the tags aren't converted to the user BBCode.

This issue came up in a thread where the thread starter would require to tag (and alert) a set of users frequently, the thread starter kept copying and pasting the tags until the users reported not being alerted by the tags. Sometimes, if multiple users need to be tagged frequently (with the lack of group tagging) people usually copy/paste.
 
The copy & paste copies the user hyperlink correctly and it gets converted into a code correctly.
It gets converted into
Code:
[url=link]Username[/url]
That is what I meant, copying and pasting the username with the tag pastes it as a URL and when the post is made, it is retained as a URL and not as a tag. I.E, the @USERNAME does not turn into
Code:
[USER=9157]Freeze[/USER]
When copied and pasted. Thus not generating a alert if "@Freeze" is copied and pasted.
 
A user isn't alerted with direct use of the user tag, @Divvens (or so I believe. I may be wrong here). However, this may be an edge case where the editor could pick it up and remove the URL and USER tag completely, leaving a plain tag.
 
A user isn't alerted with direct use of the user tag, @Divvens (or so I believe. I may be wrong here). However, this may be an edge case where the editor could pick it up and remove the URL and USER tag completely, leaving a plain tag.
I am aware that the user BBCode aren't the ones that generate an alert, but typically, if I type in @King Kovifor it turns into
Code:
[user=81]King Kovifor[/user]

I was using that as an example to show that when @King Kovifor is copied and pasted, it is just copied as a URL, and once the post is made, it is retained as a URL rather than being converted to a tag that should alert the user. And this can be seen when "editing" the copied and pasted tag, since the username is now in URL parameters and not in user bbcode parameters.
 
I am aware that the user BBCode aren't the ones that generate an alert, but typically, if I type in @King Kovifor it turns into
Code:
[user=81]King Kovifor[/user]

I was using that as an example to show that when @King Kovifor is copied and pasted, it is just copied as a URL, and once the post is made, it is retained as a URL rather than being converted to a tag that should alert the user. And this can be seen when "editing" the copied and pasted tag, since the username is now in URL parameters and not in user bbcode parameters.
I realize how that last post could have sounded slightly rude. I apologize if it came off that way, wasn't meant to be. Was just attempting to explain the programming logic behind it. How you copy a URL (a tag) so the editor correctly converts it to URL tag and commenting on how converting it to the USER tag wouldn't work the way you intended it to. My last line (as Mike quoted) is the "solution" where this edge case would need to strip the URL completely to leave it as "@King Kovifor" for it to work as a new tag.
 
I realize how that last post could have sounded slightly rude. I apologize if it came off that way, wasn't meant to be. Was just attempting to explain the programming logic behind it. How you copy a URL (a tag) so the editor correctly converts it to URL tag and commenting on how converting it to the USER tag wouldn't work the way you intended it to. My last line (as Mike quoted) is the "solution" where this edge case would need to strip the URL completely to leave it as "@King Kovifor" for it to work as a new tag.
Hey hey, I didn't take it rudely and you don't need to apologize! :P
I'm a noob when it comes to programming, I did however understand that you posted a solution when you spoke about leaving a plain tag. I was just trying my best to explain in my own terms the issue :D You weren't rude or anything. Infact, if I sounded rude with my reply forgive me, I was under the misunderstanding that you hadn't understood the original problem I was reporting (after re-reading your post, I see that you did actually understand it) :)

I've also come across another bug which I shall now report in another thread!
 
I've adapted the output a bit and this should work in the overwhelming majority of cases where this may happen. Strictly speaking, the [user] tag can have any content -- we don't actually know the user's name. If someone has changed that, then this will fail (in terms of the alert, the paste will still work).

But that should be an absolute edge case.
 
Top Bottom