Allow switching to private channels with /join command (#6579)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b0f32e3c19
Коммит
0f3bd85b8d
@@ -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}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Ссылка в новой задаче
Block a user