Skip to content

Message Action template logic bugs #11994

@timkinnane

Description

@timkinnane

See template here:
https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-message-action/client/messageAction.html

The render logic includes a number of conditions, that in my opinion are branching on the wrong attributes. Because all conditions are if and there's no else, multiple conditions could be true, leading to multiple buttons being rendered.

There's two main problems:

  1. if msg_in_chat_window is false or undefined, no button is rendered.

  2. If an action object contained all of image_url, url, msg_in_chat_window, text, you would get four buttons.

Obviously that's something the action sender should be mindful of, but the template should also help to avoid display errors.

In my usage, I was setting msg_in_chat_window as default true for all actions, to avoid the first issue, but then I would get two buttons if I also included a url.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions