Этот коммит содержится в:
Christopher Speller
2017-04-17 15:08:56 -04:00
родитель 742bab6429 3097453394
Коммит 92d8fa4aa8
47 изменённых файлов: 1250 добавлений и 1142 удалений

Просмотреть файл

@@ -96,7 +96,7 @@ export default class AdminSidebar extends React.Component {
title={
<FormattedMessage
id='admin.sidebar.cluster'
defaultMessage='High Availability (Beta)'
defaultMessage='High Availability'
/>
}
/>

Просмотреть файл

@@ -53,7 +53,7 @@ export default class ClusterSettings extends AdminSettings {
return (
<FormattedMessage
id='admin.advance.cluster'
defaultMessage='High Availability (Beta)'
defaultMessage='High Availability'
/>
);
}

Просмотреть файл

@@ -49,12 +49,12 @@ export default class ErrorBar extends React.Component {
const errorIgnored = ErrorStore.getIgnoreNotification();
if (!errorIgnored) {
if (global.mm_config.SendEmailNotifications === 'false') {
ErrorStore.storeLastError({notification: true, message: Utils.localizeMessage('error_bar.preview_mode', 'Preview Mode: Email notifications have not been configured')});
return;
} else if (isSystemAdmin && global.mm_config.SiteURL === '') {
if (isSystemAdmin && global.mm_config.SiteURL === '') {
ErrorStore.storeLastError({notification: true, message: SITE_URL_ERROR});
return;
} else if (global.mm_config.SendEmailNotifications === 'false') {
ErrorStore.storeLastError({notification: true, message: Utils.localizeMessage('error_bar.preview_mode', 'Preview Mode: Email notifications have not been configured')});
return;
}
}
@@ -178,10 +178,10 @@ export default class ErrorBar extends React.Component {
let defaultMessage;
if (global.mm_config.EnableSignUpWithGitLab === 'true') {
id = 'error_bar.site_url_gitlab';
defaultMessage = '{docsLink} is now a required setting. Please configure it in the System Console or in gitlab.rb if you\'re using GitLab Mattermost.';
defaultMessage = 'Please configure your {docsLink} in the System Console or in gitlab.rb if you\'re using GitLab Mattermost.';
} else {
id = 'error_bar.site_url';
defaultMessage = '{docsLink} is now a required setting. Please configure it in {link}.';
defaultMessage = 'Please configure your {docsLink} in the System Console.';
}
message = (

Просмотреть файл

@@ -350,11 +350,16 @@ class FileUpload extends React.Component {
const channelId = this.props.channelId || ChannelStore.getCurrentId();
const uploadsRemaining = Constants.MAX_UPLOAD_FILES - this.props.getFileCount(channelId);
const emojiSpan = (<span
className={'fa fa-smile-o icon--emoji-picker emoji-' + this.props.navBarName}
onClick={this.emojiClick}
/>);
const filestyle = {visibility: 'hidden'};
let emojiSpan;
if (this.props.emojiEnabled) {
emojiSpan = (
<span
className={'fa fa-smile-o icon--emoji-picker emoji-' + this.props.navBarName}
onClick={this.emojiClick}
/>
);
}
return (
<span
@@ -363,20 +368,19 @@ class FileUpload extends React.Component {
>
<div className='icon--attachment'>
<span
className='icon'
dangerouslySetInnerHTML={{__html: Constants.ATTACHMENT_ICON_SVG}}
onClick={() => this.refs.fileInput.click()}
/>
<input
ref='fileInput'
type='file'
style={filestyle}
onChange={this.handleChange}
onClick={uploadsRemaining > 0 ? this.props.onClick : this.handleMaxUploadReached}
multiple={multiple}
accept={accept}
/>
</div>
{this.props.emojiEnabled ? emojiSpan : ''}
{emojiSpan}
</span>
);
}

Просмотреть файл

@@ -82,7 +82,6 @@ export default class PostHeader extends React.Component {
commentCount={this.props.commentCount}
handleCommentClick={this.props.handleCommentClick}
handleDropdownOpened={this.props.handleDropdownOpened}
allowReply={!isSystemMessage}
isLastComment={this.props.isLastComment}
sameUser={this.props.sameUser}
currentUser={this.props.currentUser}

Просмотреть файл

@@ -63,13 +63,8 @@ export default class PostInfo extends React.Component {
$('#post_dropdown' + this.props.post.id).on('hidden.bs.dropdown', () => this.props.handleDropdownOpened(false));
}
createDropdown() {
createDropdown(isSystemMessage) {
const post = this.props.post;
const isSystemMessage = PostUtils.isSystemMessage(post);
if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING) {
return '';
}
var type = 'Post';
if (post.root_id && post.root_id.length > 0) {
@@ -82,7 +77,7 @@ export default class PostInfo extends React.Component {
dataComments = this.props.commentCount;
}
if (this.props.allowReply) {
if (!isSystemMessage) {
dropdownContents.push(
<li
key='replyLink'
@@ -157,42 +152,42 @@ export default class PostInfo extends React.Component {
</a>
</li>
);
}
if (this.props.post.is_pinned) {
dropdownContents.push(
<li
key='unpinLink'
role='presentation'
>
<a
href='#'
onClick={this.unpinPost}
if (this.props.post.is_pinned) {
dropdownContents.push(
<li
key='unpinLink'
role='presentation'
>
<FormattedMessage
id='post_info.unpin'
defaultMessage='Un-pin from channel'
/>
</a>
</li>
);
} else {
dropdownContents.push(
<li
key='pinLink'
role='presentation'
>
<a
href='#'
onClick={this.pinPost}
<a
href='#'
onClick={this.unpinPost}
>
<FormattedMessage
id='post_info.unpin'
defaultMessage='Un-pin from channel'
/>
</a>
</li>
);
} else {
dropdownContents.push(
<li
key='pinLink'
role='presentation'
>
<FormattedMessage
id='post_info.pin'
defaultMessage='Pin to channel'
/>
</a>
</li>
);
<a
href='#'
onClick={this.pinPost}
>
<FormattedMessage
id='post_info.pin'
defaultMessage='Pin to channel'
/>
</a>
</li>
);
}
}
if (this.canDelete) {
@@ -331,21 +326,28 @@ export default class PostInfo extends React.Component {
render() {
var post = this.props.post;
var comments = '';
var showCommentClass = '';
var commentCountText = this.props.commentCount;
const flagIcon = Constants.FLAG_ICON_SVG;
this.canDelete = PostUtils.canDeletePost(post);
this.canEdit = PostUtils.canEditPost(post, this.editDisableAction);
if (this.props.commentCount >= 1) {
showCommentClass = ' icon--show';
} else {
commentCountText = '';
}
const isEphemeral = Utils.isPostEphemeral(post);
const isPending = post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING;
const isSystemMessage = PostUtils.isSystemMessage(post);
let comments = null;
let react = null;
if (!isEphemeral && !isPending && !isSystemMessage) {
let showCommentClass;
let commentCountText;
if (this.props.commentCount >= 1) {
showCommentClass = ' icon--show';
commentCountText = this.props.commentCount;
} else {
showCommentClass = '';
commentCountText = '';
}
if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && !Utils.isPostEphemeral(post) && this.props.allowReply) {
comments = (
<a
href='#'
@@ -361,51 +363,48 @@ export default class PostInfo extends React.Component {
</span>
</a>
);
}
let react;
if (post.state !== Constants.POST_FAILED &&
post.state !== Constants.POST_LOADING &&
!Utils.isPostEphemeral(post) &&
Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) {
react = (
<span>
<Overlay
show={this.state.showEmojiPicker}
placement='top'
rootClose={true}
container={this}
onHide={() => this.setState({showEmojiPicker: false})}
target={() => ReactDOM.findDOMNode(this.refs['reactIcon_' + post.id])}
if (Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) {
react = (
<span>
<Overlay
show={this.state.showEmojiPicker}
placement='top'
rootClose={true}
container={this}
onHide={() => this.setState({showEmojiPicker: false})}
target={() => ReactDOM.findDOMNode(this.refs['reactIcon_' + post.id])}
>
<EmojiPicker
onEmojiClick={this.reactEmojiClick}
pickerLocation='top'
>
<EmojiPicker
onEmojiClick={this.reactEmojiClick}
pickerLocation='top'
/>
</Overlay>
<a
href='#'
className='reacticon__container'
onClick={this.emojiPickerClick}
ref={'reactIcon_' + post.id}
><i className='fa fa-smile-o'/>
</a>
</span>
/>
</Overlay>
<a
href='#'
className='reacticon__container'
onClick={this.emojiPickerClick}
ref={'reactIcon_' + post.id}
><i className='fa fa-smile-o'/>
</a>
</span>
);
);
}
}
let options;
if (Utils.isPostEphemeral(post)) {
if (isEphemeral) {
options = (
<li className='col col__remove'>
{this.createRemovePostButton()}
</li>
);
} else {
const dropdown = this.createDropdown();
} else if (!isPending) {
const dropdown = this.createDropdown(isSystemMessage);
if (dropdown) {
options = (
<li className='col col__reply'>
@@ -461,7 +460,7 @@ export default class PostInfo extends React.Component {
}
let flagTrigger;
if (!Utils.isPostEphemeral(post)) {
if (!isEphemeral) {
flagTrigger = (
<OverlayTrigger
key={'flagtooltipkey' + flagVisible}
@@ -516,14 +515,12 @@ PostInfo.defaultProps = {
post: null,
commentCount: 0,
isLastComment: false,
allowReply: false,
sameUser: false
};
PostInfo.propTypes = {
post: React.PropTypes.object.isRequired,
commentCount: React.PropTypes.number.isRequired,
isLastComment: React.PropTypes.bool.isRequired,
allowReply: React.PropTypes.bool.isRequired,
handleCommentClick: React.PropTypes.func.isRequired,
handleDropdownOpened: React.PropTypes.func.isRequired,
sameUser: React.PropTypes.bool.isRequired,

Просмотреть файл

@@ -489,8 +489,14 @@ export default class PostList extends React.Component {
}
scrollToBottomAnimated() {
var postList = $(this.refs.postlist);
postList.animate({scrollTop: this.refs.postlist.scrollHeight}, '500');
if (UserAgent.isIos()) {
// JQuery animation doesn't work on iOS
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
} else {
var postList = $(this.refs.postlist);
postList.animate({scrollTop: this.refs.postlist.scrollHeight}, '500');
}
}
getArchivesIntroMessage() {

Просмотреть файл

@@ -151,7 +151,7 @@ export default class RhsComment extends React.Component {
unpinPost(this.props.post.channel_id, this.props.post.id);
}
createDropdown() {
createDropdown(isSystemMessage) {
const post = this.props.post;
if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING) {
@@ -201,57 +201,59 @@ export default class RhsComment extends React.Component {
}
}
dropdownContents.push(
<li
key='rhs-root-permalink'
role='presentation'
>
<a
href='#'
onClick={this.handlePermalink}
if (!isSystemMessage) {
dropdownContents.push(
<li
key='rhs-root-permalink'
role='presentation'
>
<FormattedMessage
id='rhs_comment.permalink'
defaultMessage='Permalink'
/>
</a>
</li>
);
<a
href='#'
onClick={this.handlePermalink}
>
<FormattedMessage
id='rhs_comment.permalink'
defaultMessage='Permalink'
/>
</a>
</li>
);
if (post.is_pinned) {
dropdownContents.push(
<li
key='rhs-comment-unpin'
role='presentation'
>
<a
href='#'
onClick={this.unpinPost}
if (post.is_pinned) {
dropdownContents.push(
<li
key='rhs-comment-unpin'
role='presentation'
>
<FormattedMessage
id='rhs_root.unpin'
defaultMessage='Un-pin from channel'
/>
</a>
</li>
);
} else {
dropdownContents.push(
<li
key='rhs-comment-pin'
role='presentation'
>
<a
href='#'
onClick={this.pinPost}
<a
href='#'
onClick={this.unpinPost}
>
<FormattedMessage
id='rhs_root.unpin'
defaultMessage='Un-pin from channel'
/>
</a>
</li>
);
} else {
dropdownContents.push(
<li
key='rhs-comment-pin'
role='presentation'
>
<FormattedMessage
id='rhs_root.pin'
defaultMessage='Pin to channel'
/>
</a>
</li>
);
<a
href='#'
onClick={this.pinPost}
>
<FormattedMessage
id='rhs_root.pin'
defaultMessage='Pin to channel'
/>
</a>
</li>
);
}
}
if (this.canDelete) {
@@ -362,15 +364,10 @@ export default class RhsComment extends React.Component {
const post = this.props.post;
const flagIcon = Constants.FLAG_ICON_SVG;
const mattermostLogo = Constants.MATTERMOST_ICON_SVG;
const isSystemMessage = PostUtils.isSystemMessage(post);
let canReact = false;
if (post.state !== Constants.POST_FAILED &&
post.state !== Constants.POST_LOADING &&
!Utils.isPostEphemeral(post) &&
Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) {
canReact = true;
}
const isEphemeral = Utils.isPostEphemeral(post);
const isPending = post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING;
const isSystemMessage = PostUtils.isSystemMessage(post);
var currentUserCss = '';
if (this.props.currentUser.id === post.user_id) {
@@ -412,7 +409,7 @@ export default class RhsComment extends React.Component {
}
botIndicator = <li className='col col__name bot-indicator'>{'BOT'}</li>;
} else if (PostUtils.isSystemMessage(post)) {
} else if (isSystemMessage) {
userProfile = (
<UserProfile
user={{}}
@@ -474,7 +471,7 @@ export default class RhsComment extends React.Component {
);
}
if (PostUtils.isSystemMessage(post)) {
if (isSystemMessage) {
profilePic = (
<span
className='icon'
@@ -556,7 +553,7 @@ export default class RhsComment extends React.Component {
}
let flagTrigger;
if (!Utils.isPostEphemeral(post)) {
if (!isEphemeral) {
flagTrigger = (
<OverlayTrigger
key={'commentflagtooltipkey' + flagVisible}
@@ -578,7 +575,7 @@ export default class RhsComment extends React.Component {
let react;
let reactOverlay;
if (canReact) {
if (!isEphemeral && !isPending && !isSystemMessage && Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) {
react = (
<span>
<a
@@ -612,17 +609,17 @@ export default class RhsComment extends React.Component {
}
let options;
if (Utils.isPostEphemeral(post)) {
if (isEphemeral) {
options = (
<li className='col col__remove'>
{this.createRemovePostButton()}
</li>
);
} else if (!PostUtils.isSystemMessage(post)) {
} else if (!isSystemMessage) {
options = (
<li className='col col__reply'>
{reactOverlay}
{this.createDropdown()}
{this.createDropdown(isSystemMessage)}
{react}
</li>
);

Просмотреть файл

@@ -182,18 +182,15 @@ export default class RhsRootPost extends React.Component {
const mattermostLogo = Constants.MATTERMOST_ICON_SVG;
var timestamp = user ? user.last_picture_update : 0;
var channel = ChannelStore.get(post.channel_id);
let canReact = false;
const flagIcon = Constants.FLAG_ICON_SVG;
if (post.state !== Constants.POST_FAILED &&
post.state !== Constants.POST_LOADING &&
!Utils.isPostEphemeral(post) &&
Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) {
canReact = true;
}
this.canDelete = PostUtils.canDeletePost(post);
this.canEdit = PostUtils.canEditPost(post, this.editDisableAction);
const isEphemeral = Utils.isPostEphemeral(post);
const isPending = post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING;
const isSystemMessage = PostUtils.isSystemMessage(post);
var type = 'Post';
if (post.root_id.length > 0) {
type = 'Comment';
@@ -205,7 +202,7 @@ export default class RhsRootPost extends React.Component {
}
var systemMessageClass = '';
if (PostUtils.isSystemMessage(post)) {
if (isSystemMessage) {
systemMessageClass = 'post--system';
}
@@ -226,7 +223,7 @@ export default class RhsRootPost extends React.Component {
let react;
let reactOverlay;
if (canReact) {
if (!isEphemeral && !isPending && !isSystemMessage && Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) {
react = (
<span>
<a
@@ -298,57 +295,59 @@ export default class RhsRootPost extends React.Component {
}
}
dropdownContents.push(
<li
key='rhs-root-permalink'
role='presentation'
>
<a
href='#'
onClick={this.handlePermalink}
if (!isSystemMessage) {
dropdownContents.push(
<li
key='rhs-root-permalink'
role='presentation'
>
<FormattedMessage
id='rhs_root.permalink'
defaultMessage='Permalink'
/>
</a>
</li>
);
<a
href='#'
onClick={this.handlePermalink}
>
<FormattedMessage
id='rhs_root.permalink'
defaultMessage='Permalink'
/>
</a>
</li>
);
if (post.is_pinned) {
dropdownContents.push(
<li
key='rhs-root-unpin'
role='presentation'
>
<a
href='#'
onClick={this.unpinPost}
if (post.is_pinned) {
dropdownContents.push(
<li
key='rhs-root-unpin'
role='presentation'
>
<FormattedMessage
id='rhs_root.unpin'
defaultMessage='Un-pin from channel'
/>
</a>
</li>
);
} else {
dropdownContents.push(
<li
key='rhs-root-pin'
role='presentation'
>
<a
href='#'
onClick={this.pinPost}
<a
href='#'
onClick={this.unpinPost}
>
<FormattedMessage
id='rhs_root.unpin'
defaultMessage='Un-pin from channel'
/>
</a>
</li>
);
} else {
dropdownContents.push(
<li
key='rhs-root-pin'
role='presentation'
>
<FormattedMessage
id='rhs_root.pin'
defaultMessage='Pin to channel'
/>
</a>
</li>
);
<a
href='#'
onClick={this.pinPost}
>
<FormattedMessage
id='rhs_root.pin'
defaultMessage='Pin to channel'
/>
</a>
</li>
);
}
}
if (this.canDelete) {
@@ -443,7 +442,7 @@ export default class RhsRootPost extends React.Component {
}
botIndicator = <li className='col col__name bot-indicator'>{'BOT'}</li>;
} else if (PostUtils.isSystemMessage(post)) {
} else if (isSystemMessage) {
userProfile = (
<UserProfile
user={{}}
@@ -485,7 +484,7 @@ export default class RhsRootPost extends React.Component {
);
}
if (PostUtils.isSystemMessage(post)) {
if (isSystemMessage) {
profilePic = (
<span
className='icon'

Просмотреть файл

@@ -8,7 +8,7 @@ import UserStore from 'stores/user_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import {removeUserFromTeam, updateTeamMemberRoles} from 'actions/team_actions.jsx';
import {updateActive} from 'actions/user_actions.jsx';
import {loadMyTeamMembers, updateActive} from 'actions/user_actions.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
import * as Utils from 'utils/utils.jsx';
@@ -49,6 +49,10 @@ export default class TeamMembersDropdown extends React.Component {
'team_user',
() => {
AsyncClient.getUser(this.props.user.id);
if (this.props.user.id === me.id) {
loadMyTeamMembers();
}
},
(err) => {
this.setState({serverError: err.message});