summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-11-12 14:55:52 -0500
committerChristopher Speller <crspeller@gmail.com>2015-11-12 14:55:52 -0500
commitc7fe8510ce663feb26056b34fd18c0e833eb3573 (patch)
tree0367dc560667b65a9a5a7011fa277af8aecd5c0e /web/react
parent931f4f764cbd18f1f5189e03ece83685e4dc6ffa (diff)
parent10901b4d50db171fa83e0c289d0eb34f4422f156 (diff)
downloadchat-c7fe8510ce663feb26056b34fd18c0e833eb3573.tar.gz
chat-c7fe8510ce663feb26056b34fd18c0e833eb3573.tar.bz2
chat-c7fe8510ce663feb26056b34fd18c0e833eb3573.zip
Merge branch 'release-1.2'
Diffstat (limited to 'web/react')
-rw-r--r--web/react/components/navbar.jsx4
-rw-r--r--web/react/components/post_body.jsx24
-rw-r--r--web/react/components/posts_view_container.jsx12
-rw-r--r--web/react/components/sidebar.jsx2
-rw-r--r--web/react/components/user_settings/custom_theme_chooser.jsx1
-rw-r--r--web/react/stores/user_store.jsx4
-rw-r--r--web/react/utils/channel_intro_mssages.jsx19
7 files changed, 46 insertions, 20 deletions
diff --git a/web/react/components/navbar.jsx b/web/react/components/navbar.jsx
index ff53816c7..af29f219e 100644
--- a/web/react/components/navbar.jsx
+++ b/web/react/components/navbar.jsx
@@ -140,7 +140,9 @@ export default class Navbar extends React.Component {
role='menuitem'
href='#'
onClick={() => this.setState({showEditChannelPurposeModal: true})}
- />
+ >
+ {'Set Channel Purpose...'}
+ </a>
</li>
);
}
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx
index c57c4490b..1e08a0661 100644
--- a/web/react/components/post_body.jsx
+++ b/web/react/components/post_body.jsx
@@ -18,6 +18,7 @@ export default class PostBody extends React.Component {
this.receivedYoutubeData = false;
this.isGifLoading = false;
+ this.handleUserChange = this.handleUserChange.bind(this);
this.parseEmojis = this.parseEmojis.bind(this);
this.createEmbed = this.createEmbed.bind(this);
this.createGifEmbed = this.createGifEmbed.bind(this);
@@ -25,7 +26,14 @@ export default class PostBody extends React.Component {
this.createYoutubeEmbed = this.createYoutubeEmbed.bind(this);
const linkData = Utils.extractLinks(this.props.post.message);
- this.state = {links: linkData.links, message: linkData.text, post: this.props.post};
+ const profiles = UserStore.getProfiles();
+
+ this.state = {
+ links: linkData.links,
+ message: linkData.text,
+ post: this.props.post
+ hasUserProfiles: profiles && Object.keys(profiles).length > 1
+ };
}
getAllChildNodes(nodeIn) {
@@ -55,12 +63,26 @@ export default class PostBody extends React.Component {
componentDidMount() {
this.parseEmojis();
+
+ UserStore.addChangeListener(this.handleUserChange);
}
componentDidUpdate() {
this.parseEmojis();
}
+ componentWillUnmount() {
+ UserStore.removeChangeListener(this.handleUserChange);
+ }
+
+ handleUserChange() {
+ if (!this.state.hasProfiles) {
+ const profiles = UserStore.getProfiles();
+
+ this.setState({hasProfiles: profiles && Object.keys(profiles).length > 1});
+ }
+ }
+
componentWillReceiveProps(nextProps) {
const linkData = Utils.extractLinks(nextProps.post.message);
if (this.props.post.filenames.length === 0 && this.state.links && this.state.links.length > 0) {
diff --git a/web/react/components/posts_view_container.jsx b/web/react/components/posts_view_container.jsx
index c76c8a57e..2cb56cd47 100644
--- a/web/react/components/posts_view_container.jsx
+++ b/web/react/components/posts_view_container.jsx
@@ -3,6 +3,7 @@
const PostsView = require('./posts_view.jsx');
const LoadingScreen = require('./loading_screen.jsx');
+const ChannelInviteModal = require('./channel_invite_modal.jsx');
const ChannelStore = require('../stores/channel_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;
}
componentDidMount() {
@@ -248,7 +250,7 @@ export default class PostsViewContainer extends React.Component {
postViewScrolled={this.handlePostsViewScroll}
loadMorePostsTopClicked={this.loadMorePostsTop}
numPostsToDisplay={this.state.numPostsToDisplay}
- introText={channel ? createChannelIntroMessage(channel) : null}
+ introText={channel ? createChannelIntroMessage(channel, () => this.setState({showInviteModal: true})) : null}
messageSeparatorTime={this.state.currentLastViewed}
/>
);
@@ -263,7 +265,13 @@ export default class PostsViewContainer extends React.Component {
}
return (
- <div id='post-list'>{postListCtls}</div>
+ <div id='post-list'>
+ {postListCtls}
+ <ChannelInviteModal
+ show={this.state.showInviteModal}
+ onModalDismissed={() => this.setState({showInviteModal: false})}
+ />
+ </div>
);
}
}
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index b02ec0692..542f433f3 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -144,7 +144,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);
diff --git a/web/react/components/user_settings/custom_theme_chooser.jsx b/web/react/components/user_settings/custom_theme_chooser.jsx
index 895d0c500..3dbed72c3 100644
--- a/web/react/components/user_settings/custom_theme_chooser.jsx
+++ b/web/react/components/user_settings/custom_theme_chooser.jsx
@@ -129,7 +129,6 @@ export default class CustomThemeChooser extends React.Component {
{'Copy and paste to share theme colors:'}
</label>
<input
- readOnly='true'
type='text'
className='form-control'
value={colors}
diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx
index e0ecc37aa..40b64b34b 100644
--- a/web/react/stores/user_store.jsx
+++ b/web/react/stores/user_store.jsx
@@ -197,13 +197,13 @@ class UserStoreClass extends EventEmitter {
return BrowserStore.getItem('profiles', {});
}
- getActiveOnlyProfiles() {
+ getActiveOnlyProfiles(skipCurrent) {
const active = {};
const profiles = this.getProfiles();
const currentId = this.getCurrentId();
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];
}
}
diff --git a/web/react/utils/channel_intro_mssages.jsx b/web/react/utils/channel_intro_mssages.jsx
index 161c79761..f27e23a82 100644
--- a/web/react/utils/channel_intro_mssages.jsx
+++ b/web/react/utils/channel_intro_mssages.jsx
@@ -9,15 +9,15 @@ const ChannelStore = require('../stores/channel_store.jsx');
const Constants = require('../utils/constants.jsx');
const TeamStore = require('../stores/team_store.jsx');
-export function createChannelIntroMessage(channel) {
+export function createChannelIntroMessage(channel, showInviteModal) {
if (channel.type === 'D') {
return createDMIntroMessage(channel);
} else if (ChannelStore.isDefault(channel)) {
return createDefaultIntroMessage(channel);
} else if (channel.name === Constants.OFFTOPIC_CHANNEL) {
- return createOffTopicIntroMessage(channel);
+ return createOffTopicIntroMessage(channel, showInviteModal);
} 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 (
<div className='channel-intro'>
<h4 className='channel-intro__title'>{'Beginning of ' + channel.display_name}</h4>
@@ -91,10 +91,8 @@ export function createOffTopicIntroMessage(channel) {
<i className='fa fa-pencil'></i>{'Set a header'}
</a>
<a
- className='intro-links'
href='#'
- data-toggle='modal'
- data-target='#channel_invite'
+ onClick={showInviteModal}
>
<i className='fa fa-user-plus'></i>{'Invite others to this channel'}
</a>
@@ -155,7 +153,7 @@ export function createDefaultIntroMessage(channel) {
);
}
-export function createStandardIntroMessage(channel) {
+export function createStandardIntroMessage(channel, showInviteModal) {
var uiName = channel.display_name;
var creatorName = '';
@@ -206,14 +204,11 @@ export function createStandardIntroMessage(channel) {
<i className='fa fa-pencil'></i>{'Set a header'}
</a>
<a
- className='intro-links'
href='#'
- data-toggle='modal'
- data-target='#channel_invite'
+ onClick={showInviteModal}
>
<i className='fa fa-user-plus'></i>{'Invite others to this ' + uiType}
</a>
-
</div>
);
}