Allow and automatically strip @ prefix when adding users in PM


(Dave McClure) #1

It’d be nice if you could type the user or group name with or without an @ prefix in the PM recipient textbox.

I was testing out the PM feature for messaging groups, and I spent a few minutes scratching my head.

  1. I created a group called ‘testgroup’.
  • I set it so that everyone can use it as an alias.

  • I clicked ‘Create Topic’ and verified that @testgroup worked as expected.

  • Then I went to a user page, can clicked ‘Private Message’

  • I deleted the username, and typed @testgroup.

  • I typed my title and body and clicked ‘Create Private Message’

  • I got an error:
    Archetype Sorry, you cannot send a private message to that user

  • I went back to the group page to see if there was some PM setting.

  • I tried removing myself from the group thinking there may be a bug that doesn’t allow you to PM a group you are a part of.

  • Scratched my head

  • Went back and tried again, same probem

  • Finally realized that I had to type testgroup instead of @testgroup

I think I tripped over this because

  • Whenever else you address a user or a group, you prefix their name with a @

  • Usually, if you are PM’ing one user, you do it without typing their name - its autofilled from the button, so you don’t learn otherwise in common cases


(Tobias Eigen) #2

I just ran into this issue today when writing a handful of PMs directly from my own messages page, and I think it’s a bug.

Addressing with the @ doesn’t work but it should, since that’s how we address/mention people all day long.

At the very least, the error message provided should be changed as the current error (screenshot below) is patently unhelpful and counterproductive.

Edit: added " but it should" to 2nd para above for clarity.


(cpradio) #3

Weird thought, are @ symbols allowed in the Username? I don’t think they are, so it should be trivial to just remove all @ symbols from the PM To field when the PM is submitted. User can enter them, they get stripped behind the scenes, and therefore process successfully.


(Jeff Atwood) #4

@techapj can you add this to your list – first improve the error then strip at symbol if present at start of names.


(Sam Saffron) #5

This should be sorted in latest:

https://github.com/discourse/discourse/commit/d0fe1725c89088cf3c897d41512edfcd440aa836


(Sam Saffron) #6