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] open conversation from room info #11050

Merged
merged 8 commits into from
Jun 13, 2018
Merged

Conversation

ggazzo
Copy link
Member

@ggazzo ggazzo commented Jun 7, 2018

Closes #11007

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11050 June 7, 2018 22:24 Inactive
@ggazzo ggazzo added this to Desireable in June/2018 via automation Jun 7, 2018
@ggazzo ggazzo added this to the 0.66.0 milestone Jun 7, 2018
@ggazzo ggazzo requested a review from gdelavald June 7, 2018 22:25
@ggazzo ggazzo changed the title [FIX ] open conversation from room info [FIX] open conversation from room info Jun 10, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-11050 June 10, 2018 19:12 Inactive
@@ -55,7 +55,8 @@ export const getActions = function({ user, directActions, hideAdminControls }) {
};
const canDirectMessage = (username) => {
const user = Meteor.user();
return RocketChat.authz.hasAllPermission('create-d') && user && user.username !== username;
const rid = Session.get('openedRoom');
return username && (!directActions && rid && RocketChat.models.Subscriptions.findOne({ rid }).name !== username) || (directActions && RocketChat.authz.hasAllPermission('create-d') && user && user.username !== username);
Copy link
Member

@sampaiodiego sampaiodiego Jun 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about describing what each conditions does assigning a new variable?

const whatThisDoes = (!directActions && rid && RocketChat.models.Subscriptions.findOne({ rid }).name !== username);
const whatThisDoesAsWell = (directActions && RocketChat.authz.hasAllPermission('create-d') && user && user.username !== username);

return username && whatThisDoes || whatThisDoesAsWell;

this will make the code easy to read and understand

@ggazzo ggazzo moved this from Desireable to Review/QA in June/2018 Jun 11, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-11050 June 12, 2018 00:04 Inactive
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-11050 June 12, 2018 01:55 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11050 June 12, 2018 03:16 Inactive
gdelavald
gdelavald previously approved these changes Jun 12, 2018
@ggazzo ggazzo moved this from Review/QA to Ready to merge in June/2018 Jun 12, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-11050 June 12, 2018 21:28 Inactive
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-11050 June 13, 2018 17:46 Inactive
@ggazzo ggazzo merged commit db0edc4 into develop Jun 13, 2018
June/2018 automation moved this from Ready to merge to Closed Jun 13, 2018
@ggazzo ggazzo deleted the open-conversation-from-user-info branch June 13, 2018 22:12
@rodrigok rodrigok mentioned this pull request Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
June/2018
  
Closed
Development

Successfully merging this pull request may close these issues.

Clicking a user mention on a direct message should enable you to open a new direct message with that user
4 participants