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

[IMPROVE] User gets feedback when a message has been starred or unstarred #13860

Merged
merged 2 commits into from
Mar 18, 2020
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
10 changes: 10 additions & 0 deletions app/message-star/client/starMessage.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import { Meteor } from 'meteor/meteor';
import { settings } from '../../settings';
import { ChatMessage, Subscriptions } from '../../models';
import toastr from 'toastr';
import { TAPi18n } from 'meteor/tap:i18n';

Meteor.methods({
starMessage(message) {
if (!Meteor.userId()) {
toastr.error(TAPi18n.__('error-starring-message'));
return false;
}
if (Subscriptions.findOne({ rid: message.rid }) == null) {
toastr.error(TAPi18n.__('error-starring-message'));
return false;
}
if (!settings.get('Message_AllowStarring')) {
toastr.error(TAPi18n.__('error-starring-message'));
return false;
}
if (message.starred) {
toastr.success(TAPi18n.__('Message_has_been_starred'));
} else {
toastr.success(TAPi18n.__('Message_has_been_unstarred'));
}
return ChatMessage.update({
_id: message._id,
}, {
Expand Down
5 changes: 4 additions & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@
"error-user-registration-disabled": "User registration is disabled",
"error-user-registration-secret": "User registration is only allowed via Secret URL",
"error-you-are-last-owner": "You are the last owner. Please set new owner before leaving the room.",
"error-starring-message": "Message could not be stared",
"Error_404": "Error:404",
"Error_changing_password": "Error changing password",
"Error_loading_pages": "Error loading pages",
Expand Down Expand Up @@ -1957,6 +1958,8 @@
"Message_GlobalSearch": "Global Search",
"Message_GroupingPeriod": "Grouping Period (in seconds)",
"Message_GroupingPeriodDescription": "Messages will be grouped with previous message if both are from the same user and the elapsed time was less than the informed time in seconds.",
"Message_has_been_starred": "Message has been starred",
"Message_has_been_unstarred": "Message has been unstarred",
"Message_HideType_au": "Hide \"User Added\" messages",
"Message_HideType_mute_unmute": "Hide \"User Muted / Unmuted\" messages",
"Message_HideType_ru": "Hide \"User Removed\" messages",
Expand Down Expand Up @@ -3177,4 +3180,4 @@
"Your_question": "Your question",
"Your_server_link": "Your server link",
"Your_workspace_is_ready": "Your workspace is ready to use 🎉"
}
}