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

Starred message can't be re-starred after the first time until client is refreshed #3876

Closed
danielbressan opened this issue Jul 28, 2016 · 2 comments · Fixed by #6861
Closed
Assignees
Milestone

Comments

@danielbressan
Copy link
Contributor

Rocket.Chat version: 0.35.0

If you star and unstar a message, the star stays filled and can't be starred again until the client refreshes.

@danielbressan
Copy link
Contributor Author

danielbressan commented Aug 31, 2016

Finally found some time to take a look at this. There were two problems:

  1. After starring and unstarring, if you're the only one that starred the message, it leaves a blank array which is truthy. In the star-message "MessageAction" validation - "and not message.starred" will always be false then.

  2. In the same situation if you're not the only person to star the message, the array will contain everyone who starred, which again will resolve false in validation.

Not sure if it's the best fix, but these lines can be added in star validation:

if message.starred and message.starred.length < 1 #for when you're the only person to star
    message.starred = undefined
else if (!(Array.isArray(message.starred))) 
    #for a page refresh, a single person star is an object not an array, so do nothing
else if (_.chain(message.starred).pluck("_id").indexOf(Meteor.userId()).value() < 0) #for when others have it starred
    message.starred = undefined

@MartinSchoeler
Copy link
Contributor

@karlprieb this still happens on demo server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants