diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/channel_invite_modal.jsx | 31 | ||||
-rw-r--r-- | web/react/components/channel_members_modal.jsx | 49 | ||||
-rw-r--r-- | web/react/components/file_attachment.jsx | 2 | ||||
-rw-r--r-- | web/react/components/post_info.jsx | 2 | ||||
-rw-r--r-- | web/react/components/posts_view.jsx | 7 | ||||
-rw-r--r-- | web/react/utils/async_client.jsx | 3 | ||||
-rw-r--r-- | web/react/utils/client.jsx | 11 | ||||
-rw-r--r-- | web/sass-files/sass/partials/_post.scss | 27 | ||||
-rw-r--r-- | web/sass-files/sass/partials/_post_right.scss | 1 |
9 files changed, 90 insertions, 43 deletions
diff --git a/web/react/components/channel_invite_modal.jsx b/web/react/components/channel_invite_modal.jsx index 7dac39942..8b7485e5f 100644 --- a/web/react/components/channel_invite_modal.jsx +++ b/web/react/components/channel_invite_modal.jsx @@ -20,9 +20,14 @@ export default class ChannelInviteModal extends React.Component { this.onListenerChange = this.onListenerChange.bind(this); this.handleInvite = this.handleInvite.bind(this); - this.state = this.getStateFromStores(); + // the state gets populated when the modal is shown + this.state = {}; } shouldComponentUpdate(nextProps, nextState) { + if (!this.props.show && !nextProps.show) { + return false; + } + if (!Utils.areObjectsEqual(this.props, nextProps)) { return true; } @@ -34,13 +39,25 @@ export default class ChannelInviteModal extends React.Component { return false; } getStateFromStores() { - function getId(user) { - return user.id; + const users = UserStore.getActiveOnlyProfiles(); + + if ($.isEmptyObject(users)) { + return { + loading: true + }; + } + + // make sure we have all members of this channel before rendering + const extraInfo = ChannelStore.getCurrentExtraInfo(); + if (extraInfo.member_count !== extraInfo.members.length) { + AsyncClient.getChannelExtraInfo(this.props.channel.id, -1); + + return { + loading: true + }; } - var users = UserStore.getActiveOnlyProfiles(); - var memberIds = ChannelStore.getCurrentExtraInfo().members.map(getId); - var loading = $.isEmptyObject(users); + const memberIds = extraInfo.members.map((user) => user.id); var nonmembers = []; for (var id in users) { @@ -55,7 +72,7 @@ export default class ChannelInviteModal extends React.Component { return { nonmembers, - loading + loading: false }; } onShow() { diff --git a/web/react/components/channel_members_modal.jsx b/web/react/components/channel_members_modal.jsx index d1b9df988..513a720e7 100644 --- a/web/react/components/channel_members_modal.jsx +++ b/web/react/components/channel_members_modal.jsx @@ -1,6 +1,7 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import LoadingScreen from './loading_screen.jsx'; import MemberList from './member_list.jsx'; import ChannelInviteModal from './channel_invite_modal.jsx'; @@ -21,9 +22,10 @@ export default class ChannelMembersModal extends React.Component { this.onChange = this.onChange.bind(this); this.handleRemove = this.handleRemove.bind(this); - const state = this.getStateFromStores(); - state.showInviteModal = false; - this.state = state; + // the rest of the state gets populated when the modal is shown + this.state = { + showInviteModal: false + }; } shouldComponentUpdate(nextProps, nextState) { if (!Utils.areObjectsEqual(this.props, nextProps)) { @@ -37,8 +39,18 @@ export default class ChannelMembersModal extends React.Component { return false; } getStateFromStores() { + const extraInfo = ChannelStore.getCurrentExtraInfo(); + + if (extraInfo.member_count !== extraInfo.members.length) { + AsyncClient.getChannelExtraInfo(this.props.channel.id, -1); + + return { + loading: true + }; + } + const users = UserStore.getActiveOnlyProfiles(); - const memberList = ChannelStore.getCurrentExtraInfo().members; + const memberList = extraInfo.members; const nonmemberList = []; for (const id in users) { @@ -71,14 +83,14 @@ export default class ChannelMembersModal extends React.Component { return { nonmemberList, - memberList + memberList, + loading: false }; } onShow() { if ($(window).width() > 768) { $(ReactDOM.findDOMNode(this.refs.modalBody)).perfectScrollbar(); } - this.onChange(); } componentDidUpdate(prevProps) { if (this.props.show && !prevProps.show) { @@ -89,6 +101,8 @@ export default class ChannelMembersModal extends React.Component { if (!this.props.show && nextProps.show) { ChannelStore.addExtraInfoChangeListener(this.onChange); ChannelStore.addChangeListener(this.onChange); + + this.onChange(); } else if (this.props.show && !nextProps.show) { ChannelStore.removeExtraInfoChangeListener(this.onChange); ChannelStore.removeChangeListener(this.onChange); @@ -154,6 +168,21 @@ export default class ChannelMembersModal extends React.Component { isAdmin = Utils.isAdmin(currentMember.roles) || Utils.isAdmin(UserStore.getCurrentUser().roles); } + let content; + if (this.state.loading) { + content = (<LoadingScreen />); + } else { + content = ( + <div className='team-member-list'> + <MemberList + memberList={this.state.memberList} + isAdmin={isAdmin} + handleRemove={this.handleRemove} + /> + </div> + ); + } + return ( <div> <Modal @@ -178,13 +207,7 @@ export default class ChannelMembersModal extends React.Component { ref='modalBody' style={{maxHeight}} > - <div className='team-member-list'> - <MemberList - memberList={this.state.memberList} - isAdmin={isAdmin} - handleRemove={this.handleRemove} - /> - </div> + {content} </Modal.Body> <Modal.Footer> <button diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index c10269680..eeb218bfe 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -266,7 +266,7 @@ export default class FileAttachment extends React.Component { href={fileUrl} download={filenameString} data-toggle='tooltip' - title={'Download ' + filenameString} + title={'Download \"' + filenameString + '\"'} className='post-image__name' > {trimmedFilename} diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx index 21683bb01..26bd6adde 100644 --- a/web/react/components/post_info.jsx +++ b/web/react/components/post_info.jsx @@ -223,13 +223,13 @@ export default class PostInfo extends React.Component { /> </li> <li className='col col__reply'> - {comments} <div className='dropdown' ref='dotMenu' > {dropdown} </div> + {comments} <Overlay show={this.state.show} target={() => ReactDOM.findDOMNode(this.refs.dotMenu)} diff --git a/web/react/components/posts_view.jsx b/web/react/components/posts_view.jsx index a28efbd04..7d8c7e265 100644 --- a/web/react/components/posts_view.jsx +++ b/web/react/components/posts_view.jsx @@ -24,6 +24,7 @@ export default class PostsView extends React.Component { this.updateScrolling = this.updateScrolling.bind(this); this.handleResize = this.handleResize.bind(this); this.scrollToBottom = this.scrollToBottom.bind(this); + this.scrollToBottomAnimated = this.scrollToBottomAnimated.bind(this); this.jumpToPostNode = null; this.wasAtBottom = true; @@ -339,6 +340,10 @@ export default class PostsView extends React.Component { this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight; }); } + scrollToBottomAnimated() { + var postList = $(this.refs.postlist); + postList.animate({scrollTop: this.refs.postlist.scrollHeight}, '500'); + } componentDidMount() { if (this.props.postList != null) { this.updateScrolling(); @@ -458,7 +463,7 @@ export default class PostsView extends React.Component { <ScrollToBottomArrows isScrolling={this.state.isScrolling} atBottom={this.wasAtBottom} - onClick={this.scrollToBottom} + onClick={this.scrollToBottomAnimated} /> <div ref='postlist' diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index f218270da..0ee89b9fa 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -168,7 +168,7 @@ export function getMoreChannels(force) { } } -export function getChannelExtraInfo(id) { +export function getChannelExtraInfo(id, memberLimit) { let channelId; if (id) { channelId = id; @@ -185,6 +185,7 @@ export function getChannelExtraInfo(id) { client.getChannelExtraInfo( channelId, + memberLimit, (data, textStatus, xhr) => { callTracker['getChannelExtraInfo_' + channelId] = 0; diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index e1c331aff..96d1ef720 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -824,10 +824,17 @@ export function getChannelCounts(success, error) { }); } -export function getChannelExtraInfo(id, success, error) { +export function getChannelExtraInfo(id, memberLimit, success, error) { + let url = '/api/v1/channels/' + id + '/extra_info'; + + if (memberLimit) { + url += '/' + memberLimit; + } + $.ajax({ - url: '/api/v1/channels/' + id + '/extra_info', + url, dataType: 'json', + contentType: 'application/json', type: 'GET', success, error: function onError(xhr, status, err) { diff --git a/web/sass-files/sass/partials/_post.scss b/web/sass-files/sass/partials/_post.scss index 937b08084..7b7c2d73a 100644 --- a/web/sass-files/sass/partials/_post.scss +++ b/web/sass-files/sass/partials/_post.scss @@ -286,8 +286,10 @@ body.ios { z-index: 50; @include opacity(0); @include single-transition(all, 0.3s); + display: none; &.scrolling { + display: block; @include opacity(1); } } @@ -417,12 +419,6 @@ body.ios { background-color: beige; } - ul { - margin: 0; - padding: 0; - } - - p { margin: 0; line-height: 1.6em; @@ -601,6 +597,7 @@ body.ios { right: 0; top: 30px; width: 65px; + white-space: nowrap; } .permalink-popover { @@ -634,8 +631,7 @@ body.ios { .dropdown { display: inline-block; visibility: hidden; - position: absolute; - right: 0; + margin-right: 5px; top: -1px; .dropdown-menu { @@ -671,20 +667,17 @@ body.ios { @include legacy-pie-clearfix; width: calc(100% - 75px); - img { - max-height: 400px; + p { + margin: 0 0 0.4em; } - ul { - margin-bottom: 0.6em; - padding: 5px 0 0 20px; - } - - ul + p { - margin-top: 1em; + img { + max-height: 400px; } ul, ol { + margin-bottom: 0.4em; + p { margin-bottom: 0; } diff --git a/web/sass-files/sass/partials/_post_right.scss b/web/sass-files/sass/partials/_post_right.scss index d820447f5..bd3d60622 100644 --- a/web/sass-files/sass/partials/_post_right.scss +++ b/web/sass-files/sass/partials/_post_right.scss @@ -25,6 +25,7 @@ .col__reply { top: 0; + text-align: right; } } |