diff options
-rw-r--r-- | api/file.go | 2 | ||||
-rw-r--r-- | web/react/components/channel_members_modal.jsx | 8 | ||||
-rw-r--r-- | web/react/components/create_post.jsx | 8 | ||||
-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/invite_member_modal.jsx | 4 | ||||
-rw-r--r-- | web/react/components/suggestion/search_suggestion_list.jsx | 2 | ||||
-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 | ||||
-rw-r--r-- | web/static/i18n/en.json | 6 | ||||
-rw-r--r-- | web/static/i18n/es.json | 3 | ||||
-rw-r--r-- | web/static/i18n/pt.json | 4 |
13 files changed, 40 insertions, 138 deletions
diff --git a/api/file.go b/api/file.go index 5c983ea55..0011afd5b 100644 --- a/api/file.go +++ b/api/file.go @@ -52,7 +52,7 @@ const ( RotatedCCWMirrored = 7 RotatedCW = 8 - MaxImageSize = 4096 * 2160 // 4k resolution + MaxImageSize = 6048 * 4032 // 24 megapixels, roughly 36MB as a raw image ) var fileInfoCache *utils.Cache = utils.NewLru(1000) 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 cbd23d804..62319b1a7 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -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/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/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/user_list_row.jsx b/web/react/components/user_list_row.jsx index 2aeca7d47..d75078619 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); diff --git a/web/static/i18n/en.json b/web/static/i18n/en.json index 03b21e944..6915f7d26 100644 --- a/web/static/i18n/en.json +++ b/web/static/i18n/en.json @@ -561,7 +561,7 @@ "channel_loader.wrote": " wrote: ", "channel_members_modal.addNew": " Add New Members", "channel_members_modal.close": "Close", - "channel_members_modal.removeMember": "Remove Member", + "channel_members_modal.remove": "Remove", "channel_memebers_modal.members": " Members", "channel_modal.cancel": "Cancel", "channel_modal.channel": "Channel", @@ -966,7 +966,7 @@ "sso_signup.team_error": "Please enter a team name", "suggestion.mention.all": "Notifies everyone in the team", "suggestion.mention.channel": "Notifies everyone in the channel", - "suggestion.search.private": "Public Groups", + "suggestion.search.private": "Private Groups", "suggestion.search.public": "Public Channels", "team_export_tab.download": "download", "team_export_tab.export": "Export", @@ -1295,4 +1295,4 @@ "view_image_popover.download": "Download", "view_image_popover.file": "File {count} of {total}", "view_image_popover.publicLink": "Get Public Link" -}
\ No newline at end of file +} diff --git a/web/static/i18n/es.json b/web/static/i18n/es.json index 77779847f..091b1e846 100644 --- a/web/static/i18n/es.json +++ b/web/static/i18n/es.json @@ -561,7 +561,6 @@ "channel_loader.wrote": " escribió: ", "channel_members_modal.addNew": " Agregar nuevos Miembros", "channel_members_modal.close": "Cerrar", - "channel_members_modal.removeMember": "Elminar Miembro", "channel_memebers_modal.members": " Miembros", "channel_modal.cancel": "Cancelar", "channel_modal.channel": "Canal", @@ -1289,4 +1288,4 @@ "view_image_popover.download": "Descargar", "view_image_popover.file": "Archivo {count} de {total}", "view_image_popover.publicLink": "Obtener Enlace Público" -}
\ No newline at end of file +} diff --git a/web/static/i18n/pt.json b/web/static/i18n/pt.json index c38ae86c6..99ef71b35 100644 --- a/web/static/i18n/pt.json +++ b/web/static/i18n/pt.json @@ -558,7 +558,6 @@ "channel_loader.wrote": " escreveu: ", "channel_members_modal.addNew": " Adicionar Novos Membros", "channel_members_modal.close": "Fechar", - "channel_members_modal.removeMember": "Remover Membro", "channel_memebers_modal.members": " Membros", "channel_modal.cancel": "Cancelar", "channel_modal.channel": "Canal", @@ -961,7 +960,6 @@ "sso_signup.team_error": "Por favor entre o nome da equipe", "suggestion.mention.all": "Notificar todo mundo na equipe", "suggestion.mention.channel": "Notifica todos no canal", - "suggestion.search.private": "Grupos Públicos", "suggestion.search.public": "Canais Públicos", "team_export_tab.download": "download", "team_export_tab.export": "Exportar", @@ -1290,4 +1288,4 @@ "view_image_popover.download": "Download", "view_image_popover.file": "Arquivo {count} de {total}", "view_image_popover.publicLink": "Obter O Link Público" -}
\ No newline at end of file +} |