# Error when trying to view an email from a user's preference page

**URL:** https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724
**Category:** Bug
**Created:** [March 24, 2015, 10:24pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724 "2015-03-24T22:24:59Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 24, 2015, 10:24pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/1 "2015-03-24T22:24:59Z")

</div>

I’ve recently updated one of the forums I’m working on. [944c0db](https://github.com/discourse/discourse/tree/944c0db00f928fc7e782b22df0c250505d740709)

I’m bouncing back and forth between Admin and User’s preference page trying to fill in some full names. Viewing someone’s email will tell me who they are, but if I do it from the user’s profile page I get this error, which is logged:

```plaintext
Uncaught TypeError: undefined is not a function
Url: [FQDN]/assets/application-ea98de13baf37557a958317a1bc29054.js
Line: 34
Column: 69
Window Location: [FQDN]/users/[any-user]/preferences?undefined-renamed=&undefined-renamed=&undefined-renamed=&undefined-renamed=

```

There is no problem viewing their email address from the admin page, but I [can’t fix](https://meta.discourse.org/t/edit-full-name-in-admin/26506) their `Full Name` there. :grumpycat:

---

<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 24, 2015, 10:41pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/2 "2015-03-24T22:41:22Z")

</div>

I can view emails from the user’s profile page fine by clicking “show email”, is there a specific set of repro steps here?

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 24, 2015, 10:54pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/3 "2015-03-24T22:54:02Z")

</div>

Nothing special, just clicking the Show Email button of a user, when logged in as an admin.

You already have access to the forum in question, I’ll PM you a link to the log itself.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 24, 2015, 11:39pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/4 "2015-03-24T23:39:55Z")

</div>

Update

I’ve upgraded to what’s currently master, and can reproduce the issue Safari and Chrome.

If I visit any user’s `/users/garret/preferences` view as an admin, clicking `Show` gives this error.

Also, the full name wasn’t included in emails today ( in the same email where I said they should. ☹ )

---

<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 25, 2015, 12:02am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/5 "2015-03-25T00:02:14Z")

</div>

OK confirmed, from the admin page clicking or tapping the show email button indeed causes an error. Can you fix tomorrow @eviltrout?

---

<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 25, 2015, 12:07am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/6 "2015-03-25T00:07:24Z")

</div>

Hmm this one is tricky, I think it depends where you came from. Sometimes I can repro, sometimes I cannot. Can you walk us through it, click by click?

Start from a new browser and the home page.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 25, 2015, 12:15am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/7 "2015-03-25T00:15:16Z")

</div>

- click on home logo
- go to admin/users
- click on a user from the list (admin/users/mike)
- click `show`
- fix their title
- click Show Public Profile
- click Preferences
- click `show` on email ← error
- fix their full name

Same thing when starting from the list of posts

- Click the home logo
- scroll down to someone’s icon who’s posted lately
- click their logo to get their activity page
- click Preferences
- Click `Show` on email ← error

---

<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 25, 2015, 12:18am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/8 "2015-03-25T00:18:32Z")

</div>

- No repro on the first list of steps, oddly, when I get to the user page I have email already visible…

- Second list of steps is a repro for me. Page just refreshes when I click “show” on email in that case.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 25, 2015, 1:00am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/9 "2015-03-25T01:00:24Z")

</div>

> [@codinghorror](#):
>
> I have email already visible…

I assumed this was normal behavior when I’d already asked to view their email in the same session.. choosing a different user let me have the “need to click to show” experience.

---

<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: [March 25, 2015, 9:04am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/10 "2015-03-25T09:04:32Z")

</div>

> Window Location: [FQDN]/users/[any-user]/preferences?undefined-renamed=&undefined-renamed=&undefined-renamed=&undefined-renamed=

I had a similar error last week when I refactored a `<button>` to a `{{d-button}}` in the user’s preference template. Here’s what I did to fix it:

> <https://github.com/discourse/discourse/blob/11bf7da63cbbd5ebcb0066f2774577cabf806550/app/assets/javascripts/discourse/components/d-button.js.es6#L35>

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [March 25, 2015, 3:34pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/11 "2015-03-25T15:34:36Z")

</div>

Here’s a fix for this:

[https://github.com/discourse/discourse/commit/0c6faca7f432576809e3a4f5196a9d399fc981da](https://github.com/discourse/discourse/commit/0c6faca7f432576809e3a4f5196a9d399fc981da)

---

<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: [March 25, 2015, 4:29pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/12 "2015-03-25T16:29:51Z")

</div>

I wonder where the `undefined-renamed` query parameters are coming from?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [March 25, 2015, 4:36pm UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/13 "2015-03-25T16:36:35Z")

</div>

Me too. I didn’t have time to dive deep into it today but it should be figured out.

---

<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: [December 6, 2015, 10:10am UTC](https://meta.discourse.org/t/error-when-trying-to-view-an-email-from-a-users-preference-page/26724/14 "2015-12-06T10:10:18Z")

</div>


