Failing to get message.cooked for chat composer reply

I’m trying to create a blockquote-like style for the chat reply and I have it working for the chat message but not for the chat-composer-message-details.hbs.

This is chat-composer-message-details.hbs:

<div class="chat-composer-message-details">
  <div class="tc-reply-display">
    {{d-icon icon}}
    {{chat-user-avatar user=message.user}}
    <span class="tc-reply-username">{{message.user.username}}</span>
    <span class="tc-reply-msg">{{replace-emoji message.excerpt}}</span>
  </div>

  {{flat-button
    action=action
    class="cancel-message-action"
    icon="times-circle"
    title=title
  }}
</div>

And I’m trying to add this into it by overriding the template:

        <span class="tc-reply-msg">
            {{#if message.uploads.length}}
                <span class="tc-reply-uploads-icon">
                {{d-icon "camera"}}
                </span>
            {{/if}}
            
            {{#if message.cooked}}
                {{replace-emoji message.cooked}}
            {{else}}
                Photo
            {{/if}}
        </span>

And yet neither the message.cooked nor the message.uploads.length seems to find anything, even if the message to which I’m replying has text and/or an upload. When I put message.excerpt instead of message.cooked, the text shows, but only an excerpt of it and I’d like to see the full text.

I’m not sure how to debug the JSON object, if I put {{message}} it just shows [object Object].

Any ideas what might be happening or how I can better debug it?

1 Like

You can do {{log message}} and it will appear in your browser console.

I just want to warn you that chat is under lots of changes, so expect things to break if you are overriding templates.

1 Like

Ooo thank you!

Yes, I appreciate the warning. I stopped overriding them for a while but really really prefer a blockquote-like reply style so jumped back into it. I try to monitor the commits to see if the two templates I override get changed.

EDIT: For whatever reason, {{log message}} isn’t showing anything for me in the chat-composer-message-details.hbs or the chat-message.hbs overrides. It doesn’t show even if I put {{log 'this is a log'}}.

Any idea why the {{log}} helper doesn’t seem to work?

2 Likes