Skip to content

Commit

Permalink
Merge pull request #8315 from RocketChat/message-actions-popover
Browse files Browse the repository at this point in the history
[FIX] Put delete action on another popover group
  • Loading branch information
rodrigok committed Sep 29, 2017
1 parent 5114ce8 commit b0c7fd0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-lib/client/MessageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Meteor.startup(function() {
icon: 'trash',
label: 'Delete',
context: ['message', 'message-mobile'],
color: 'alert',
action() {
const message = this._arguments[1];
chatMessages[Session.get('openedRoom')].confirmDeleteMsg(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
font-size: var(--popover-item-text-size);
align-items: center;

&--error {
&--alert {
color: var(--color-error);

& .rc-icon {
Expand Down
16 changes: 9 additions & 7 deletions packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,24 +547,26 @@ Template.room.events({
}

const [, message] = this._arguments;
const items = RocketChat.MessageAction.getButtons(message, context, 'menu').map(item => {
const allItems = RocketChat.MessageAction.getButtons(message, context, 'menu').map(item => {
return {
icon: item.icon,
name: t(item.label),
type: 'message-action',
id: item.id,
modifier: item.id === 'delete-message' ? 'error' : null
modifier: item.color
};
});
const [items, deleteItem] = allItems.reduce((result, value) => (result[value.id === 'delete-message' ? 1 : 0].push(value), result), [[], []]);
const groups = [{ items }];

if (deleteItem.length) {
groups.push({ items: deleteItem });
}

const config = {
columns: [
{
groups: [
{
items
}
]
groups
}
],
instance: i,
Expand Down

0 comments on commit b0c7fd0

Please sign in to comment.