From 9481a4f0ef753499c1d02e3be99a7c59c5467ab6 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 11 Jul 2016 14:21:51 -0400 Subject: Merge release 3.2 into master (#3548) * Bumping version to: 3.2.0-rc1 * PLT-2863 fixing bad merge that broke this PR (#3523) * PLT-2863 adding remove user from team * PLT-2863 adding the client side UI * Fixing trailing space * Fixing reported issues * Adding documentatino * Switching to final javascript driver * Fixing bad merge * Fixing bad merge * PLT-3538 Fix Login page doesn't show SAML option if gitlab is enabled (#3524) * Login error messages fix (#3525) * daily translations 20160708 (#3533) * Fixed permissions when getting a file attachment to use the correct user id (#3535) * PLT-3575 Fix Cannot upload certificates with .cer file extension on SAML (#3534) * PLT-3560 blocking adding to channel once user is removed (#3537) * Always allow system admins to see the Integrations sidebar (#3536) * Plt 3475 - Post control improvements (#3538) * Adding class to post when dropdown is active. * plt-3475 - Post controls improvements * daily translations 20160711 (#3544) --- webapp/components/admin_console/saml_settings.jsx | 4 ++-- .../backstage/components/backstage_sidebar.jsx | 4 +++- webapp/components/login/login_controller.jsx | 2 +- webapp/components/post_view/components/post.jsx | 28 +++++++++++++++++++--- .../post_view/components/post_header.jsx | 2 ++ .../components/post_view/components/post_info.jsx | 15 ++++++++---- 6 files changed, 44 insertions(+), 11 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/admin_console/saml_settings.jsx b/webapp/components/admin_console/saml_settings.jsx index 45135fba6..611c37192 100644 --- a/webapp/components/admin_console/saml_settings.jsx +++ b/webapp/components/admin_console/saml_settings.jsx @@ -166,7 +166,7 @@ export default class SamlSettings extends AdminSettings { } uploadingText={Utils.localizeMessage('admin.saml.uploading.certificate', 'Uploading Certificate...')} disabled={!this.state.enable} - fileType='.crt' + fileType='.crt,.cer' onSubmit={this.uploadCertificate} /> ); @@ -260,7 +260,7 @@ export default class SamlSettings extends AdminSettings { } uploadingText={Utils.localizeMessage('admin.saml.uploading.certificate', 'Uploading Certificate...')} disabled={!this.state.enable || !this.state.encrypt} - fileType='.crt' + fileType='.crt,.cer' onSubmit={this.uploadCertificate} /> ); diff --git a/webapp/components/backstage/components/backstage_sidebar.jsx b/webapp/components/backstage/components/backstage_sidebar.jsx index ea0849c8a..3434b315a 100644 --- a/webapp/components/backstage/components/backstage_sidebar.jsx +++ b/webapp/components/backstage/components/backstage_sidebar.jsx @@ -45,7 +45,9 @@ export default class BackstageSidebar extends React.Component { return null; } - if (window.mm_config.EnableOnlyAdminIntegrations !== 'false' && !TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) { + if (window.mm_config.EnableOnlyAdminIntegrations !== 'false' && + !Utils.isSystemAdmin(this.props.user.roles) && + !TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) { return null; } diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx index ca06caf0b..d2dbf1800 100644 --- a/webapp/components/login/login_controller.jsx +++ b/webapp/components/login/login_controller.jsx @@ -484,7 +484,7 @@ export default class LoginController extends React.Component { loginControls.push( diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx index 0a4840050..21d335a51 100644 --- a/webapp/components/post_view/components/post.jsx +++ b/webapp/components/post_view/components/post.jsx @@ -18,9 +18,12 @@ export default class Post extends React.Component { super(props); this.handleCommentClick = this.handleCommentClick.bind(this); + this.handleDropdownOpened = this.handleDropdownOpened.bind(this); this.forceUpdateInfo = this.forceUpdateInfo.bind(this); - this.state = {}; + this.state = { + dropdownOpened: false + }; } handleCommentClick(e) { e.preventDefault(); @@ -35,11 +38,16 @@ export default class Post extends React.Component { results: null }); } + handleDropdownOpened(opened) { + this.setState({ + dropdownOpened: opened + }); + } forceUpdateInfo() { this.refs.info.forceUpdate(); this.refs.header.forceUpdate(); } - shouldComponentUpdate(nextProps) { + shouldComponentUpdate(nextProps, nextState) { if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) { return true; } @@ -88,6 +96,14 @@ export default class Post extends React.Component { return true; } + if (nextProps.emojis !== this.props.emojis) { + return true; + } + + if (nextState.dropdownOpened !== this.state.dropdownOpened) { + return true; + } + return false; } render() { @@ -187,11 +203,16 @@ export default class Post extends React.Component { profilePicContainer = ''; } + let dropdownOpenedClass = ''; + if (this.state.dropdownOpened) { + dropdownOpenedClass = 'post--hovered'; + } + return (
{profilePicContainer} @@ -202,6 +223,7 @@ export default class Post extends React.Component { sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} + handleDropdownOpened={this.handleDropdownOpened} isLastComment={this.props.isLastComment} sameUser={this.props.sameUser} user={this.props.user} diff --git a/webapp/components/post_view/components/post_header.jsx b/webapp/components/post_view/components/post_header.jsx index 727b005e7..e76358304 100644 --- a/webapp/components/post_view/components/post_header.jsx +++ b/webapp/components/post_view/components/post_header.jsx @@ -64,6 +64,7 @@ export default class PostHeader extends React.Component { post={post} commentCount={this.props.commentCount} handleCommentClick={this.props.handleCommentClick} + handleDropdownOpened={this.props.handleDropdownOpened} allowReply='true' isLastComment={this.props.isLastComment} sameUser={this.props.sameUser} @@ -90,6 +91,7 @@ PostHeader.propTypes = { commentCount: React.PropTypes.number.isRequired, isLastComment: React.PropTypes.bool.isRequired, handleCommentClick: React.PropTypes.func.isRequired, + handleDropdownOpened: React.PropTypes.func.isRequired, sameUser: React.PropTypes.bool.isRequired, compactDisplay: React.PropTypes.bool, displayNameType: React.PropTypes.string, diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx index 76d4df1cc..d74be4c72 100644 --- a/webapp/components/post_view/components/post_info.jsx +++ b/webapp/components/post_view/components/post_info.jsx @@ -18,16 +18,20 @@ export default class PostInfo extends React.Component { constructor(props) { super(props); - this.dropdownPosition = this.dropdownPosition.bind(this); + this.handleDropdownClick = this.handleDropdownClick.bind(this); this.handlePermalink = this.handlePermalink.bind(this); } - dropdownPosition(e) { + handleDropdownClick(e) { var position = $('#post-list').height() - $(e.target).offset().top; var dropdown = $(e.target).closest('.col__reply').find('.dropdown-menu'); if (position < dropdown.height()) { dropdown.addClass('bottom'); } } + componentDidMount() { + $('#post_dropdown' + this.props.post.id).on('shown.bs.dropdown', () => this.props.handleDropdownOpened(true)); + $('#post_dropdown' + this.props.post.id).on('hidden.bs.dropdown', () => this.props.handleDropdownOpened(false)); + } createDropdown() { var post = this.props.post; var isOwner = this.props.currentUser.id === post.user_id; @@ -140,14 +144,16 @@ export default class PostInfo extends React.Component { } return ( -
+