hunk.code_window:     }
       return str.replace(/\w\S*/g, doTitleCase);
   }
   export function applyTheme(theme) {
       if (theme.sidebarBg) {
           changeCss('.app__body .sidebar--left, .app__body .sidebar--left .sidebar__divider .sidebar__divider__text, .app__body .modal .settings-modal .settings-table .settings-links, .app__body .sidebar--menu', 'background:' + theme.sidebarBg, 1);
  
hunk.labels: keep keep keep add keep keep keep
hunk.after_edit: export function isHexColor(value) {
       return value && (/^#[0-9a-f]{3}([0-9a-f]{3})?$/i).test(value);
   }
  
hunk.file_path: webapp/utils/utils.jsx
hunk.type: add
file: // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
  // See License.txt for license information.
  
  import $ from 'jquery';
  import ReactDOM from 'react-dom';
  import {FormattedMessage} from 'react-intl';
  
  import {Modal} from 'react-bootstrap';
  
  import React from 'react';
  
  export default class GetLinkModal extends React.Component {
      constructor(props) {
          super(props);
  
          this.onHide = this.onHide.bind(this);
  
          this.copyLink = this.copyLink.bind(this);
  
          this.state = {
              copiedLink: false
          };
      }
  
      onHide() {
          this.setState({copiedLink: false});
  
          this.props.onHide();
      }
  
      copyLink() {
          var copyTextarea = $(ReactDOM.findDOMNode(this.refs.textarea));
          copyTextarea.select();
  
          try {
              var successful = document.execCommand('copy');
              if (successful) {
                  this.setState({copiedLink: true});
              } else {
                  this.setState({copiedLink: false});
              }
          } catch (err) {
              this.setState({copiedLink: false});
          }
      }
  
      render() {
          let helpText = null;
          if (this.props.helpText) {
              helpText = (
                  <p>
                      {this.props.helpText}
                      <br/>
                      <br/>
                  </p>
              );
          }
  
          let copyLink = null;
          if (document.queryCommandSupported('copy')) {
              copyLink = (
                  <button
                      data-copy-btn='true'
                      type='button'
                      className='btn btn-primary pull-left'
                      onClick={this.copyLink}
                  >
                      <FormattedMessage
                          id='get_link.copy'
                          defaultMessage='Copy Link'
                      />
                  </button>
              );
          }
  
          const linkText = (
              <textarea
                  className='form-control no-resize min-height'
                  readOnly='true'
                  ref='textarea'
                  value={this.props.link}
              />
          );
  
          var copyLinkConfirm = null;
          if (this.state.copiedLink) {
              copyLinkConfirm = (
                  <p className='alert alert-success alert--confirm'>
                      <i className='fa fa-check'></i>
                      <FormattedMessage
                          id='get_link.clipboard'
                          defaultMessage=' Link copied to clipboard.'
                      />
                  </p>
              );
          }
  
          return (
              <Modal
                  show={this.props.show}
                  onHide={this.onHide}
              >
                  <Modal.Header closeButton={true}>
                      <h4 className='modal-title'>{this.props.title}</h4>
                  </Modal.Header>
                  <Modal.Body>
                      {helpText}
                      {linkText}
                  </Modal.Body>
                  <Modal.Footer>
                      <button
                          type='button'
                          className='btn btn-default'
                          onClick={this.onHide}
                      >
                          <FormattedMessage
                              id='get_link.close'
                              defaultMessage='Close'
                          />
                      </button>
                      {copyLink}
                      {copyLinkConfirm}
                  </Modal.Footer>
              </Modal>
          );
      }
  }
  
  GetLinkModal.propTypes = {
      show: React.PropTypes.bool.isRequired,
      onHide: React.PropTypes.func.isRequired,
      title: React.PropTypes.string.isRequired,
      helpText: React.PropTypes.string,
      link: React.PropTypes.string.isRequired
  };
  
  GetLinkModal.defaultProps = {
      helpText: null
  };
  