# Using @ breaks adding groups to message

**URL:** https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721
**Category:** Bug
**Created:** [October 17, 2018, 12:27pm UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721 "2018-10-17T12:27:27Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![robmc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robmc/32/125900_2.png) [@robmc](https://meta.discourse.org/u/robmc)
#### Post date: [October 17, 2018, 12:27pm UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/1 "2018-10-17T12:27:27Z")

</div>

When adding users to a new message, using the `@` symbol searches only usernames, not groups.

Is this intentional? Looking back at [previous instructions](https://meta.discourse.org/t/group-mentions-and-messages/36228), it seems that we were encouraged to use the `@`

> [@Allow groups to be mentioned and sent messages](https://meta.discourse.org/t/allow-groups-to-be-mentioned-and-sent-messages/36228/1):
>
> The composer was extended to allow you to use a group name as target for a message (provided the group allow messaging)
> 
> ![](https://global.discourse-cdn.com/meta/original/3X/6/d/6d94817b9eb60cdecf584153b9c9e64e66a355cd.png)

When trying to send a message to a group, where Everyone is allowed to mention and message the group, you are unable to add them. It appears that if you start with the `@` symbol the autocomplete only accepts usernames, even if you add the full name of the group.

If you just enter text however, then the group names do appear

 ![message%20group](https://global.discourse-cdn.com/meta/original/3X/0/7/0778e79851eebbcc79cf3703f86a00d544fa17ad.gif)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 18, 2018, 12:21am UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/2 "2018-10-18T00:21:34Z")

</div>

> [@robmc](#):
>
> When adding users to a new message, using the `@` symbol searches only usernames, not groups.

To me this looks like a regression, @j.jaffeux do you recall anything here?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [October 18, 2018, 7:17am UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/3 "2018-10-18T07:17:50Z")

</div>

No, it’s not select-kit. And I don’t think I ever touched this.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 18, 2018, 7:22am UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/4 "2018-10-18T07:22:35Z")

</div>

@nbianca I recall you worked on this selector in the past can you have a look at this issue?

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [October 18, 2018, 3:55pm UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/6 "2018-10-18T15:55:18Z")

</div>

I tried to bisect this, but I had no luck… because this has been broken before v1.8! (I could not install older versions because I had problems with dependencies that were not worth the time) 💥

Anyway, I got it fixed. The problem is that the query that gets to the server includes `@` which seemed to work fine for usernames (`Search.ts_query` is pretty smart), but did not for groups.

Fixed by

[https://github.com/discourse/discourse/pull/6506](https://github.com/discourse/discourse/pull/6506)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 18, 2018, 4:02pm UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/7 "2018-10-18T16:02:13Z")

</div>

> [@nbianca](#):
>
> The problem is that the query that gets to the server includes `@` which seemed to work fine for usernames ( `Search.ts_query` is pretty smart), but did not for groups.

Since they both use the same namespace, should they also use the same code path for search (on the server)?

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [October 19, 2018, 9:30am UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/8 "2018-10-19T09:30:20Z")

</div>

Currently there is search data for users, topic, posts, categories and tags, but none for groups. Implementing it is definitely possible, but I do not think it is worth the effort.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 19, 2018, 9:41am UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/9 "2018-10-19T09:41:01Z")

</div>

I see, we should at the very least do the same stripping on the server for those who call the API directly.

And maybe give some (_`ts_query`_) ❤ to [`Group.search_groups`](https://github.com/discourse/discourse/blob/5f86564da1bc7c921bf1ed791b3ebc00b5917525/app/models/group.rb#L387-L391) as well 😉

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [October 19, 2018, 9:44am UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/10 "2018-10-19T09:44:25Z")

</div>

> [@zogstrip](#):
>
> I see, we should at the very least do the same stripping on the server for those who call the API directly.

At first I implemented the stripping on the server side, but then I realised it isn’t server’s fault. If the client wants correct results, they should ask the correct questions.

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [November 2, 2018, 4:00pm UTC](https://meta.discourse.org/t/using-breaks-adding-groups-to-message/99721/11 "2018-11-02T16:00:03Z")

</div>

This topic was automatically closed after 14 days. New replies are no longer allowed.
