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

AI-generated summary

A user, watchmanmonitor, encountered an error when trying to view a user’s email from their preference page after a recent update. The error, “Uncaught TypeError: undefined is not a function,” occurs when clicking the “Show Email” button. codinghorror was initially unable to reproduce the issue, but after receiving the steps to reproduce, was able to confirm the error. The issue seems to depend on the navigation path taken to reach the user’s preference page.

watchmanmonitor provided the steps to reproduce the issue, which includes navigating to the user’s preference page from the admin/users list or from a user’s activity page. codinghorror was able to reproduce the issue using the second set of steps.

zogstrip suggested a possible cause, referencing a similar issue they encountered when refactoring a button in the user’s preference template. eviltrout provided a fix for the issue, and zogstrip and eviltrout expressed curiosity about the origin of the “undefined-renamed” query parameters in the error URL.

I’ve recently updated one of the forums I’m working on. 944c0db

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:

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 their Full Name there. :grumpycat:

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

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.

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. :frowning: )

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

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.

  • 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
2 Me gusta
  • 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.

1 me gusta

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.

1 me gusta

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:

Here’s a fix for this:

https://github.com/discourse/discourse/commit/0c6faca7f432576809e3a4f5196a9d399fc981da

5 Me gusta

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

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

3 Me gusta