[IMPROVE] Move Reply in Thread button from menu to message actions

pull/15685/head
Anton Kazarinov 6 years ago
parent d1ff7dd30a
commit 3c5de66ea3
  1. 12
      app/threads/client/messageAction/replyInThread.js
  2. 2
      app/ui-message/client/message.html
  3. 6
      app/ui-message/client/message.js
  4. 6
      tests/end-to-end/ui/06-messaging.js
  5. 2
      tests/pageobjects/main-content.page.js

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { Template } from 'meteor/templating';
import { settings } from '../../../settings/client';
import { MessageAction } from '../../../ui-utils/client';
@ -7,6 +8,15 @@ import { messageArgs } from '../../../ui-utils/client/lib/messageArgs';
import { chatMessages } from '../../../ui/client';
import { addMessageToList } from '../../../ui-utils/client/lib/MessageAction';
Template.room.events({
'click [data-message-action="reply-in-thread"]'(event, template) {
const button = MessageAction.getButtonById(event.currentTarget.dataset.messageAction);
if ((button != null ? button.action : undefined) != null) {
button.action.call(this, event, template);
}
},
});
Meteor.startup(function() {
Tracker.autorun(() => {
if (!settings.get('Threads_enabled')) {
@ -34,7 +44,7 @@ Meteor.startup(function() {
return Boolean(subscription);
},
order: 1,
group: 'menu',
group: 'message',
});
});
});

@ -128,7 +128,7 @@
<div class="message-actions__buttons">
{{#each action in messageActions 'message'}}
<button class="message-actions__button" data-message-action="{{action.id}}">
<button class="message-actions__button" data-message-action="{{action.id}}" title="{{action.label}}">
{{> icon block="message-actions__button-icon" icon=action.icon}}
</button>
{{/each}}

@ -405,7 +405,11 @@ Template.message.helpers({
context = 'message';
}
return MessageAction.getButtons(this, context, messageGroup);
return MessageAction.getButtons(this, context, messageGroup).map((item) => ({
icon: item.icon,
label: t(item.label),
id: item.id,
}));
},
isSnippet() {
const { msg } = this;

@ -107,10 +107,6 @@ function messageActionsTest() {
mainContent.messageActionMenu.isVisible().should.be.true;
});
it('it should show the reply action', () => {
mainContent.messageReply.isVisible().should.be.true;
});
it('it should show the edit action', () => {
mainContent.messageEdit.isVisible().should.be.true;
});
@ -157,7 +153,7 @@ function messageActionsTest() {
describe('[Usage]', () => {
describe('Reply:', () => {
before(() => {
mainContent.openMessageActionMenu();
mainContent.lastMessage.moveToObject();
});
it('it should reply the message', () => {
mainContent.selectAction('reply');

@ -60,7 +60,7 @@ class MainContent extends Page {
get messageActionMenu() { return browser.element('.rc-popover .rc-popover__content'); }
get messageReply() { return browser.element('[data-id="reply-in-thread"][data-type="message-action"]'); }
get messageReply() { return browser.element('.message:last-child .message-actions__button[data-message-action="reply-in-thread"]'); }
get messageEdit() { return browser.element('[data-id="edit-message"][data-type="message-action"]'); }

Loading…
Cancel
Save