From 46d3515fad57f3c777b44d96077fec5a0ab944c1 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Fri, 10 Jul 2015 17:07:01 -0700
Subject: Changes to notifcation carriage return parsing

---
 web/react/components/sidebar.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 2095978e8..4a57ec263 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -249,7 +249,7 @@ var SidebarLoggedIn = React.createClass({
 
                 var repRegex = new RegExp("<br>", "g");
                 var post = JSON.parse(msg.props.post);
-                var msg = post.message.replace(repRegex, "\n").split("\n")[0].replace("<mention>", "").replace("</mention>", "");
+                var msg = post.message.replace(repRegex, "\n").replace("\n", "").replace("<mention>", "").replace("</mention>", "");
                 if (msg.length > 50) {
                     msg = msg.substring(0,49) + "...";
                 }
-- 
cgit v1.2.3-1-g7c22


From dcea1de00661a9fba9129a35b4c6451234a18d9a Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Fri, 10 Jul 2015 17:32:13 -0700
Subject: Changed parser for desktop notifications to replace returns with a
 single space.

---
 web/react/components/sidebar.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 4a57ec263..934a4d22a 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -249,7 +249,7 @@ var SidebarLoggedIn = React.createClass({
 
                 var repRegex = new RegExp("<br>", "g");
                 var post = JSON.parse(msg.props.post);
-                var msg = post.message.replace(repRegex, "\n").replace("\n", "").replace("<mention>", "").replace("</mention>", "");
+                var msg = post.message.replace(repRegex, "\n").replace(/\n+/g, " ").replace("<mention>", "").replace("</mention>", "");
                 if (msg.length > 50) {
                     msg = msg.substring(0,49) + "...";
                 }
-- 
cgit v1.2.3-1-g7c22


From f406beca8b501dad508d1ffb900bf994c4192086 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Fri, 10 Jul 2015 18:41:42 -0700
Subject: If a message has no text but has an attached image or file the
 desktop notification now says uploaded an image or uploaded a file
 respectively (if both, defaults to image)

---
 web/react/components/sidebar.jsx | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 934a4d22a..cae9425d3 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -249,11 +249,27 @@ var SidebarLoggedIn = React.createClass({
 
                 var repRegex = new RegExp("<br>", "g");
                 var post = JSON.parse(msg.props.post);
+                var msgProps = msg.props;
                 var msg = post.message.replace(repRegex, "\n").replace(/\n+/g, " ").replace("<mention>", "").replace("</mention>", "");
+                
                 if (msg.length > 50) {
                     msg = msg.substring(0,49) + "...";
                 }
-                utils.notifyMe(title, username + " wrote: " + msg, channel);
+
+                if (msg.length === 0) {
+                    if (msgProps.image) {
+                        utils.notifyMe(title, username + " uploaded an image", channel);
+                    }
+                    else if (msgProps.otherFile) {
+                        utils.notifyMe(title, username + " uploaded a file", channel);
+                    }
+                    else {
+                        utils.notifyMe(title, username + " did something new", channel);
+                    }
+                }
+                else {
+                    utils.notifyMe(title, username + " wrote: " + msg, channel);
+                }
                 if (!user.notify_props || user.notify_props.desktop_sound === "true") {
                     utils.ding();
                 }
-- 
cgit v1.2.3-1-g7c22


From 1c7f0be268046d2b509e23268eebcbbef78c5a24 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Thu, 9 Jul 2015 15:49:23 -0400
Subject: Renamed all clientside references from full_name to nickname

---
 web/react/components/sidebar.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index cae9425d3..742720048 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -131,7 +131,7 @@ function getStateFromStores() {
         var channel = ChannelStore.getByName(channelName);
 
         if (channel != null) {
-            channel.display_name = teammate.full_name.trim() != "" ? teammate.full_name : teammate.username;
+            channel.display_name = teammate.nickname.trim() != "" ? teammate.nickname : teammate.username;
             channel.teammate_username = teammate.username;
 
             channel.status = UserStore.getStatus(teammate.id);
@@ -150,7 +150,7 @@ function getStateFromStores() {
             var tempChannel = {};
             tempChannel.fake = true;
             tempChannel.name = channelName;
-            tempChannel.display_name = teammate.full_name.trim() != "" ? teammate.full_name : teammate.username;
+            tempChannel.display_name = teammate.nickname.trim() != "" ? teammate.nickname : teammate.username;
             tempChannel.status = UserStore.getStatus(teammate.id);
             tempChannel.last_post_at = 0;
             readDirectChannels.push(tempChannel);
-- 
cgit v1.2.3-1-g7c22


From 098cbcdc21effeebe7e57fbd912a785e85cbfc5d Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 13 Jul 2015 17:47:57 -0400
Subject: Unify all locations where we determine a user's display named based
 off of their nickname/username into a helper function

---
 web/react/components/sidebar.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 742720048..65727c597 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -131,7 +131,7 @@ function getStateFromStores() {
         var channel = ChannelStore.getByName(channelName);
 
         if (channel != null) {
-            channel.display_name = teammate.nickname.trim() != "" ? teammate.nickname : teammate.username;
+            channel.display_name = utils.getDisplayName(teammate);
             channel.teammate_username = teammate.username;
 
             channel.status = UserStore.getStatus(teammate.id);
@@ -150,7 +150,7 @@ function getStateFromStores() {
             var tempChannel = {};
             tempChannel.fake = true;
             tempChannel.name = channelName;
-            tempChannel.display_name = teammate.nickname.trim() != "" ? teammate.nickname : teammate.username;
+            tempChannel.display_name = utils.getDisplayName(teammate);
             tempChannel.status = UserStore.getStatus(teammate.id);
             tempChannel.last_post_at = 0;
             readDirectChannels.push(tempChannel);
-- 
cgit v1.2.3-1-g7c22


From c6fb95912bb481791c1ca370a46a4da9c05d05ad Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Wed, 8 Jul 2015 11:50:10 -0400
Subject: Changing the way we mattermost handles URLs. team.domain.com becomes
 domain.com/team. Renaming team.Name to team.DisplayName and team.Domain to
 team.Name. So: team.Name -> url safe name. team.DisplayName -> nice name for
 users

---
 web/react/components/sidebar.jsx | 116 ++-------------------------------------
 1 file changed, 4 insertions(+), 112 deletions(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 65727c597..3cf67e410 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -6,6 +6,7 @@ var ChannelStore = require('../stores/channel_store.jsx');
 var AsyncClient = require('../utils/async_client.jsx');
 var SocketStore = require('../stores/socket_store.jsx');
 var UserStore = require('../stores/user_store.jsx');
+var TeamStore = require('../stores/team_store.jsx');
 var utils = require('../utils/utils.jsx');
 var SidebarHeader = require('./sidebar_header.jsx');
 var SearchBox = require('./search_bar.jsx');
@@ -13,93 +14,6 @@ var SearchBox = require('./search_bar.jsx');
 var Constants = require('../utils/constants.jsx');
 var ActionTypes = Constants.ActionTypes;
 
-var SidebarLoginForm = React.createClass({
-    handleSubmit: function(e) {
-        e.preventDefault();
-        var state = { }
-
-        var domain = this.refs.domain.getDOMNode().value.trim();
-        if (!domain) {
-            state.server_error = "A domain is required"
-            this.setState(state);
-            return;
-        }
-
-       var email = this.refs.email.getDOMNode().value.trim();
-        if (!email) {
-            state.server_error = "An email is required"
-            this.setState(state);
-            return;
-        }
-
-        var password = this.refs.password.getDOMNode().value.trim();
-        if (!password) {
-            state.server_error = "A password is required"
-            this.setState(state);
-            return;
-        }
-
-        state.server_error = "";
-        this.setState(state);
-
-        client.loginByEmail(domain, email, password,
-            function(data) {
-                UserStore.setLastDomain(domain);
-                UserStore.setLastEmail(email);
-                UserStore.setCurrentUser(data);
-
-                var redirect = utils.getUrlParameter("redirect");
-                if (redirect) {
-                    window.location.href = decodeURI(redirect);
-                } else {
-                    window.location.href = '/channels/town-square';
-                }
-
-            }.bind(this),
-            function(err) {
-                if (err.message == "Login failed because email address has not been verified") {
-                    window.location.href = '/verify?domain=' + encodeURIComponent(domain) + '&email=' + encodeURIComponent(email);
-                    return;
-                }
-                state.server_error = err.message;
-                this.valid = false;
-                this.setState(state);
-            }.bind(this)
-        );
-    },
-    getInitialState: function() {
-        return { };
-    },
-    render: function() {
-        var server_error = this.state.server_error ? <label className="control-label">{this.state.server_error}</label> : null;
-
-        var subDomain = utils.getSubDomain();
-        var subDomainClass = "form-control hidden";
-
-        if (subDomain == "") {
-            subDomain = UserStore.getLastDomain();
-            subDomainClass = "form-control";
-        }
-
-        return (
-            <form className="" onSubmit={this.handleSubmit}>
-                <a href="/find_team">{"Find your " + strings.Team}</a>
-                <div className={server_error ? 'form-group has-error' : 'form-group'}>
-                    { server_error }
-                    <input type="text" className={subDomainClass} name="domain" defaultValue={subDomain} ref="domain" placeholder="Domain" />
-                </div>
-                <div className={server_error ? 'form-group has-error' : 'form-group'}>
-                    <input type="text" className="form-control" name="email" defaultValue={UserStore.getLastEmail()}  ref="email" placeholder="Email" />
-                </div>
-                <div className={server_error ? 'form-group has-error' : 'form-group'}>
-                    <input type="password" className="form-control" name="password" ref="password" placeholder="Password" />
-                </div>
-                <button type="submit" className="btn btn-default">Login</button>
-            </form>
-        );
-    }
-});
-
 function getStateFromStores() {
     var members = ChannelStore.getAllMembers();
     var team_member_map = UserStore.getActiveOnlyProfiles();
@@ -192,7 +106,7 @@ function getStateFromStores() {
     };
 }
 
-var SidebarLoggedIn = React.createClass({
+module.exports = React.createClass({
     componentDidMount: function() {
         ChannelStore.addChangeListener(this._onChange);
         UserStore.addChangeListener(this._onChange);
@@ -383,7 +297,7 @@ var SidebarLoggedIn = React.createClass({
                 );
             } else {
                 return (
-                    <li key={channel.name} className={active}><a className={"sidebar-channel " + titleClass} href={"/channels/"+channel.name}><span className="status" dangerouslySetInnerHTML={{__html: statusIcon}} /> {badge}{channel.display_name}</a></li>
+                    <li key={channel.name} className={active}><a className={"sidebar-channel " + titleClass} href={TeamStore.getCurrentTeamUrl() + "/channels/"+channel.name}><span className="status" dangerouslySetInnerHTML={{__html: statusIcon}} /> {badge}{channel.display_name}</a></li>
                 );
             }
 
@@ -414,7 +328,7 @@ var SidebarLoggedIn = React.createClass({
         }
         return (
             <div>
-                <SidebarHeader teamName={this.props.teamName} teamType={this.props.teamType} />
+                <SidebarHeader teamDisplayName={this.props.teamDisplayName} teamType={this.props.teamType} />
                 <SearchBox />
 
                 <div className="nav-pills__container">
@@ -440,25 +354,3 @@ var SidebarLoggedIn = React.createClass({
         );
     }
 });
-
-var SidebarLoggedOut = React.createClass({
-    render: function() {
-        return (
-            <div>
-                <SidebarHeader teamName={this.props.teamName} />
-                <SidebarLoginForm />
-            </div>
-        );
-    }
-});
-
-module.exports = React.createClass({
-    render: function() {
-        var currentId = UserStore.getCurrentId();
-        if (currentId != null) {
-            return <SidebarLoggedIn teamName={this.props.teamName} teamType={this.props.teamType} />;
-        } else {
-            return <SidebarLoggedOut teamName={this.props.teamName} />;
-        }
-    }
-});
-- 
cgit v1.2.3-1-g7c22

