diff options
-rw-r--r-- | app/command_join.go | 6 | ||||
-rw-r--r-- | webapp/components/confirm_modal.jsx | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/command_join.go b/app/command_join.go index 9ad3682a1..caacb8c7e 100644 --- a/app/command_join.go +++ b/app/command_join.go @@ -40,8 +40,12 @@ func (me *JoinProvider) DoCommand(args *model.CommandArgs, message string) *mode channel := result.Data.(*model.Channel) if channel.Name == message { + allowed := false + if (channel.Type == model.CHANNEL_PRIVATE && SessionHasPermissionToChannel(args.Session, channel.Id, model.PERMISSION_READ_CHANNEL)) || channel.Type == model.CHANNEL_OPEN { + allowed = true + } - if channel.Type != model.CHANNEL_OPEN { + if !allowed { return &model.CommandResponse{Text: args.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } diff --git a/webapp/components/confirm_modal.jsx b/webapp/components/confirm_modal.jsx index 94f27a3e2..0adf06906 100644 --- a/webapp/components/confirm_modal.jsx +++ b/webapp/components/confirm_modal.jsx @@ -22,9 +22,7 @@ export default class ConfirmModal extends React.Component { } componentWillUnmount() { - if (!this.props.show) { - document.removeEventListener('keypress', this.handleKeypress); - } + document.removeEventListener('keypress', this.handleKeypress); } componentWillReceiveProps(nextProps) { |