# Canned responses randomly not working (Discourse 2.2)

**URL:** https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867
**Category:** Support
**Created:** [11.Февраль.2019 20:19:11 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867 "2019-02-11T20:19:11Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [11.Февраль.2019 20:19:11 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/1 "2019-02-11T20:19:11Z")

</div>

Didn’t investigate as I don’t have the know how. But I do know that ever since I’ve installed 2.2.1 when I click on a canned response nothing happens. This happens randomly, I can’t replicate it at will. Sometimes they work, sometimes they don’t. I have to reload the whole site for it to work.

This is what shows up in the console:

TypeError: i.get(“topic.posters”)[0].user.get is not a function. (In ‘i.get(“topic.posters”)[0].user.get(“username”)’, ‘i.get(“topic.posters”)[0].user.get’ is undefined)

```
Uncaught TypeError: i.get(...)[0].user.get is not a function
    at e.default (plugin-7414be04de5897403a5c16f2d50f60ddba9e5725993124e89d0a9ae3f0942a92.js:1)
    at n.apply (plugin-7414be04de5897403a5c16f2d50f60ddba9e5725993124e89d0a9ae3f0942a92.js:1)
    at n.send (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:16)
    at n [as send] (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:15)
    at n.triggerAction (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:15)
    at n.s [as sendAction] (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:16)
    at n.click (application-6157201f89cbc41715dde34af85ed4c9d799cece2e11aac8f0710af120c2affd.js:27)
    at n.trigger (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:16)
    at n [as trigger] (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:15)
    at e._run (ember_jquery-cf9339810550f9c92505dfbb37362c58a4a8a83bcee2d99174547b01c06ed7d3.js:9)

```

No clue what that means 😃 Any guidance would be appreciated.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [11.Февраль.2019 21:43:37 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/2 "2019-02-11T21:43:37Z")

</div>

Are you still on 2.2.1, or have you now upgraded to 2.3?

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [11.Февраль.2019 22:06:52 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/3 "2019-02-11T22:06:52Z")

</div>

Still? I just upgraded to 2.2.1 😃 Can’t keep up with the updates. Have a few custom plugins so I don’t hop onto the newest versions right away.

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11.Февраль.2019 22:07:18 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/4 "2019-02-11T22:07:18Z")

</div>

Er they’ve been working for me…

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [11.Февраль.2019 22:18:46 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/5 "2019-02-11T22:18:46Z")

</div>

Yeah maybe it’s something on my end, I thought I’d share my problem to see if there is anyone else.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [11.Февраль.2019 22:26:34 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/6 "2019-02-11T22:26:34Z")

</div>

If you’re on tests-passed the first step is usually to get upgraded in case it was already reported and fixed.

I’m assuming you used the search already, 2.2 beta 1 is months old at this point, the chances of someone only noticing this issue now is quite slim.

---

<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: [12.Февраль.2019 01:19:04 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/7 "2019-02-12T01:19:04Z")

</div>



---

<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: [12.Февраль.2019 15:06:52 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/8 "2019-02-12T15:06:52Z")

</div>



---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [12.Февраль.2019 15:08:43 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/9 "2019-02-12T15:08:43Z")

</div>

Correction: @WorldIsMine is on 2.2.1 not 2.2 beta1. I somehow missed that and he missed my mention of tests-passed.

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [12.Февраль.2019 15:33:42 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/10 "2019-02-12T15:33:42Z")

</div>

Thank you for reopening. I will try to find a way to replicate it but it’s so random it’s not even funny. It can go hours without a problem, then for 30 min nothing but problems. And it’s been like that since the upgrade.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [12.Февраль.2019 15:41:52 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/11 "2019-02-12T15:41:52Z")

</div>

When the update was performed, no other plugins were updated, they were already at their latest version.  
Only procourse-static-pages was added but I doubt this has to do with anything.

Extra info: this only happens on PM’s.

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [12.Февраль.2019 15:43:41 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/12 "2019-02-12T15:43:41Z")

</div>

