chatroom icon indicating copy to clipboard operation
chatroom copied to clipboard

How to avoid showing button payload text in UI?

Open alex-movila opened this issue 5 years ago • 9 comments

Hi, After pressing button to reply the payload text is shown in the chat window. This happens in Chrome. Can I avoid this?

I use window.chatroom = new window.Chatroom

alex-movila avatar Jul 03 '19 14:07 alex-movila

I think this is the intended behavior. Currently, there is no way to disable the button response. Note, the only the button title should be displayed not the payload.

Feel free to submit a PR if you like to make this configurable.

hotzenklotz avatar Jul 03 '19 15:07 hotzenklotz

I get the payload not the title: /roger image

utter_ask_ok_quit: - text: "Choose" buttons: - title: "OK" payload: '/roger' - title: "Quit" payload: '/quit'

alex-movila avatar Jul 03 '19 15:07 alex-movila

Indeed, you are right. Looks like the payload is being send: https://github.com/scalableminds/chatroom/blob/master/src/ConnectedChatroom.js#L179

hotzenklotz avatar Jul 03 '19 16:07 hotzenklotz

It is normal to be sent but not normal to be rendered since for user is gibberish.

alex-movila avatar Jul 03 '19 16:07 alex-movila

I'm seeing this behavior but also one other issue shown i @alex-movila example above. The text "Choose" should show up before the two buttons.

rgstephens avatar Oct 14 '19 23:10 rgstephens

Just realized the text issue is addressed in 0.10.1, PR 112

rgstephens avatar Oct 15 '19 00:10 rgstephens

@rgstephens Just to clarify, the issue is fixed in version 0.10.1? If so, please close the issue. Thanks.

hotzenklotz avatar Oct 15 '19 07:10 hotzenklotz

I've updated now to 0.11.0 and the issue with the text not showing is fixed. However, the original problem reported by @alex-movila where the payload is displayed is still a problem in 0.11.0. As his example shows, the /roger payload is displayed after the user selects the button.

rgstephens avatar Oct 15 '19 16:10 rgstephens

Hi there, I might have a little workaround for you. I solved this by checking each message for a regex pattern in the Message.js (switch case "text"). Like this:

var dispMsg = message.text;
if (pattern.exec(message.text)) {
            dispMsg = replacement;
}

My pattern looks like this: /\/roger/g. The replacement string can be anything you want it to be... In the Markdown below just replace source={message.text} with source={dispMsg}.

fallik avatar Feb 12 '20 09:02 fallik