diff options
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/channel_header.jsx | 8 | ||||
-rw-r--r-- | web/react/components/channel_notifications_modal.jsx | 17 | ||||
-rw-r--r-- | web/react/components/command_list.jsx | 2 | ||||
-rw-r--r-- | web/react/components/member_list_team.jsx | 47 | ||||
-rw-r--r-- | web/react/components/mention_list.jsx | 12 | ||||
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 10 | ||||
-rw-r--r-- | web/react/components/rhs_root_post.jsx | 82 | ||||
-rw-r--r-- | web/react/components/sidebar_right_menu.jsx | 15 | ||||
-rw-r--r-- | web/react/components/team_members.jsx | 130 | ||||
-rw-r--r-- | web/react/components/team_members_modal.jsx | 69 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_general.jsx | 4 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_notifications.jsx | 10 |
12 files changed, 203 insertions, 203 deletions
diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index 6e12c7c14..08c4a48ea 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -101,9 +101,11 @@ export default class ChannelHeader extends React.Component { let terms = ''; if (user.notify_props && user.notify_props.mention_keys) { const termKeys = UserStore.getCurrentMentionKeys(); - if (user.notify_props.all === 'true' && termKeys.indexOf('@all') !== -1) { - termKeys.splice(termKeys.indexOf('@all'), 1); - } + + // if (user.notify_props.all === 'true' && termKeys.indexOf('@all') !== -1) { + // termKeys.splice(termKeys.indexOf('@all'), 1); + // } + if (user.notify_props.channel === 'true' && termKeys.indexOf('@channel') !== -1) { termKeys.splice(termKeys.indexOf('@channel'), 1); } diff --git a/web/react/components/channel_notifications_modal.jsx b/web/react/components/channel_notifications_modal.jsx index 4af95c88f..79b769c8a 100644 --- a/web/react/components/channel_notifications_modal.jsx +++ b/web/react/components/channel_notifications_modal.jsx @@ -28,7 +28,7 @@ export default class ChannelNotificationsModal extends React.Component { this.state = { notifyLevel: member.notify_props.desktop, markUnreadLevel: member.notify_props.mark_unread, - channelId: '', + channelId: ChannelStore.getCurrentId(), activeSection: '' }; } @@ -39,18 +39,21 @@ export default class ChannelNotificationsModal extends React.Component { ChannelStore.removeChangeListener(this.onListenerChange); } onListenerChange() { - if (!this.state.channelId) { + const curChannelId = ChannelStore.getCurrentId(); + + if (!curChannelId) { return; } - const member = ChannelStore.getMember(this.state.channelId); + const newState = {channelId: curChannelId}; + const member = ChannelStore.getMember(curChannelId); if (member.notify_props.desktop !== this.state.notifyLevel || member.notify_props.mark_unread !== this.state.mark_unread) { - this.setState({ - notifyLevel: member.notify_props.desktop, - markUnreadLevel: member.notify_props.mark_unread - }); + newState.notifyLevel = member.notify_props.desktop; + newState.markUnreadLevel = member.notify_props.mark_unread; } + + this.setState(newState); } updateSection(section) { this.setState({activeSection: section}); diff --git a/web/react/components/command_list.jsx b/web/react/components/command_list.jsx index ff83d0420..7fc0f79cf 100644 --- a/web/react/components/command_list.jsx +++ b/web/react/components/command_list.jsx @@ -81,7 +81,7 @@ export default class CommandList extends React.Component { <div ref='mentionlist' className='command-box' - style={{height: (this.state.suggestions.length * 56) + 2}} + style={{height: (suggestions.length * 56) + 2}} > {suggestions} </div> diff --git a/web/react/components/member_list_team.jsx b/web/react/components/member_list_team.jsx index 72fdb7be9..f1c31131f 100644 --- a/web/react/components/member_list_team.jsx +++ b/web/react/components/member_list_team.jsx @@ -2,17 +2,56 @@ // See License.txt for license information. import MemberListTeamItem from './member_list_team_item.jsx'; +import UserStore from '../stores/user_store.jsx'; export default class MemberListTeam extends React.Component { + constructor(props) { + super(props); + + this.getUsers = this.getUsers.bind(this); + this.onChange = this.onChange.bind(this); + + this.state = { + users: this.getUsers() + }; + } + + componentDidMount() { + UserStore.addChangeListener(this.onChange); + } + + componentWillUnmount() { + UserStore.removeChangeListener(this.onChange); + } + + getUsers() { + const profiles = UserStore.getProfiles(); + const users = []; + + for (const id of Object.keys(profiles)) { + users.push(profiles[id]); + } + + users.sort((a, b) => a.username.localeCompare(b.username)); + + return users; + } + + onChange() { + this.setState({ + users: this.getUsers() + }); + } + render() { - const memberList = this.props.users.map(function makeListItem(user) { + const memberList = this.state.users.map((user) => { return ( <MemberListTeamItem key={user.id} user={user} /> ); - }, this); + }); return ( <table className='table more-table member-list-holder'> @@ -23,7 +62,3 @@ export default class MemberListTeam extends React.Component { ); } } - -MemberListTeam.propTypes = { - users: React.PropTypes.arrayOf(React.PropTypes.object).isRequired -}; diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index d1b27cf99..297d5c719 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -183,12 +183,12 @@ export default class MentionList extends React.Component { } } - var all = {}; - all.username = 'all'; - all.nickname = ''; - all.secondary_text = 'Notifies everyone in the team'; - all.id = 'allmention'; - users.push(all); + // var all = {}; + // all.username = 'all'; + // all.nickname = ''; + // all.secondary_text = 'Notifies everyone in the team'; + // all.id = 'allmention'; + // users.push(all); var channel = {}; channel.username = 'channel'; diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index a14434bfc..c286ee6f9 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -8,6 +8,8 @@ import TeamStore from '../stores/team_store.jsx'; import * as EventHelpers from '../dispatcher/event_helpers.jsx'; import AboutBuildModal from './about_build_modal.jsx'; +import TeamMembersModal from './team_members_modal.jsx'; +import ToggleModalButton from './toggle_modal_button.jsx'; import UserSettingsModal from './user_settings/user_settings_modal.jsx'; import Constants from '../utils/constants.jsx'; @@ -117,13 +119,9 @@ export default class NavbarDropdown extends React.Component { if (isAdmin) { manageLink = ( <li> - <a - href='#' - data-toggle='modal' - data-target='#team_members' - > + <ToggleModalButton dialogType={TeamMembersModal}> {'Manage Members'} - </a> + </ToggleModalButton> </li> ); diff --git a/web/react/components/rhs_root_post.jsx b/web/react/components/rhs_root_post.jsx index 8142888ba..3d3d9e13f 100644 --- a/web/react/components/rhs_root_post.jsx +++ b/web/react/components/rhs_root_post.jsx @@ -38,7 +38,9 @@ export default class RhsRootPost extends React.Component { } render() { var post = this.props.post; - var isOwner = UserStore.getCurrentId() === post.user_id; + var currentUser = UserStore.getCurrentUser(); + var isOwner = currentUser.id === post.user_id; + var isAdmin = utils.isAdmin(currentUser.roles); var timestamp = UserStore.getProfile(post.user_id).update_at; var channel = ChannelStore.get(post.channel_id); @@ -61,11 +63,54 @@ export default class RhsRootPost extends React.Component { } } - var ownerOptions; + var dropdownContents = []; + if (isOwner) { - ownerOptions = ( - <div> - <a href='#' + dropdownContents.push( + <li + key='rhs-root-edit' + role='presentation' + > + <a + href='#' + role='menuitem' + data-toggle='modal' + data-target='#edit_post' + data-refocusid='#reply_textbox' + data-title={type} + data-message={post.message} + data-postid={post.id} + data-channelid={post.channel_id} + > + {'Edit'} + </a> + </li> + ); + } + + if (isOwner || isAdmin) { + dropdownContents.push( + <li + key='rhs-root-delete' + role='presentation' + > + <a + href='#' + role='menuitem' + onClick={() => EventHelpers.showDeletePostModal(post, this.props.commentCount)} + > + {'Delete'} + </a> + </li> + ); + } + + var rootOptions = ''; + if (dropdownContents.length > 0) { + rootOptions = ( + <div className='dropdown'> + <a + href='#' className='post__dropdown dropdown-toggle' type='button' data-toggle='dropdown' @@ -75,30 +120,7 @@ export default class RhsRootPost extends React.Component { className='dropdown-menu' role='menu' > - <li role='presentation'> - <a - href='#' - role='menuitem' - data-toggle='modal' - data-target='#edit_post' - data-refocusid='#reply_textbox' - data-title={type} - data-message={post.message} - data-postid={post.id} - data-channelid={post.channel_id} - > - {'Edit'} - </a> - </li> - <li role='presentation'> - <a - href='#' - role='menuitem' - onClick={() => EventHelpers.showDeletePostModal(post, this.props.commentCount)} - > - {'Delete'} - </a> - </li> + {dropdownContents} </ul> </div> ); @@ -166,7 +188,7 @@ export default class RhsRootPost extends React.Component { </li> <li className='col col__reply'> <div className='dropdown'> - {ownerOptions} + {rootOptions} </div> </li> </ul> diff --git a/web/react/components/sidebar_right_menu.jsx b/web/react/components/sidebar_right_menu.jsx index 0525eca4b..108b1c1b9 100644 --- a/web/react/components/sidebar_right_menu.jsx +++ b/web/react/components/sidebar_right_menu.jsx @@ -1,6 +1,8 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import TeamMembersModal from './team_members_modal.jsx'; +import ToggleModalButton from './toggle_modal_button.jsx'; import UserSettingsModal from './user_settings/user_settings_modal.jsx'; import UserStore from '../stores/user_store.jsx'; import * as client from '../utils/client.jsx'; @@ -78,12 +80,9 @@ export default class SidebarRightMenu extends React.Component { ); manageLink = ( <li> - <a - href='#' - data-toggle='modal' - data-target='#team_members' - > - <i className='fa fa-users'></i>Manage Members</a> + <ToggleModalButton dialogType={TeamMembersModal}> + <i className='fa fa-users'></i>{'Manage Members'} + </ToggleModalButton> </li> ); } @@ -141,12 +140,12 @@ export default class SidebarRightMenu extends React.Component { <li> <a target='_blank' - href='/static/help/configure_links.html' + href='/static/help/help.html' ><i className='fa fa-question'></i>Help</a></li> <li> <a target='_blank' - href='/static/help/configure_links.html' + href='/static/help/report_problem.html' ><i className='fa fa-phone'></i>Report a Problem</a></li> </ul> </div> diff --git a/web/react/components/team_members.jsx b/web/react/components/team_members.jsx deleted file mode 100644 index cd0766012..000000000 --- a/web/react/components/team_members.jsx +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import UserStore from '../stores/user_store.jsx'; -import MemberListTeam from './member_list_team.jsx'; -import * as utils from '../utils/utils.jsx'; - -function getStateFromStores() { - var users = UserStore.getProfiles(); - var memberList = []; - for (var id in users) { - if (users.hasOwnProperty(id)) { - memberList.push(users[id]); - } - } - - memberList.sort(function sort(a, b) { - if (a.username < b.username) { - return -1; - } - - if (a.username > b.username) { - return 1; - } - - return 0; - }); - - return { - member_list: memberList - }; -} - -export default class TeamMembers extends React.Component { - constructor(props) { - super(props); - - this.onChange = this.onChange.bind(this); - - this.state = getStateFromStores(); - } - - componentDidMount() { - UserStore.addChangeListener(this.onChange); - - var self = this; - $(ReactDOM.findDOMNode(this.refs.modal)).on('hidden.bs.modal', function show() { - self.setState({render_members: false}); - }); - - $(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', function hide() { - self.setState({render_members: true}); - }); - } - - componentWillUnmount() { - UserStore.removeChangeListener(this.onChange); - } - - onChange() { - var newState = getStateFromStores(); - if (!utils.areObjectsEqual(newState, this.state)) { - this.setState(newState); - } - } - - render() { - var serverError = null; - - if (this.state.server_error) { - serverError = <label className='has-error control-label'>{this.state.server_error}</label>; - } - - var renderMembers = ''; - - if (this.state.render_members) { - renderMembers = <MemberListTeam users={this.state.member_list} />; - } - - return ( - <div - className='modal fade more-modal' - ref='modal' - id='team_members' - tabIndex='-1' - role='dialog' - aria-hidden='true' - > - <div className='modal-dialog'> - <div className='modal-content'> - <div className='modal-header'> - <button - type='button' - className='close' - data-dismiss='modal' - aria-label='Close' - > - <span aria-hidden='true'>×</span> - </button> - <h4 - className='modal-title' - id='myModalLabel' - >{this.props.teamDisplayName + ' Members'}</h4> - </div> - <div - ref='modalBody' - className='modal-body' - > - <div className='team-member-list'> - {renderMembers} - </div> - {serverError} - </div> - <div className='modal-footer'> - <button - type='button' - className='btn btn-default' - data-dismiss='modal' - >Close</button> - </div> - </div> - </div> - </div> - ); - } -} - -TeamMembers.propTypes = { - teamDisplayName: React.PropTypes.string -}; diff --git a/web/react/components/team_members_modal.jsx b/web/react/components/team_members_modal.jsx new file mode 100644 index 000000000..0a30a2202 --- /dev/null +++ b/web/react/components/team_members_modal.jsx @@ -0,0 +1,69 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import MemberListTeam from './member_list_team.jsx'; +import TeamStore from '../stores/team_store.jsx'; + +const Modal = ReactBootstrap.Modal; + +export default class TeamMembersModal extends React.Component { + constructor(props) { + super(props); + + this.onShow = this.onShow.bind(this); + } + + componentDidMount() { + if (this.props.show) { + this.onShow(); + } + } + + componentDidUpdate(prevProps) { + if (this.props.show && !prevProps.show) { + this.onShow(); + } + } + + onShow() { + $(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 300); + if ($(window).width() > 768) { + $(ReactDOM.findDOMNode(this.refs.modalBody)).perfectScrollbar(); + } + } + + render() { + const team = TeamStore.getCurrent(); + + return ( + <Modal + dialogClassName='team-members-modal' + show={this.props.show} + onHide={this.props.onHide} + > + <Modal.Header closeButton={true}> + {team.display_name + ' Members'} + </Modal.Header> + <Modal.Body ref='modalBody'> + <div className='team-member-list'> + <MemberListTeam /> + </div> + </Modal.Body> + <Modal.Footer> + <button + type='button' + className='btn btn-default' + onClick={this.props.onHide} + > + {'Close'} + </button> + </Modal.Footer> + </Modal> + ); + } +} + +TeamMembersModal.propTypes = { + show: React.PropTypes.bool.isRequired, + onHide: React.PropTypes.func.isRequired +}; diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx index b3ec7ddd7..962efd7a2 100644 --- a/web/react/components/user_settings/user_settings_general.jsx +++ b/web/react/components/user_settings/user_settings_general.jsx @@ -438,12 +438,12 @@ export default class UserSettingsGeneralTab extends React.Component { if (this.props.activeSection === 'email') { const emailEnabled = global.window.mm_config.SendEmailNotifications === 'true'; const emailVerificationEnabled = global.window.mm_config.RequireEmailVerification === 'true'; - let helpText = 'Email is used for notifications, and requires verification if changed.'; + let helpText = 'Email is used for sign-in, notifications, and password reset. Email requires verification if changed.'; if (!emailEnabled) { helpText = <div className='setting-list__hint text-danger'>{'Email has been disabled by your system administrator. No notification emails will be sent until it is enabled.'}</div>; } else if (!emailVerificationEnabled) { - helpText = 'Email is used for notifications.'; + helpText = 'Email is used for sign-in, notifications, and password reset.'; } else if (this.state.emailChangeInProgress) { const newEmail = UserStore.getCurrentUser().email; if (newEmail) { diff --git a/web/react/components/user_settings/user_settings_notifications.jsx b/web/react/components/user_settings/user_settings_notifications.jsx index e36aed395..e025bf670 100644 --- a/web/react/components/user_settings/user_settings_notifications.jsx +++ b/web/react/components/user_settings/user_settings_notifications.jsx @@ -512,7 +512,7 @@ export default class NotificationsTab extends React.Component { }.bind(this); inputs.push( <div key='userNotificationAllOption'> - <div className='checkbox'> + <div className='checkbox hidden'> <label> <input type='checkbox' @@ -590,9 +590,11 @@ export default class NotificationsTab extends React.Component { if (this.state.mentionKey) { keys.push('@' + user.username); } - if (this.state.allKey) { - keys.push('@all'); - } + + // if (this.state.allKey) { + // keys.push('@all'); + // } + if (this.state.channelKey) { keys.push('@channel'); } |