diff options
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/admin_console/license_settings.jsx | 7 | ||||
-rw-r--r-- | web/react/components/channel_members_modal.jsx | 8 | ||||
-rw-r--r-- | web/react/components/create_post.jsx | 10 | ||||
-rw-r--r-- | web/react/components/file_attachment.jsx | 112 | ||||
-rw-r--r-- | web/react/components/file_upload.jsx | 10 | ||||
-rw-r--r-- | web/react/components/get_link_modal.jsx | 23 | ||||
-rw-r--r-- | web/react/components/get_team_invite_link_modal.jsx | 4 | ||||
-rw-r--r-- | web/react/components/invite_member_modal.jsx | 4 | ||||
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 2 | ||||
-rw-r--r-- | web/react/components/suggestion/search_suggestion_list.jsx | 2 | ||||
-rw-r--r-- | web/react/components/textbox.jsx | 51 | ||||
-rw-r--r-- | web/react/components/user_list_row.jsx | 4 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_modal.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/text_formatting.jsx | 13 |
14 files changed, 97 insertions, 155 deletions
diff --git a/web/react/components/admin_console/license_settings.jsx b/web/react/components/admin_console/license_settings.jsx index fdbe912ef..d4dfa13f2 100644 --- a/web/react/components/admin_console/license_settings.jsx +++ b/web/react/components/admin_console/license_settings.jsx @@ -120,8 +120,7 @@ class LicenseSettings extends React.Component { expires: Utils.displayDate(parseInt(global.window.mm_license.ExpiresAt, 10)), ldap: global.window.mm_license.LDAP }} - defaultMessage='<div><p>This compiled release of Mattermost platform is provided under a <a href="http://mattermost.com" target="_blank">commercial license</a> - from Mattermost, Inc. based on your subscription level and is subject to the <a href="{terms}" target="_blank">Terms of Service.</a></p> + defaultMessage='<div><p>This compiled release of Mattermost platform is provided under a <a href="http://mattermost.com" target="_blank">commercial license</a> from Mattermost, Inc. based on your subscription level and is subject to the <a href="{terms}" target="_blank">Terms of Service.</a></p> <p>Your subscription details are as follows:</p> Name: {name}<br /> Company or organization name: {company}<br/> @@ -152,9 +151,7 @@ class LicenseSettings extends React.Component { <p className='help-text'> <FormattedHTMLMessage id='admin.licence.keyMigration' - defaultMessage='If you’re migrating servers you may need to remove your license key from this server in order to install it on a new server. To start, - <a href="http://mattermost.com" target="_blank">disable all Enterprise Edition features on this server</a>. - This will enable the ability to remove the license key and downgrade this server from Enterprise Edition to Team Edition.' + defaultMessage='If you’re migrating servers you may need to remove your license key from this server in order to install it on a new server. To start, <a href="http://mattermost.com" target="_blank">disable all Enterprise Edition features on this server</a>. This will enable the ability to remove the license key and downgrade this server from Enterprise Edition to Team Edition.' /> </p> </div> diff --git a/web/react/components/channel_members_modal.jsx b/web/react/components/channel_members_modal.jsx index 688ab7dd2..3ec93a616 100644 --- a/web/react/components/channel_members_modal.jsx +++ b/web/react/components/channel_members_modal.jsx @@ -44,6 +44,7 @@ export default class ChannelMembersModal extends React.Component { } getStateFromStores() { const extraInfo = ChannelStore.getCurrentExtraInfo(); + const profiles = UserStore.getActiveOnlyProfiles(); if (extraInfo.member_count !== extraInfo.members.length) { AsyncClient.getChannelExtraInfo(this.props.channel.id, -1); @@ -53,9 +54,8 @@ export default class ChannelMembersModal extends React.Component { }; } - // clone the member list since we mutate it later on const memberList = extraInfo.members.map((member) => { - return Object.assign({}, member); + return profiles[member.id]; }); function compareByUsername(a, b) { @@ -130,8 +130,8 @@ export default class ChannelMembersModal extends React.Component { onClick={this.handleRemove.bind(this, user)} > <FormattedMessage - id='channel_members_modal.removeMember' - defaultMessage='Remove Member' + id='channel_members_modal.remove' + defaultMessage='Remove' /> </button> ); diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index 9d7a19554..62319b1a7 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -130,7 +130,7 @@ class CreatePost extends React.Component { post.message, false, (data) => { - PostStore.storeDraft(data.channel_id, null); + PostStore.storeDraft(this.state.channelId, null); this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null}); if (data.goto_location && data.goto_location.length > 0) { @@ -262,9 +262,7 @@ class CreatePost extends React.Component { message = err.message; } - if (clientId === -1) { - this.setState({serverError: message}); - } else { + if (clientId !== -1) { const draft = PostStore.getDraft(this.state.channelId); const index = draft.uploadsInProgress.indexOf(clientId); @@ -274,8 +272,10 @@ class CreatePost extends React.Component { PostStore.storeDraft(this.state.channelId, draft); - this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: message}); + this.setState({uploadsInProgress: draft.uploadsInProgress}); } + + this.setState({serverError: message}); } removePreview(id) { const previews = Object.assign([], this.state.previews); diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index 810f90b13..6aeae638f 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -19,12 +19,10 @@ class FileAttachment extends React.Component { super(props); this.loadFiles = this.loadFiles.bind(this); - this.playGif = this.playGif.bind(this); - this.stopGif = this.stopGif.bind(this); this.addBackgroundImage = this.addBackgroundImage.bind(this); this.canSetState = false; - this.state = {fileSize: -1, mime: '', playing: false, loading: false, format: ''}; + this.state = {fileSize: -1}; } componentDidMount() { this.loadFiles(); @@ -95,42 +93,6 @@ class FileAttachment extends React.Component { return true; } - playGif(e, filename) { - var img = new Image(); - var fileUrl = utils.getFileUrl(filename); - - this.setState({loading: true}); - img.load(fileUrl); - img.onload = () => { - var state = {playing: true, loading: false}; - - switch (true) { - case img.width > img.height: - state.format = 'landscape'; - break; - case img.height > img.width: - state.format = 'portrait'; - break; - default: - state.format = 'quadrat'; - break; - } - - this.setState(state); - - // keep displaying background image for a short moment while browser is - // loading gif, to prevent white background flashing through - setTimeout(() => this.removeBackgroundImage.bind(this)(filename), 100); - }; - img.onError = () => this.setState({loading: false}); - - e.stopPropagation(); - } - stopGif(e, filename) { - this.setState({playing: false}); - this.addBackgroundImage(filename); - e.stopPropagation(); - } getFileInfoFromName(name) { var fileInfo = utils.splitFileLocation(name); @@ -164,74 +126,18 @@ class FileAttachment extends React.Component { var filename = this.props.filename; var fileInfo = utils.splitFileLocation(filename); - var fileUrl = utils.getFileUrl(filename); + var fileUrl = utils.getFileUrl(filename, true); var type = utils.getFileType(fileInfo.ext); - var playbackControls = ''; - var loadedFile = ''; - var loadingIndicator = ''; - if (this.state.mime === 'image/gif') { - playbackControls = ( - <div - className='file-playback-controls play' - onClick={(e) => this.playGif(e, filename)} - > - {"►"} - </div> - ); - } - if (this.state.playing) { - loadedFile = ( - <img - className={'file__loaded ' + this.state.format} - src={fileUrl} - /> - ); - playbackControls = ( + var thumbnail; + if (type === 'image') { + thumbnail = ( <div - className='file-playback-controls stop' - onClick={(e) => this.stopGif(e, filename)} - > - {"■"} - </div> - ); - } - if (this.state.loading) { - loadingIndicator = ( - <img - className='spinner file__loading' - src='/static/images/load.gif' + ref={filename} + className='post__load' + style={{backgroundImage: 'url(/static/images/load.gif)'}} /> ); - playbackControls = ''; - } - - var thumbnail; - if (type === 'image') { - if (this.state.playing) { - thumbnail = ( - <div - ref={filename} - className='post__load' - style={{backgroundImage: 'url(/static/images/load.gif)'}} - > - {playbackControls} - {loadedFile} - </div> - ); - } else { - thumbnail = ( - <div - ref={filename} - className='post__load' - style={{backgroundImage: 'url(/static/images/load.gif)'}} - > - {loadingIndicator} - {playbackControls} - {loadedFile} - </div> - ); - } } else { thumbnail = <div className={'file-icon ' + utils.getIconClassName(type)}/>; } @@ -242,7 +148,7 @@ class FileAttachment extends React.Component { filename, function success(data) { if (this.canSetState) { - this.setState({fileSize: parseInt(data.size, 10), mime: data.mime}); + this.setState({fileSize: parseInt(data.size, 10)}); } }.bind(this), function error() { diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx index cb8ede51b..f8965e13e 100644 --- a/web/react/components/file_upload.jsx +++ b/web/react/components/file_upload.jsx @@ -108,12 +108,12 @@ class FileUpload extends React.Component { } } - handleChange() { - var element = $(ReactDOM.findDOMNode(this.refs.fileInput)); + handleChange(e) { + if (e.target.files.length > 0) { + this.uploadFiles(e.target.files); - this.uploadFiles(element.prop('files')); - - Utils.clearFileInput(element[0]); + Utils.clearFileInput(e.target); + } } handleDrop(e) { diff --git a/web/react/components/get_link_modal.jsx b/web/react/components/get_link_modal.jsx index 6a5c3b588..3309d690c 100644 --- a/web/react/components/get_link_modal.jsx +++ b/web/react/components/get_link_modal.jsx @@ -41,8 +41,6 @@ export default class GetLinkModal extends React.Component { } render() { - const userCreationEnabled = global.window.mm_config.EnableUserCreation === 'true'; - let helpText = null; if (this.props.helpText) { helpText = ( @@ -55,7 +53,7 @@ export default class GetLinkModal extends React.Component { } let copyLink = null; - if (userCreationEnabled && document.queryCommandSupported('copy')) { + if (document.queryCommandSupported('copy')) { copyLink = ( <button data-copy-btn='true' @@ -71,17 +69,14 @@ export default class GetLinkModal extends React.Component { ); } - let linkText = null; - if (userCreationEnabled) { - linkText = ( - <textarea - className='form-control no-resize min-height' - readOnly='true' - ref='textarea' - value={this.props.link} - /> - ); - } + const linkText = ( + <textarea + className='form-control no-resize min-height' + readOnly='true' + ref='textarea' + value={this.props.link} + /> + ); var copyLinkConfirm = null; if (this.state.copiedLink) { diff --git a/web/react/components/get_team_invite_link_modal.jsx b/web/react/components/get_team_invite_link_modal.jsx index 299729250..ba6164dbf 100644 --- a/web/react/components/get_team_invite_link_modal.jsx +++ b/web/react/components/get_team_invite_link_modal.jsx @@ -15,7 +15,7 @@ const holders = defineMessages({ }, help: { id: 'get_team_invite_link_modal.help', - defaultMessage: 'Send teammates the link below for them to sign-up to this team site.' + defaultMessage: 'Send teammates the link below for them to sign-up to this team site. The Team Invite Link can be shared with multiple teammates as it does not change unless it\'s regenerated in Team Settings by a Team Admin.' }, helpDisabled: { id: 'get_team_invite_link_modal.helpDisabled', @@ -73,4 +73,4 @@ GetTeamInviteLinkModal.propTypes = { intl: intlShape.isRequired }; -export default injectIntl(GetTeamInviteLinkModal);
\ No newline at end of file +export default injectIntl(GetTeamInviteLinkModal); diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx index 0c0330c40..184ba1357 100644 --- a/web/react/components/invite_member_modal.jsx +++ b/web/react/components/invite_member_modal.jsx @@ -495,7 +495,7 @@ class InviteMemberModal extends React.Component { <ConfirmModal title={formatMessage(holders.modalTitle)} message={formatMessage(holders.modalMessage)} - confirm_button={formatMessage(holders.modalButton)} + confirmButton={formatMessage(holders.modalButton)} show={this.state.showConfirmModal} onConfirm={this.handleHide.bind(this, false)} onCancel={() => this.setState({showConfirmModal: false})} @@ -512,4 +512,4 @@ InviteMemberModal.propTypes = { intl: intlShape.isRequired }; -export default injectIntl(InviteMemberModal);
\ No newline at end of file +export default injectIntl(InviteMemberModal); diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index e9df03c33..0ddd6ff4f 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -107,7 +107,7 @@ export default class NavbarDropdown extends React.Component { </li> ); - if (this.props.teamType === Constants.OPEN_TEAM) { + if (this.props.teamType === Constants.OPEN_TEAM && global.window.mm_config.EnableUserCreation === 'true') { teamLink = ( <li> <a diff --git a/web/react/components/suggestion/search_suggestion_list.jsx b/web/react/components/suggestion/search_suggestion_list.jsx index 40f5d8777..60a5562fa 100644 --- a/web/react/components/suggestion/search_suggestion_list.jsx +++ b/web/react/components/suggestion/search_suggestion_list.jsx @@ -30,7 +30,7 @@ export default class SearchSuggestionList extends SuggestionList { text = ( <FormattedMessage id='suggestion.search.private' - defaultMessage='Public Groups' + defaultMessage='Private Groups' /> ); } diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index 23ecfb57b..c119abcbc 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -129,12 +129,12 @@ export default class Textbox extends React.Component { } render() { + const hasText = this.props.messageText.length > 0; + let previewLink = null; if (Utils.isFeatureEnabled(PreReleaseFeatures.MARKDOWN_PREVIEW)) { - const previewLinkVisible = this.props.messageText.length > 0; previewLink = ( <a - style={{visibility: previewLinkVisible ? 'visible' : 'hidden'}} onClick={this.showPreview} className='textbox-preview-link' > @@ -153,6 +153,51 @@ export default class Textbox extends React.Component { ); } + let helpText = ( + <div + style={{visibility: hasText ? 'visible' : 'hidden', opacity: hasText ? '1' : '0'}} + className='help_format_text' + > + <b> + <FormattedMessage + id='textbox.bold' + defaultMessage='**bold**' + /> + </b> + <i> + <FormattedMessage + id='textbox.italic' + defaultMessage='_italic_' + /> + </i> + <span>~~<strike> + <FormattedMessage + id='textbox.strike' + defaultMessage='strike' + /> + </strike>~~ </span> + <code> + <FormattedMessage + id='textbox.inlinecode' + defaultMessage='`inline code`' + /> + </code> + <code> + <FormattedMessage + id='textbox.preformatted' + defaultMessage='```preformatted```' + /> + </code> + <span> + <FormattedMessage + id='textbox.quote' + defaultMessage='>quote' + /> + </span> + {previewLink} + </div> + ); + return ( <div ref='wrapper' @@ -184,7 +229,7 @@ export default class Textbox extends React.Component { dangerouslySetInnerHTML={{__html: this.state.preview ? TextFormatting.formatText(this.props.messageText) : ''}} > </div> - {previewLink} + {helpText} <a target='_blank' href='http://docs.mattermost.com/help/getting-started/messaging-basics.html' diff --git a/web/react/components/user_list_row.jsx b/web/react/components/user_list_row.jsx index 68b723f35..d8442e770 100644 --- a/web/react/components/user_list_row.jsx +++ b/web/react/components/user_list_row.jsx @@ -10,9 +10,9 @@ export default function UserListRow({user, actions}) { let name = user.username; if (user.nickname && nameFormat === Constants.Preferences.DISPLAY_PREFER_NICKNAME) { - name = `${user.nickname} (${user.username})`; + name = `${user.nickname} (@${user.username})`; } else if ((user.first_name || user.last_name) && (nameFormat === Constants.Preferences.DISPLAY_PREFER_NICKNAME || nameFormat === Constants.Preferences.DISPLAY_PREFER_FULL_NAME)) { - name = `${Utils.getFullName(user)} (${user.username})`; + name = `${Utils.getFullName(user)} (@${user.username})`; } const buttons = actions.map((Action, index) => { diff --git a/web/react/components/user_settings/user_settings_modal.jsx b/web/react/components/user_settings/user_settings_modal.jsx index 80d03d88e..fa3415988 100644 --- a/web/react/components/user_settings/user_settings_modal.jsx +++ b/web/react/components/user_settings/user_settings_modal.jsx @@ -309,7 +309,7 @@ class UserSettingsModal extends React.Component { <ConfirmModal title={formatMessage(holders.confirmTitle)} message={formatMessage(holders.confirmMsg)} - confirm_button={formatMessage(holders.confirmBtns)} + confirmButton={formatMessage(holders.confirmBtns)} show={this.state.showConfirmModal} onConfirm={this.handleConfirm} onCancel={this.handleCancelConfirmation} diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index dae2252a6..a930e9ece 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -123,14 +123,13 @@ function autolinkAtMentions(text, tokens) { return (Constants.SPECIAL_MENTIONS.indexOf(u) !== -1 || UserStore.getProfileByUsername(u)); } - function addToken(username, mention, extraText) { + function addToken(username, mention) { const index = tokens.size; const alias = `MM_ATMENTION${index}`; tokens.set(alias, { value: `<a class='mention-link' href='#' data-mention='${username}'>${mention}</a>`, - originalText: mention, - extraText + originalText: mention }); return alias; } @@ -152,9 +151,9 @@ function autolinkAtMentions(text, tokens) { usernameLower = usernameLower.substring(0, c - 1); if (mentionExists(usernameLower)) { - const extraText = originalUsername.substr(c - 1); - const alias = addToken(usernameLower, '@' + usernameLower, extraText); - return alias; + const suffix = originalUsername.substr(c - 1); + const alias = addToken(usernameLower, '@' + usernameLower); + return alias + suffix; } } else { // If the last character is not punctuation, no point in going any further @@ -188,7 +187,7 @@ function highlightCurrentMentions(text, tokens) { const newAlias = `MM_SELFMENTION${index}`; newTokens.set(newAlias, { - value: `<span class='mention-highlight'>${alias}</span>` + (token.extraText || ''), + value: `<span class='mention-highlight'>${alias}</span>`, originalText: token.originalText }); output = output.replace(alias, newAlias); |