diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/channel_notifications.jsx | 8 | ||||
-rw-r--r-- | web/react/components/create_post.jsx | 8 | ||||
-rw-r--r-- | web/react/components/setting_item_max.jsx | 2 | ||||
-rw-r--r-- | web/react/components/textbox.jsx | 9 | ||||
-rw-r--r-- | web/react/components/user_settings_notifications.jsx | 14 | ||||
-rw-r--r-- | web/react/package.json | 5 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 2 |
7 files changed, 22 insertions, 26 deletions
diff --git a/web/react/components/channel_notifications.jsx b/web/react/components/channel_notifications.jsx index 173646597..83067240d 100644 --- a/web/react/components/channel_notifications.jsx +++ b/web/react/components/channel_notifications.jsx @@ -162,6 +162,13 @@ export default class ChannelNotifications extends React.Component { e.preventDefault(); }.bind(this); + let curChannel = ChannelStore.get(this.state.channelId); + let extraInfo = (<span>These settings will override the global notification settings</span>); + + if (curChannel && curChannel.display_name) { + extraInfo = (<span>These settings will override the global notification settings for the <b>{curChannel.display_name}</b> channel</span>); + } + return ( <SettingItemMax title='Send desktop notifications' @@ -169,6 +176,7 @@ export default class ChannelNotifications extends React.Component { submit={this.handleUpdate} server_error={serverError} updateSection={handleUpdateSection} + extraInfo={extraInfo} /> ); } diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index ce4ebac9e..8af9c36b3 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -117,7 +117,6 @@ export default class CreatePost extends React.Component { Client.createPost(post, channel, function handlePostSuccess(data) { - this.resizePostHolder(); AsyncClient.getPosts(); let member = ChannelStore.getMember(channel.id); @@ -129,7 +128,7 @@ export default class CreatePost extends React.Component { type: ActionTypes.RECIEVED_POST, post: data }); - }.bind(this), + }, function handlePostError(err) { let state = {}; @@ -149,9 +148,6 @@ export default class CreatePost extends React.Component { ); } } - componentDidUpdate() { - this.resizePostHolder(); - } postMsgKeyPress(e) { if (e.which === 13 && !e.shiftKey && !e.altKey) { e.preventDefault(); @@ -166,7 +162,6 @@ export default class CreatePost extends React.Component { } } handleUserInput(messageText) { - this.resizePostHolder(); this.setState({messageText: messageText}); let draft = PostStore.getCurrentDraft(); @@ -317,6 +312,7 @@ export default class CreatePost extends React.Component { <Textbox onUserInput={this.handleUserInput} onKeyPress={this.postMsgKeyPress} + onHeightChange={this.resizePostHolder} messageText={this.state.messageText} createMessage='Write a message...' channelId={this.state.channelId} diff --git a/web/react/components/setting_item_max.jsx b/web/react/components/setting_item_max.jsx index e67e458af..996b63873 100644 --- a/web/react/components/setting_item_max.jsx +++ b/web/react/components/setting_item_max.jsx @@ -15,7 +15,7 @@ export default class SettingItemMax extends React.Component { var extraInfo = null; if (this.props.extraInfo) { - extraInfo = this.props.extraInfo; + extraInfo = (<div className='setting-list__hint'>{this.props.extraInfo}</div>); } var submit = ''; diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index 0408a262d..b4518fe80 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -121,7 +121,6 @@ export default class Textbox extends React.Component { } this.addedMention = false; this.refs.commands.getSuggestedCommands(nextProps.messageText); - this.resize(); } updateMentionTab(mentionText) { // using setTimeout so dispatch isn't called during an in progress dispatch @@ -135,7 +134,6 @@ export default class Textbox extends React.Component { } handleChange() { this.props.onUserInput(React.findDOMNode(this.refs.message).value); - this.resize(); } handleKeyPress(e) { const text = React.findDOMNode(this.refs.message).value; @@ -244,6 +242,8 @@ export default class Textbox extends React.Component { const e = React.findDOMNode(this.refs.message); const w = React.findDOMNode(this.refs.wrapper); + let prevHeight = $(e).height(); + const lht = parseInt($(e).css('lineHeight'), 10); const lines = e.scrollHeight / lht; let mod = 15; @@ -259,6 +259,10 @@ export default class Textbox extends React.Component { $(e).css({height: 'auto', 'overflow-y': 'scroll'}).height(167); $(w).css({height: 'auto'}).height(167); } + + if (prevHeight !== $(e).height()) { + this.props.onHeightChange(); + } } handleFocus() { const elm = React.findDOMNode(this.refs.message); @@ -316,5 +320,6 @@ Textbox.propTypes = { messageText: React.PropTypes.string.isRequired, onUserInput: React.PropTypes.func.isRequired, onKeyPress: React.PropTypes.func.isRequired, + onHeightChange: React.PropTypes.func.isRequired, createMessage: React.PropTypes.string.isRequired }; diff --git a/web/react/components/user_settings_notifications.jsx b/web/react/components/user_settings_notifications.jsx index 5fe6bbb4e..33db1a332 100644 --- a/web/react/components/user_settings_notifications.jsx +++ b/web/react/components/user_settings_notifications.jsx @@ -1,7 +1,6 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. -var ChannelStore = require('../stores/channel_store.jsx'); var UserStore = require('../stores/user_store.jsx'); var SettingItemMin = require('./setting_item_min.jsx'); var SettingItemMax = require('./setting_item_max.jsx'); @@ -69,11 +68,9 @@ function getNotificationsStateFromStores() { } } - var curChannel = ChannelStore.getCurrent().display_name; - return {notifyLevel: desktop, enableEmail: email, soundNeeded: soundNeeded, enableSound: sound, usernameKey: usernameKey, mentionKey: mentionKey, customKeys: customKeys, customKeysChecked: customKeys.length > 0, - firstNameKey: firstNameKey, allKey: allKey, channelKey: channelKey, curChannel: curChannel}; + firstNameKey: firstNameKey, allKey: allKey, channelKey: channelKey}; } export default class NotificationsTab extends React.Component { @@ -147,12 +144,10 @@ export default class NotificationsTab extends React.Component { } componentDidMount() { UserStore.addChangeListener(this.onListenerChange); - ChannelStore.addChangeListener(this.onListenerChange); $('#user_settings').on('hidden.bs.modal', this.handleClose); } componentWillUnmount() { UserStore.removeChangeListener(this.onListenerChange); - ChannelStore.removeChangeListener(this.onListenerChange); $('#user_settings').off('hidden.bs.modal', this.handleClose); this.props.updateSection(''); } @@ -271,12 +266,6 @@ export default class NotificationsTab extends React.Component { e.preventDefault(); }.bind(this); - let extraInfo = ( - <div className='setting-list__hint'> - These settings will override the global notification settings for the <b>{this.state.curChannel}</b> channel - </div> - ); - desktopSection = ( <SettingItemMax title='Send desktop notifications' @@ -284,7 +273,6 @@ export default class NotificationsTab extends React.Component { submit={this.handleSubmit} server_error={serverError} updateSection={handleUpdateDesktopSection} - extraInfo={extraInfo} /> ); } else { diff --git a/web/react/package.json b/web/react/package.json index 7593cfd1b..0aa966f09 100644 --- a/web/react/package.json +++ b/web/react/package.json @@ -22,13 +22,12 @@ }, "scripts": { "start": "watchify --extension=jsx -o ../static/js/bundle.js -v -d ./**/*.jsx", - "build": "NODE_ENV=production browserify ./**/*.jsx | uglifyjs > ../static/js/bundle.min.js", - "build_old": "NODE_ENV=production browserify ./**/*.jsx | uglifyjs -cm > ../static/js/bundle.min.js", + "build": "NODE_ENV=production browserify ./**/*.jsx | uglifyjs > ../static/js/bundle.min.js", "test": "jest" }, "browserify": { "transform": [ - ["babelify", {"blacklist": ["strict"]}], + "babelify", "envify" ] }, diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index dc229bd36..ea42256aa 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -457,7 +457,7 @@ export function textToJsx(textin, options) { var inner = []; // Function specific regex - var hashRegex = /^href="#[^']+"|(#[A-Za-z]+[A-Za-z0-9_\-]*[A-Za-z0-9])$/g; + var hashRegex = /^href="#[^']+"|(^#[A-Za-z]+[A-Za-z0-9_\-]*[A-Za-z0-9])$/g; var implicitKeywords = UserStore.getCurrentMentionKeys(); |