# Pressing return when searching in messages returns no results

**URL:** https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949
**Category:** Bug
**Created:** [8월 10, 2015, 12:27오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949 "2015-08-10T12:27:12Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![alexhartley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexhartley/32/233168_2.png) [@alexhartley](https://meta.discourse.org/u/alexhartley)
#### Post date: [8월 10, 2015, 12:27오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/1 "2015-08-10T12:27:12Z")

</div>

If you press return during a search of private messages the search operator used is `private_messages:username` but it should be `in:private` shouldn’t it?

 ![](https://global.discourse-cdn.com/meta/original/3X/8/2/82edec6f81d9c2b0f34d7cc5b4d9ef45761df0f8.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: [8월 10, 2015, 12:29오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/2 "2015-08-10T12:29:12Z")

</div>

In needs some conditional logic, needs to behave slightly different if you are an admin.

---

<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: [8월 14, 2015, 9:56오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/3 "2015-08-14T09:56:46Z")

</div>

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

Submitted a PR.

@sam How is an admin affected? I’m not too sure about this point.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [8월 14, 2015, 9:09오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/4 "2015-08-14T21:09:39Z")

</div>

Admins need to search the target user’s PMs, not their own.

---

<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: [8월 15, 2015, 1:53오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/5 "2015-08-15T01:53:12Z")

</div>

To clarify, how is an admin able to search through any user’s private message now? `in:private user:<username>`?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [8월 15, 2015, 2:32오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/6 "2015-08-15T02:32:00Z")

</div>

As the op states, `private_messages:username`

---

<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: [8월 15, 2015, 2:38오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/7 "2015-08-15T02:38:01Z")

</div>

Is that working right now? When I was looking into fixing this bug, I discovered that `private_messages:username` in the query is not being handled neither on the client nor the server. I hope I didn’t miss anything 😺

---

<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: [8월 15, 2015, 5:30오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/8 "2015-08-15T05:30:54Z")

</div>

So `private_messages:username` is a feature for admin ❓

---

<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: [8월 15, 2015, 5:47오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/9 "2015-08-15T05:47:37Z")

</div>

Absolutely since mods can’t see PMs (sorry “personal” messages, not private @downey) only Admins can.

It’s kind of an edge case, but say an admin is trying to figure out a pattern of a person sending abusive PMs, they might want to search from that person’s Messages page to figure out what kind of hate they’re slinging via PM and to who.

Very narrow use case, can mostly be ignored for now IMO. 99.9% of the time you search your own PMs.

---

<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: [8월 15, 2015, 7:15오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/10 "2015-08-15T07:15:24Z")

</div>

> [@codinghorror](#):
>
> It’s kind of an edge case, but say an admin is trying to figure out a pattern of a person sending abusive PMs, they might want to search from that person’s Messages page to figure out what kind of hate they’re slinging via PM and to who.

I suppose the admin could impersonate the user and look at his messages too 😄

---

<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: [8월 15, 2015, 7:21오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/11 "2015-08-15T07:21:53Z")

</div>

Impersonation is only available for “site-installer” admins aka “listed in app.yml with an email address” from what I remember @sam telling me, so it is a level even higher than Admin. Don’t think that’s a good thing to rely on.

---

<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: [8월 15, 2015, 9:11오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/12 "2015-08-15T09:11:20Z")

</div>

Nope impersonation of admin/mod is restricted to “developers” aka site installers

---

<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: [8월 15, 2015, 9:16오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/13 "2015-08-15T09:16:06Z")

</div>

Ok so searching personal messages for admins is a feature the hasn’t been implemented but is something we want? 🐈

---

<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: [8월 15, 2015, 9:30오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/14 "2015-08-15T09:30:15Z")

</div>

Not really sure, no one ever asked for this

---

<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: [8월 15, 2015, 9:57오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/15 "2015-08-15T09:57:14Z")

</div>

> [@riking](#):
>
> Admins need to search the target user’s PMs, not their own.

Ah ok I was under the impression the feature had been implemented but broken 😄

---

<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: [8월 15, 2015, 10:48오전 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/16 "2015-08-15T10:48:45Z")

</div>

The main use case we need to cover is enter searching all a users public posts when on a random users profile, that is common

Searching someone else’s PMs is a bit creepy, probably should be logged

---

<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: [8월 16, 2015, 4:59오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/17 "2015-08-16T16:59:09Z")

</div>

![](https://global.discourse-cdn.com/meta/original/3X/e/c/ec76e64da1f83939f4ff3cbb6a2d83d4da838547.png) 

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: [8월 16, 2015, 10:51오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/18 "2015-08-16T22:51:28Z")

</div>

Fixed per

[https://github.com/discourse/discourse/commit/6086b07324d02f5d31a498790cf51cd081dbb74c](https://github.com/discourse/discourse/commit/6086b07324d02f5d31a498790cf51cd081dbb74c)

😉

---

<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: [8월 16, 2015, 11:10오후 UTC](https://meta.discourse.org/t/pressing-return-when-searching-in-messages-returns-no-results/31949/19 "2015-08-16T23:10:51Z")

</div>


