diff options
-rw-r--r-- | api/slackimport.go | 11 | ||||
-rw-r--r-- | model/team.go | 2 | ||||
-rw-r--r-- | model/utils.go | 12 | ||||
-rw-r--r-- | store/sql_user_store.go | 2 | ||||
-rw-r--r-- | web/react/components/team_import_tab.jsx | 2 | ||||
-rw-r--r-- | web/react/components/view_image.jsx | 18 |
6 files changed, 40 insertions, 7 deletions
diff --git a/api/slackimport.go b/api/slackimport.go index 1d037a934..4e6c01dbb 100644 --- a/api/slackimport.go +++ b/api/slackimport.go @@ -50,6 +50,15 @@ func SlackConvertTimeStamp(ts string) int64 { return timeStamp * 1000 // Convert to milliseconds } +func SlackConvertChannelName(channelName string) string { + newName := strings.Trim(channelName, "_-") + if len(newName) == 1 { + return "slack-channel-" + newName + } + + return newName +} + func SlackParseChannels(data io.Reader) []SlackChannel { decoder := json.NewDecoder(data) @@ -172,7 +181,7 @@ func SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[str TeamId: teamId, Type: model.CHANNEL_OPEN, DisplayName: sChannel.Name, - Name: sChannel.Name, + Name: SlackConvertChannelName(sChannel.Name), Description: sChannel.Topic["value"], } mChannel := ImportChannel(&newChannel) diff --git a/model/team.go b/model/team.go index 6006f738c..8b4f82830 100644 --- a/model/team.go +++ b/model/team.go @@ -158,7 +158,7 @@ func IsReservedTeamName(s string) bool { func IsValidTeamName(s string) bool { - if !IsValidAlphaNum(s) { + if !IsValidAlphaNum(s, false) { return false } diff --git a/model/utils.go b/model/utils.go index 17d1c6317..d5122e805 100644 --- a/model/utils.go +++ b/model/utils.go @@ -202,7 +202,7 @@ func GetSubDomain(s string) (string, string) { func IsValidChannelIdentifier(s string) bool { - if !IsValidAlphaNum(s) { + if !IsValidAlphaNum(s, true) { return false } @@ -213,10 +213,16 @@ func IsValidChannelIdentifier(s string) bool { return true } +var validAlphaNumUnderscore = regexp.MustCompile(`^[a-z0-9]+([a-z\-\_0-9]+|(__)?)[a-z0-9]+$`) var validAlphaNum = regexp.MustCompile(`^[a-z0-9]+([a-z\-0-9]+|(__)?)[a-z0-9]+$`) -func IsValidAlphaNum(s string) bool { - match := validAlphaNum.MatchString(s) +func IsValidAlphaNum(s string, allowUnderscores bool) bool { + var match bool + if allowUnderscores { + match = validAlphaNumUnderscore.MatchString(s) + } else { + match = validAlphaNum.MatchString(s) + } if !match { return false diff --git a/store/sql_user_store.go b/store/sql_user_store.go index be1d29df0..52d670d56 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -74,7 +74,7 @@ func (us SqlUserStore) Save(user *model.User) StoreChannel { close(storeChannel) return } else if int(count) > utils.Cfg.TeamSettings.MaxUsersPerTeam { - result.Err = model.NewAppError("SqlUserStore.Save", "You've reached the limit of the number of allowed accounts.", "teamId="+user.TeamId) + result.Err = model.NewAppError("SqlUserStore.Save", "This team has reached the maxmium number of allowed accounts. Contact your systems administrator to set a higher limit.", "teamId="+user.TeamId) storeChannel <- result close(storeChannel) return diff --git a/web/react/components/team_import_tab.jsx b/web/react/components/team_import_tab.jsx index 031abc36a..8315430e4 100644 --- a/web/react/components/team_import_tab.jsx +++ b/web/react/components/team_import_tab.jsx @@ -35,7 +35,7 @@ export default class TeamImportTab extends React.Component { var uploadHelpText = ( <div> <p>{'Slack does not allow you to export files, images, private groups or direct messages stored in Slack. Therefore, Slack import to Mattermost only supports importing of text messages in your Slack team\'\s public channels.'}</p> - <p>{'The Slack import to Mattermost is in "Preview". Slack bot posts and channels with underscores do not yet import.'}</p> + <p>{'The Slack import to Mattermost is in "Preview". Slack bot posts do not yet import.'}</p> </div> ); diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx index b0eaba5d6..8d3495e3b 100644 --- a/web/react/components/view_image.jsx +++ b/web/react/components/view_image.jsx @@ -105,6 +105,14 @@ export default class ViewImageModal extends React.Component { this.loadImage(this.state.imgId); }.bind(this)); + $('#' + this.props.modalId).on('hidden.bs.modal', function onModalHide() { + if (this.refs.video) { + var video = React.findDOMNode(this.refs.video); + video.pause(); + video.currentTime = 0; + } + }.bind(this)); + $(React.findDOMNode(this.refs.modal)).click(function onModalClick(e) { if (e.target === this || e.target === React.findDOMNode(this.refs.imageBody)) { $('.image_modal').modal('hide'); @@ -211,6 +219,16 @@ export default class ViewImageModal extends React.Component { /> </a> ); + } else if (fileType === 'video' || fileType === 'audio') { + content = ( + <video + ref='video' + data-setup='{}' + controls='controls' + > + <source src={Utils.getWindowLocationOrigin() + '/api/v1/files/get' + filename} /> + </video> + ); } else { // non-image files include a section providing details about the file var infoString = 'File type ' + fileInfo.ext.toUpperCase(); |