Fix channel invite button on channel intro message and fix empty channel invite modal.
Этот коммит содержится в:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
const PostsView = require('./posts_view.jsx');
|
const PostsView = require('./posts_view.jsx');
|
||||||
const LoadingScreen = require('./loading_screen.jsx');
|
const LoadingScreen = require('./loading_screen.jsx');
|
||||||
|
const ChannelInviteModal = require('./channel_invite_modal.jsx');
|
||||||
|
|
||||||
const ChannelStore = require('../stores/channel_store.jsx');
|
const ChannelStore = require('../stores/channel_store.jsx');
|
||||||
const PostStore = require('../stores/post_store.jsx');
|
const PostStore = require('../stores/post_store.jsx');
|
||||||
@@ -50,6 +51,7 @@ export default class PostsViewContainer extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.showInviteModal = false;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -248,7 +250,7 @@ export default class PostsViewContainer extends React.Component {
|
|||||||
postViewScrolled={this.handlePostsViewScroll}
|
postViewScrolled={this.handlePostsViewScroll}
|
||||||
loadMorePostsTopClicked={this.loadMorePostsTop}
|
loadMorePostsTopClicked={this.loadMorePostsTop}
|
||||||
numPostsToDisplay={this.state.numPostsToDisplay}
|
numPostsToDisplay={this.state.numPostsToDisplay}
|
||||||
introText={channel ? createChannelIntroMessage(channel) : null}
|
introText={channel ? createChannelIntroMessage(channel, () => this.setState({showInviteModal: true})) : null}
|
||||||
messageSeparatorTime={this.state.currentLastViewed}
|
messageSeparatorTime={this.state.currentLastViewed}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -263,7 +265,13 @@ export default class PostsViewContainer extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id='post-list'>{postListCtls}</div>
|
<div id='post-list'>
|
||||||
|
{postListCtls}
|
||||||
|
<ChannelInviteModal
|
||||||
|
show={this.state.showInviteModal}
|
||||||
|
onModalDismissed={() => this.setState({showInviteModal: false})}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export default class Sidebar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hiddenDirectChannelCount = UserStore.getActiveOnlyProfileList().length - visibleDirectChannels.length;
|
const hiddenDirectChannelCount = UserStore.getActiveOnlyProfileList(true).length - visibleDirectChannels.length;
|
||||||
|
|
||||||
visibleDirectChannels.sort(this.sortChannelsByDisplayName);
|
visibleDirectChannels.sort(this.sortChannelsByDisplayName);
|
||||||
|
|
||||||
|
|||||||
@@ -193,13 +193,13 @@ class UserStoreClass extends EventEmitter {
|
|||||||
return BrowserStore.getItem('profiles', {});
|
return BrowserStore.getItem('profiles', {});
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveOnlyProfiles() {
|
getActiveOnlyProfiles(skipCurrent) {
|
||||||
const active = {};
|
const active = {};
|
||||||
const profiles = this.getProfiles();
|
const profiles = this.getProfiles();
|
||||||
const currentId = this.getCurrentId();
|
const currentId = this.getCurrentId();
|
||||||
|
|
||||||
for (var key in profiles) {
|
for (var key in profiles) {
|
||||||
if (profiles[key].delete_at === 0 && profiles[key].id !== currentId) {
|
if (!(profiles[key].id === currentId && skipCurrent) && profiles[key].delete_at === 0) {
|
||||||
active[key] = profiles[key];
|
active[key] = profiles[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ const ChannelStore = require('../stores/channel_store.jsx');
|
|||||||
const Constants = require('../utils/constants.jsx');
|
const Constants = require('../utils/constants.jsx');
|
||||||
const TeamStore = require('../stores/team_store.jsx');
|
const TeamStore = require('../stores/team_store.jsx');
|
||||||
|
|
||||||
export function createChannelIntroMessage(channel) {
|
export function createChannelIntroMessage(channel, showInviteModal) {
|
||||||
if (channel.type === 'D') {
|
if (channel.type === 'D') {
|
||||||
return createDMIntroMessage(channel);
|
return createDMIntroMessage(channel, showInviteModal);
|
||||||
} else if (ChannelStore.isDefault(channel)) {
|
} else if (ChannelStore.isDefault(channel)) {
|
||||||
return createDefaultIntroMessage(channel);
|
return createDefaultIntroMessage(channel);
|
||||||
} else if (channel.name === Constants.OFFTOPIC_CHANNEL) {
|
} else if (channel.name === Constants.OFFTOPIC_CHANNEL) {
|
||||||
return createOffTopicIntroMessage(channel);
|
return createOffTopicIntroMessage(channel, showInviteModal);
|
||||||
} else if (channel.type === 'O' || channel.type === 'P') {
|
} else if (channel.type === 'O' || channel.type === 'P') {
|
||||||
return createStandardIntroMessage(channel);
|
return createStandardIntroMessage(channel, showInviteModal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ export function createDMIntroMessage(channel) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOffTopicIntroMessage(channel) {
|
export function createOffTopicIntroMessage(channel, showInviteModal) {
|
||||||
return (
|
return (
|
||||||
<div className='channel-intro'>
|
<div className='channel-intro'>
|
||||||
<h4 className='channel-intro__title'>{'Beginning of ' + channel.display_name}</h4>
|
<h4 className='channel-intro__title'>{'Beginning of ' + channel.display_name}</h4>
|
||||||
@@ -91,10 +91,9 @@ export function createOffTopicIntroMessage(channel) {
|
|||||||
<i className='fa fa-pencil'></i>{'Set a header'}
|
<i className='fa fa-pencil'></i>{'Set a header'}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className='intro-links'
|
role='menuitem'
|
||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
onClick={showInviteModal}
|
||||||
data-target='#channel_invite'
|
|
||||||
>
|
>
|
||||||
<i className='fa fa-user-plus'></i>{'Invite others to this channel'}
|
<i className='fa fa-user-plus'></i>{'Invite others to this channel'}
|
||||||
</a>
|
</a>
|
||||||
@@ -155,7 +154,7 @@ export function createDefaultIntroMessage(channel) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createStandardIntroMessage(channel) {
|
export function createStandardIntroMessage(channel, showInviteModal) {
|
||||||
var uiName = channel.display_name;
|
var uiName = channel.display_name;
|
||||||
var creatorName = '';
|
var creatorName = '';
|
||||||
|
|
||||||
@@ -206,14 +205,12 @@ export function createStandardIntroMessage(channel) {
|
|||||||
<i className='fa fa-pencil'></i>{'Set a header'}
|
<i className='fa fa-pencil'></i>{'Set a header'}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className='intro-links'
|
role='menuitem'
|
||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
onClick={showInviteModal}
|
||||||
data-target='#channel_invite'
|
|
||||||
>
|
>
|
||||||
<i className='fa fa-user-plus'></i>{'Invite others to this ' + uiType}
|
<i className='fa fa-user-plus'></i>{'Invite others to this ' + uiType}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user