> [@RGJ](#):
>
> Only procourse-static-pages was added but I doubt this has to do with anything.

This happened prior to installing that plugin so it shouldn’t be that.  
As far as the PM claim, not 100% sure on that. It’s just that I use canned responses for mainly PM’s, but so far didn’t get a problem using them in topics, only PM’s. So for now we can assume it’s PM only but can’t totally rule out topics just yet.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [12.Февраль.2019 16:08:11 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/13 "2019-02-12T16:08:11Z")

</div>

> [@WorldIsMine](#):
>
> This happened prior to installing that plugin so it shouldn’t be that.

We did the upgrade to 2.2.1 and the installation of the procourse-static-pages at the same time.

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [14.Февраль.2019 21:30:37 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/14 "2019-02-14T21:30:37Z")

</div>

Still haven’t been able to replicate it. But, today I had another bug I’ve had since I’ve started using discourse. It’s rare, but it happens and it may be related. When I open up the composer and click the canned replies icon nothing happens, they just don’t open. The console gives me this: TypeError: undefined is not an object (evaluating ‘t.actions’)

This started happening a while ago.

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [15.Февраль.2019 19:00:18 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/15 "2019-02-15T19:00:18Z")

</div>

@RGJ

I’ve tried [safe mode](https://meta.discourse.org/t/53504?silent=true) like you’ve asked, turned off the custom theme + plugins. I only left the official plugins. The problem is still there and the console still throws:

Uncaught TypeError: i.get(…)[0].user.get is not a function  
It points to this piece of code:

```
  exports.default = function (replyId, replyTitle, replyContent, model) {
    // Replace variables with values.
    if (model) {
      var vars = {
        user: model.get("user.username"),
        original_poster: model.get("topic.posters") ? model.get("topic.posters")[0].user.get("username") : "",
        reply_to: model.get("post.reply_to_user.username"),
        last_user: model.get("topic.last_poster_username"),
        reply_to_or_last: model.get("post.reply_to_user.username") || model.get("topic.last_poster_username")
      };

      for (var key in vars) {
        if (vars[key]) {
          replyTitle = replyTitle.replace("%{" + key + "}", vars[key]);
          replyContent = replyContent.replace("%{" + key + "}", vars[key]);
        }

```

Again, this only happens in PMs (so far).  
My question is, is the safe-mode a reliable way to test? I mean, since I’ve disabled my custom plugins and theme and was able to encounter this error, then I am in the clear and something else is up, right?

EDIT: Like I’ve said before, can’t replicate this at will. But it happens in PM’s where there are usually more than two people invited.

EDIT2: I am on 2.2.1 so not sure why someone changed the topic to “previous version”.

EDIT3: Nevermind.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [19.Февраль.2019 10:41:08 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/16 "2019-02-19T10:41:08Z")

</div>

> [@WorldIsMine](#):
>
> Updated to 2.2.2

2.2.2 is not yet there but you are at [latest stable](https://github.com/discourse/discourse/commit/c10941bbde5a423252b193eb5b32de587cf70835) now.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [19.Февраль.2019 13:01:18 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/17 "2019-02-19T13:01:18Z")

</div>

> [@WorldIsMine](#):
>
> original\_poster: model.get(“topic.posters”) ? model.get(“topic.posters”)[0].user.get(“username”) : “”,

It seems that topic.posters is not set on PM’s, but apparently sometimes it is set but does not resolve to a user?

If you get this error, can you open up your Developer toolbar (Firefox/Chrome: F12 then Console and look for the \>\> prompt) and enter

```
c = Discourse. __container__.lookup("controller:composer")
c.topic.posters
c.topic.posters[0]

```

and copy/paste the output here?

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [19.Февраль.2019 14:15:32 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/18 "2019-02-19T14:15:32Z")

</div>

> [@RGJ](#):
>
> c = Discourse. **container**.lookup(“controller:composer”) c.topic.posters c.topic.posters[0]

I got this:

`{extras: "latest", description: "Original Poster, Most Recent Poster", user: {…}}`

Screenshot:

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

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [19.Февраль.2019 14:46:25 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/19 "2019-02-19T14:46:25Z")

</div>

Can you do

`c.topic.posters[0].user`

as well (after the other ones), and click the arrow in front of it before making a screenshot?

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [19.Февраль.2019 15:01:29 UTC](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867/20 "2019-02-19T15:01:29Z")

</div>

OK. I recall hitting the arrow but it didn’t open. Let me try again.

[Next page](https://meta.discourse.org/t/canned-responses-randomly-not-working-discourse-2-2/108867.md?page=2)
