# Bug when composing topic while viewing PM - incorrect "mentioned user will not be notified" warning

**URL:** https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270
**Category:** Bug
**Created:** [March 16, 2017, 4:06pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270 "2017-03-16T16:06:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [March 16, 2017, 4:06pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/1 "2017-03-16T16:06:23Z")

</div>

Had a feature request related to a closed topic. Flagged it to reopen. Asked to instead make a new topic. Typed c to open composer and started typing. After mentioning a non-admin user, I was warned that they would not be notified because it was a personal message. However, I was writing a public topic, not a PM. I was simply looking at a PM.

I think the logic from this PR is not working for some reason. Is it somehow checking the current view instead of the composer type @cpradio?  
[https://github.com/discourse/discourse/pull/4550](https://github.com/discourse/discourse/pull/4550)

Screenshots:

 ![](https://global.discourse-cdn.com/meta/original/3X/b/4/b451d3d43efc4821642c6af709e240d8ef9ea9a6.png)

Edit: just happened for this topic as well.

 ![](https://global.discourse-cdn.com/meta/original/3X/b/8/b8626140827eb3d1d58ad1ca09be27db543c09ad.png)

Repro:

1. Navigate to Messages.
2. Open a message.
3. Type c to open new topic composer.
4. Mention a non-admin user not a participant in message that was opened in step 2.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 16, 2017, 4:28pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/2 "2017-03-16T16:28:08Z")

</div>

This actually isn’t supposed to work at all…

## From a PM:

Right now there are three scenarios that behave differently with mentions in regards to informing the user they do not have access.

1. Reply to a Topic/PM

- The same workflow can work for topic and PM, in that, you check to see if the mention user can see the already existing topic/PM

1. Create a new Topic

- This isn’t the same workflow as above, as the topic doesn’t exist. So you have to check if the user can see the category the topic will be posted to. But what if the user changes the category? It should probably check again…

1. Create a PM

- This isn’t the same as either workflow above, as obviously this is dependent on the Recipient list, not a category or existing topic/PM. If the user isn’t in the recipient list (or part of a group in the recipient list), then they can’t see the PM.

So maybe we can redefine the scope a bit to make this a lot less complex? Which of these three are the most important? Or maybe I should post this in the feature discussion topic to find out if there is a better way to do this? Maybe a new notification that is send to the creator of the reply/topic/PM that says “hey, you mentioned X, Y, and Z and they can’t see your post” which would get sent after the post/topic/PM is posted, thus same workflow for all three scenarios.

* * *

It was decided to not worry about items #2 and #3… so I’m sort of surprised to see the dialog appear.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 16, 2017, 6:41pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/3 "2017-03-16T18:41:59Z")

</div>

Just make sure the check does not fire for new topics.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 16, 2017, 7:24pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/4 "2017-03-16T19:24:56Z")

</div>

Okay, I’m close to done with this fix, but the message is still considering it a PM, need to look at that part still and will then submit a PR.  
[https://github.com/discourse/discourse/compare/master...cpradio:cannot-see-mention?expand=1](https://github.com/discourse/discourse/compare/master...cpradio:cannot-see-mention?expand=1)

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 16, 2017, 9:01pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/5 "2017-03-16T21:01:11Z")

</div>

PR Submitted:  
[https://github.com/discourse/discourse/pull/4762](https://github.com/discourse/discourse/pull/4762)

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 6, 2017, 3:22am UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/6 "2017-04-06T03:22:12Z")

</div>

Merged 🙂 Thank you for fixing the bug @cpradio 👍

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 6, 2017, 3:24pm UTC](https://meta.discourse.org/t/bug-when-composing-topic-while-viewing-pm-incorrect-mentioned-user-will-not-be-notified-warning/59270/7 "2017-04-06T15:24:28Z")

</div>


