summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/channel_members_modal.jsx8
-rw-r--r--web/react/components/file_attachment.jsx110
-rw-r--r--web/react/components/suggestion/search_suggestion_list.jsx2
-rw-r--r--web/react/components/textbox.jsx51
-rw-r--r--web/react/components/user_list_row.jsx4
5 files changed, 63 insertions, 112 deletions
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/file_attachment.jsx b/web/react/components/file_attachment.jsx
index 810f90b13..819638676 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);
@@ -167,71 +129,15 @@ class FileAttachment extends React.Component {
var fileUrl = utils.getFileUrl(filename);
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/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 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) => {