Unpin and Unstar labels

This commit is contained in:
Diego Mello 2017-11-24 10:53:53 -02:00
parent 385867d36e
commit 1a32a43eb5
2 changed files with 4 additions and 3 deletions

View File

@ -88,6 +88,7 @@ export default class MessageActions extends React.Component {
async componentWillReceiveProps(nextProps) { async componentWillReceiveProps(nextProps) {
if (nextProps.showActions !== this.props.showActions && nextProps.showActions) { if (nextProps.showActions !== this.props.showActions && nextProps.showActions) {
const { actionMessage } = nextProps;
// Cancel // Cancel
this.options = ['Cancel']; this.options = ['Cancel'];
this.CANCEL_INDEX = 0; this.CANCEL_INDEX = 0;
@ -110,12 +111,12 @@ export default class MessageActions extends React.Component {
this.QUOTE_INDEX = this.options.length - 1; this.QUOTE_INDEX = this.options.length - 1;
// Star // Star
if (this.props.Message_AllowStarring) { if (this.props.Message_AllowStarring) {
this.options.push('Star'); this.options.push(actionMessage.starred ? 'Unstar' : 'Star');
this.STAR_INDEX = this.options.length - 1; this.STAR_INDEX = this.options.length - 1;
} }
// Pin // Pin
if (this.props.Message_AllowPinning) { if (this.props.Message_AllowPinning) {
this.options.push('Pin'); this.options.push(actionMessage.pinned ? 'Unpin' : 'Pin');
this.PIN_INDEX = this.options.length - 1; this.PIN_INDEX = this.options.length - 1;
} }
// Delete // Delete

View File

@ -70,7 +70,7 @@ const RocketChat = {
message.temp = false; message.temp = false;
message._server = server; message._server = server;
message.attachments = message.attachments || []; message.attachments = message.attachments || [];
message.starred = !!message.starred; message.starred = message.starred && message.starred.length > 0;
realm.create('messages', message, true); realm.create('messages', message, true);
}); });
} }