Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Add message action to copy message to input as reply #12626

Merged
4 changes: 2 additions & 2 deletions app/message-action/client/messageAction.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{/if}}

{{#if msg_in_chat_window}}
<button class="js-actionButton-sendMessage" value="{{msg}}">
<button class="{{jsActionButtonClassname msg_processing_type}}" value="{{msg}}">
<img class="image-button" src="{{image_url}}" />
</button>
{{/if}}
Expand All @@ -21,7 +21,7 @@
</a>
{{/if}}
{{#if msg_in_chat_window}}
<button class="text-button js-actionButton-sendMessage" value="{{msg}}">
<button class="text-button {{jsActionButtonClassname msg_processing_type}}" value="{{msg}}">
<span class="overflow-ellipsis">{{text}}</span>
</button>
{{/if}}
Expand Down
3 changes: 3 additions & 0 deletions app/message-action/client/messageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ Template.messageAction.helpers({
areButtonsHorizontal() {
return Template.parentData(1).button_alignment === 'horizontal';
},
jsActionButtonClassname(processingType) {
return `js-actionButton-${ processingType || 'sendMessage' }`;
},
});
12 changes: 12 additions & 0 deletions app/ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,18 @@ Template.room.events({
Meteor.call('sendMessage', msgObject);
});
},
'click .js-actionButton-respondWithMessage'(event) {
const msg = event.currentTarget.value;
if (!msg) {
return;
}

const { input } = chatMessages[RoomManager.openedRoom];
input.value = msg;
setTimeout(() => {
input.focus();
}, 5);
},
'click .js-navigate-to-discussion'(event) {
event.preventDefault();
const [, { drid }] = this._arguments;
Expand Down