Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/message-pin/client/actionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ Meteor.startup(function() {
label: 'Get_link',
classes: 'clipboard',
context: ['pinned'],
async action(event) {
async action() {
const { msg: message } = messageArgs(this);
$(event.currentTarget).attr('data-clipboard-text', await MessageAction.getPermaLink(message._id));
const permalink = await MessageAction.getPermaLink(message._id);
navigator.clipboard.writeText(permalink);
toastr.success(TAPi18n.__('Copied'));
},
condition({ subscription }) {
Expand Down
5 changes: 3 additions & 2 deletions app/message-star/client/actionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ Meteor.startup(function() {
label: 'Get_link',
classes: 'clipboard',
context: ['starred', 'threads'],
async action(event) {
async action() {
const { msg: message } = messageArgs(this);
$(event.currentTarget).attr('data-clipboard-text', await MessageAction.getPermaLink(message._id));
const permalink = await MessageAction.getPermaLink(message._id);
navigator.clipboard.writeText(permalink);
toastr.success(TAPi18n.__('Copied'));
},
condition({ msg, subscription, u }) {
Expand Down
17 changes: 6 additions & 11 deletions app/ui-utils/client/lib/MessageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,14 @@ Meteor.startup(async function() {
label: 'Get_link',
classes: 'clipboard',
context: ['message', 'message-mobile', 'threads'],
async action(event) {
async action() {
const { msg: message } = messageArgs(this);
const permalink = await MessageAction.getPermaLink(message._id);
$(event.currentTarget).attr('data-clipboard-text', permalink);
navigator.clipboard.writeText(permalink);
toastr.success(TAPi18n.__('Copied'));
},
condition({ subscription }) {
if (subscription == null) {
return false;
}

return true;
return !!subscription;
},
order: 4,
group: 'menu',
Expand All @@ -239,9 +235,9 @@ Meteor.startup(async function() {
label: 'Copy',
classes: 'clipboard',
context: ['message', 'message-mobile', 'threads'],
action(event) {
action() {
const { msg: { msg } } = messageArgs(this);
$(event.currentTarget).attr('data-clipboard-text', msg);
navigator.clipboard.writeText(msg);
toastr.success(TAPi18n.__('Copied'));
},
condition({ subscription }) {
Expand All @@ -256,8 +252,7 @@ Meteor.startup(async function() {
icon: 'edit',
label: 'Edit',
context: ['message', 'message-mobile', 'threads'],
action(event) {
console.log(event);
action() {
const { msg } = messageArgs(this);
getChatMessagesFrom(msg).edit(document.getElementById(msg.tmid ? `thread-${ msg._id }` : msg._id));
},
Expand Down