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

[FIX] Duplicated link to jump to message #14505

Merged
merged 2 commits into from
May 20, 2019
Merged
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
18 changes: 10 additions & 8 deletions app/message-star/client/actionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Meteor.startup(function() {
});
},
condition(message) {
if (Subscriptions.findOne({ rid: message.rid }) == null && settings.get('Message_AllowStarring')) {
if (Subscriptions.findOne({ rid: message.rid }) == null || !settings.get('Message_AllowStarring')) {
return false;
}

Expand All @@ -50,7 +50,7 @@ Meteor.startup(function() {
});
},
condition(message) {
if (Subscriptions.findOne({ rid: message.rid }) == null && settings.get('Message_AllowStarring')) {
if (Subscriptions.findOne({ rid: message.rid }) == null || !settings.get('Message_AllowStarring')) {
return false;
}

Expand All @@ -64,7 +64,7 @@ Meteor.startup(function() {
id: 'jump-to-star-message',
icon: 'jump',
label: 'Jump_to_message',
context: ['starred', 'threads'],
context: ['starred'],
action() {
const { msg: message } = messageArgs(this);
if (window.matchMedia('(max-width: 500px)').matches) {
Expand All @@ -73,10 +73,11 @@ Meteor.startup(function() {
RoomHistoryManager.getSurroundingMessages(message, 50);
},
condition(message) {
if (Subscriptions.findOne({ rid: message.rid }) == null) {
if (Subscriptions.findOne({ rid: message.rid }) == null || !settings.get('Message_AllowStarring')) {
return false;
}
return true;

return message.starred && message.starred.find((star) => star._id === Meteor.userId());
},
order: 100,
group: 'menu',
Expand All @@ -87,17 +88,18 @@ Meteor.startup(function() {
icon: 'permalink',
label: 'Get_link',
classes: 'clipboard',
context: ['starred', 'threads'],
context: ['starred'],
async action(event) {
const { msg: message } = messageArgs(this);
$(event.currentTarget).attr('data-clipboard-text', await MessageAction.getPermaLink(message._id));
toastr.success(TAPi18n.__('Copied'));
},
condition(message) {
if (Subscriptions.findOne({ rid: message.rid }) == null) {
if (Subscriptions.findOne({ rid: message.rid }) == null || !settings.get('Message_AllowStarring')) {
return false;
}
return true;

return message.starred && message.starred.find((star) => star._id === Meteor.userId());
},
order: 101,
group: 'menu',
Expand Down