mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
remove admin's ability to manage members of default channel (fixes #172)
This commit is contained in:
@@ -142,10 +142,10 @@ module.exports = React.createClass({
|
||||
return null;
|
||||
}
|
||||
|
||||
var description = utils.textToJsx(this.state.channel.description, {"singleline": true, "noMentionHighlight": true});
|
||||
var popoverContent = React.renderToString(<MessageWrapper message={this.state.channel.description}/>);
|
||||
var channelTitle = this.state.channel.display_name;
|
||||
var channelName = this.state.channel.name;
|
||||
var channel = this.state.channel;
|
||||
var description = utils.textToJsx(channel.description, {"singleline": true, "noMentionHighlight": true});
|
||||
var popoverContent = React.renderToString(<MessageWrapper message={channel.description}/>);
|
||||
var channelTitle = channel.display_name;
|
||||
var currentId = UserStore.getCurrentId();
|
||||
var isAdmin = this.state.memberChannel.roles.indexOf("admin") > -1 || this.state.memberTeam.roles.indexOf("admin") > -1;
|
||||
var isDirect = (this.state.channel.type === 'D');
|
||||
@@ -169,23 +169,26 @@ module.exports = React.createClass({
|
||||
<span className="glyphicon glyphicon-chevron-down header-dropdown__icon"></span>
|
||||
</a>
|
||||
<ul className="dropdown-menu" role="menu" aria-labelledby="channel_header_dropdown">
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_info" data-channelid={this.state.channel.id} href="#">View Info</a></li>
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_invite" href="#">Add Members</a></li>
|
||||
{ isAdmin ?
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_info" data-channelid={channel.id} href="#">View Info</a></li>
|
||||
{ !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_invite" href="#">Add Members</a></li>
|
||||
: null
|
||||
}
|
||||
{ isAdmin && !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_members" href="#">Manage Members</a></li>
|
||||
: null
|
||||
}
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#edit_channel" data-desc={this.state.channel.description} data-title={channelTitle} data-channelid={this.state.channel.id}>Set Channel Description...</a></li>
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#channel_notifications" data-title={channelTitle} data-channelid={this.state.channel.id}>Notification Preferences</a></li>
|
||||
{ isAdmin && channelName != Constants.DEFAULT_CHANNEL ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#rename_channel" data-display={channelTitle} data-name={this.state.channel.name} data-channelid={this.state.channel.id}>Rename Channel...</a></li>
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#edit_channel" data-desc={channel.description} data-title={channel.display_name} data-channelid={channel.id}>Set Channel Description...</a></li>
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#channel_notifications" data-title={channel.display_name} data-channelid={channel.id}>Notification Preferences</a></li>
|
||||
{ isAdmin && !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#rename_channel" data-display={channel.display_name} data-name={channel.name} data-channelid={channel.id}>Rename Channel...</a></li>
|
||||
: null
|
||||
}
|
||||
{ isAdmin && channelName != Constants.DEFAULT_CHANNEL ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#delete_channel" data-title={channelTitle} data-channelid={this.state.channel.id}>Delete Channel...</a></li>
|
||||
{ isAdmin && !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#delete_channel" data-title={channel.display_name} data-channelid={channel.id}>Delete Channel...</a></li>
|
||||
: null
|
||||
}
|
||||
{ channelName != Constants.DEFAULT_CHANNEL ?
|
||||
{ !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" href="#" onClick={this.handleLeave}>Leave Channel</a></li>
|
||||
: null
|
||||
}
|
||||
@@ -197,7 +200,7 @@ module.exports = React.createClass({
|
||||
<a href="#"><strong className="heading">{channelTitle}</strong></a>
|
||||
}
|
||||
</th>
|
||||
<th><PopoverListMembers members={this.state.users} channelId={this.state.channel.id} /></th>
|
||||
<th><PopoverListMembers members={this.state.users} channelId={channel.id} /></th>
|
||||
<th className="search-bar__container"><NavbarSearchBox /></th>
|
||||
<th>
|
||||
<div className="dropdown" style={{marginLeft:5, marginRight:10}}>
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var utils = require('../utils/utils.jsx');
|
||||
var client = require('../utils/client.jsx');
|
||||
var AsyncClient = require('../utils/async_client.jsx');
|
||||
var Sidebar = require('./sidebar.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
var SocketStore = require('../stores/socket_store.jsx');
|
||||
var ChannelStore = require('../stores/channel_store.jsx');
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
|
||||
var UserProfile = require('./user_profile.jsx');
|
||||
var MessageWrapper = require('./message_wrapper.jsx');
|
||||
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
|
||||
function getCountsStateFromStores() {
|
||||
|
||||
var count = 0;
|
||||
var channels = ChannelStore.getAll();
|
||||
var members = ChannelStore.getAllMembers();
|
||||
@@ -34,7 +33,7 @@ function getCountsStateFromStores() {
|
||||
}
|
||||
});
|
||||
|
||||
return { count: count }
|
||||
return { count: count };
|
||||
}
|
||||
|
||||
var NotifyCounts = React.createClass({
|
||||
@@ -54,11 +53,10 @@ var NotifyCounts = React.createClass({
|
||||
return getCountsStateFromStores();
|
||||
},
|
||||
render: function() {
|
||||
if (this.state.count == 0) {
|
||||
return (<span></span>);
|
||||
}
|
||||
else {
|
||||
return (<span className="badge badge-notify">{ this.state.count }</span>);
|
||||
if (this.state.count) {
|
||||
return <span className="badge badge-notify">{ this.state.count }</span>;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -66,25 +64,25 @@ var NotifyCounts = React.createClass({
|
||||
var NavbarLoginForm = React.createClass({
|
||||
handleSubmit: function(e) {
|
||||
e.preventDefault();
|
||||
var state = { }
|
||||
var state = { };
|
||||
|
||||
var domain = this.refs.domain.getDOMNode().value.trim();
|
||||
if (!domain) {
|
||||
state.server_error = "A domain is required"
|
||||
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"
|
||||
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"
|
||||
state.server_error = "A password is required";
|
||||
this.setState(state);
|
||||
return;
|
||||
}
|
||||
@@ -105,7 +103,7 @@ var NavbarLoginForm = React.createClass({
|
||||
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);
|
||||
@@ -159,13 +157,14 @@ function getStateFromStores() {
|
||||
}
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'Navbar',
|
||||
|
||||
componentDidMount: function() {
|
||||
ChannelStore.addChangeListener(this._onChange);
|
||||
ChannelStore.addExtraInfoChangeListener(this._onChange);
|
||||
var self = this;
|
||||
$('.inner__wrap').click(self.hideSidebars);
|
||||
$('.inner__wrap').click(this.hideSidebars);
|
||||
|
||||
$('body').on('click.infopopover', function(e){
|
||||
$('body').on('click.infopopover', function(e) {
|
||||
if ($(e.target).attr('data-toggle') !== 'popover'
|
||||
&& $(e.target).parents('.popover.in').length === 0) {
|
||||
$('.info-popover').popover('hide');
|
||||
@@ -181,13 +180,13 @@ module.exports = React.createClass({
|
||||
},
|
||||
handleLeave: function(e) {
|
||||
client.leaveChannel(this.state.channel.id,
|
||||
function(data) {
|
||||
function() {
|
||||
AsyncClient.getChannels(true);
|
||||
window.location.href = '/channels/town-square';
|
||||
}.bind(this),
|
||||
},
|
||||
function(err) {
|
||||
AsyncClient.dispatchError(err, "handleLeave");
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
},
|
||||
hideSidebars: function(e) {
|
||||
@@ -204,7 +203,7 @@ module.exports = React.createClass({
|
||||
});
|
||||
|
||||
if (e.target.className != 'navbar-toggle' && e.target.className != 'icon-bar') {
|
||||
$('.inner__wrap').removeClass('move--right').removeClass('move--left').removeClass('move--left-small');
|
||||
$('.inner__wrap').removeClass('move--right move--left move--left-small');
|
||||
$('.sidebar--left').removeClass('move--right');
|
||||
$('.sidebar--right').removeClass('move--left');
|
||||
$('.sidebar--menu').removeClass('move--left');
|
||||
@@ -229,24 +228,22 @@ module.exports = React.createClass({
|
||||
render: function() {
|
||||
|
||||
var currentId = UserStore.getCurrentId();
|
||||
var channelName = "";
|
||||
var popoverContent = "";
|
||||
var channelTitle = this.props.teamName;
|
||||
var isAdmin = false;
|
||||
var isDirect = false;
|
||||
var description = ""
|
||||
var channel = this.state.channel;
|
||||
|
||||
if (this.state.channel) {
|
||||
var channel = this.state.channel;
|
||||
description = utils.textToJsx(this.state.channel.description, {"singleline": true, "noMentionHighlight": true});
|
||||
popoverContent = React.renderToString(<MessageWrapper message={this.state.channel.description}/>);
|
||||
channelName = this.state.channel.name;
|
||||
if (channel) {
|
||||
description = utils.textToJsx(channel.description, {"singleline": true, "noMentionHighlight": true});
|
||||
popoverContent = React.renderToString(<MessageWrapper message={channel.description}/>);
|
||||
isAdmin = this.state.member.roles.indexOf("admin") > -1;
|
||||
|
||||
if (channel.type === 'O') {
|
||||
channelTitle = this.state.channel.display_name;
|
||||
channelTitle = channel.display_name;
|
||||
} else if (channel.type === 'P') {
|
||||
channelTitle = this.state.channel.display_name;
|
||||
channelTitle = channel.display_name;
|
||||
} else if (channel.type === 'D') {
|
||||
isDirect = true;
|
||||
if (this.state.users.length > 1) {
|
||||
@@ -258,12 +255,11 @@ module.exports = React.createClass({
|
||||
}
|
||||
}
|
||||
|
||||
if(this.state.channel.description.length == 0){
|
||||
popoverContent = React.renderToString(<div>No channel description yet. <br /><a href='#' data-toggle='modal' data-desc={this.state.channel.description} data-title={this.state.channel.display_name} data-channelid={this.state.channel.id} data-target='#edit_channel'>Click here</a> to add one.</div>);
|
||||
if (channel.description.length == 0) {
|
||||
popoverContent = React.renderToString(<div>No channel description yet. <br /><a href='#' data-toggle='modal' data-desc={channel.description} data-title={channel.display_name} data-channelid={channel.id} data-target='#edit_channel'>Click here</a> to add one.</div>);
|
||||
}
|
||||
}
|
||||
|
||||
var loginForm = currentId == null ? <NavbarLoginForm /> : null;
|
||||
var navbar_collapse_button = currentId != null ? null :
|
||||
<button type="button" className="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
|
||||
<span className="sr-only">Toggle sidebar</span>
|
||||
@@ -292,60 +288,61 @@ module.exports = React.createClass({
|
||||
{ navbar_collapse_button }
|
||||
{ sidebar_collapse_button }
|
||||
{ right_sidebar_collapse_button }
|
||||
{ !isDirect && this.state.channel ?
|
||||
<div className="navbar-brand">
|
||||
<div className="dropdown">
|
||||
<div data-toggle="popover" data-content={popoverContent} className="description info-popover"></div>
|
||||
<a href="#" className="dropdown-toggle theme" type="button" id="channel_header_dropdown" data-toggle="dropdown" aria-expanded="true">
|
||||
<strong className="heading">{channelTitle} </strong>
|
||||
<span className="glyphicon glyphicon-chevron-down header-dropdown__icon"></span>
|
||||
</a>
|
||||
<ul className="dropdown-menu" role="menu" aria-labelledby="channel_header_dropdown">
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_invite" href="#">Add Members</a></li>
|
||||
{ isAdmin ?
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_members" href="#">Manage Members</a></li>
|
||||
: ""
|
||||
}
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#edit_channel" data-desc={this.state.channel.description} data-title={this.state.channel.display_name} data-channelid={this.state.channel.id}>Set Channel Description...</a></li>
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#channel_notifications" data-title={this.state.channel.display_name} data-channelid={this.state.channel.id}>Notification Preferences</a></li>
|
||||
{ isAdmin && channelName != Constants.DEFAULT_CHANNEL ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#rename_channel" data-display={this.state.channel.display_name} data-name={this.state.channel.name} data-channelid={this.state.channel.id}>Rename Channel...</a></li>
|
||||
: ""
|
||||
}
|
||||
{ isAdmin && channelName != Constants.DEFAULT_CHANNEL ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#delete_channel" data-title={this.state.channel.display_name} data-channelid={this.state.channel.id}>Delete Channel...</a></li>
|
||||
: ""
|
||||
}
|
||||
{ channelName != Constants.DEFAULT_CHANNEL ?
|
||||
<li role="presentation"><a role="menuitem" href="#" onClick={this.handleLeave}>Leave Channel</a></li>
|
||||
: ""
|
||||
}
|
||||
</ul>
|
||||
{ !isDirect && channel ?
|
||||
<div className="navbar-brand">
|
||||
<div className="dropdown">
|
||||
<div data-toggle="popover" data-content={popoverContent} className="description info-popover"></div>
|
||||
<a href="#" className="dropdown-toggle theme" type="button" id="channel_header_dropdown" data-toggle="dropdown" aria-expanded="true">
|
||||
<span className="heading">{channelTitle} </span>
|
||||
<span className="glyphicon glyphicon-chevron-down header-dropdown__icon"></span>
|
||||
</a>
|
||||
<ul className="dropdown-menu" role="menu" aria-labelledby="channel_header_dropdown">
|
||||
{ !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_invite" href="#">Add Members</a></li>
|
||||
: null
|
||||
}
|
||||
{ isAdmin && !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_members" href="#">Manage Members</a></li>
|
||||
: null
|
||||
}
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#edit_channel" data-desc={channel.description} data-title={channel.display_name} data-channelid={channel.id}>Set Channel Description...</a></li>
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#channel_notifications" data-title={channel.display_name} data-channelid={channel.id}>Notification Preferences</a></li>
|
||||
{ isAdmin && !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#rename_channel" data-display={channel.display_name} data-name={channel.name} data-channelid={channel.id}>Rename Channel...</a></li>
|
||||
: null
|
||||
}
|
||||
{ isAdmin && !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#delete_channel" data-title={channel.display_name} data-channelid={channel.id}>Delete Channel...</a></li>
|
||||
: null
|
||||
}
|
||||
{ !ChannelStore.isDefault(channel) ?
|
||||
<li role="presentation"><a role="menuitem" href="#" onClick={this.handleLeave}>Leave Channel</a></li>
|
||||
: null
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
{ isDirect && channel ?
|
||||
<div className="navbar-brand">
|
||||
<a href="#" className="heading">{ channelTitle }</a>
|
||||
</div>
|
||||
: null }
|
||||
{ !channel ?
|
||||
<div className="navbar-brand">
|
||||
<a href="/" className="heading">{ channelTitle }</a>
|
||||
</div>
|
||||
: null }
|
||||
</div>
|
||||
{ !currentId ?
|
||||
<div className="collapse navbar-collapse" id="navbar-collapse-1">
|
||||
<NavbarLoginForm />
|
||||
</div>
|
||||
: "" }
|
||||
{ isDirect && this.state.channel ?
|
||||
<div className="navbar-brand">
|
||||
<strong>
|
||||
<a href="#"><strong className="heading">{channelTitle}</strong></a>
|
||||
</strong>
|
||||
</div>
|
||||
: "" }
|
||||
{ !this.state.channel ?
|
||||
<div className="navbar-brand">
|
||||
<strong>
|
||||
<a href="/"><strong className="heading">{ channelTitle }</strong></a>
|
||||
</strong>
|
||||
</div>
|
||||
: "" }
|
||||
</div>
|
||||
<div className="collapse navbar-collapse" id="navbar-collapse-1">
|
||||
{ loginForm }
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ var ChannelStore = require('../stores/channel_store.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
var UserProfile = require( './user_profile.jsx' );
|
||||
var AsyncClient = require('../utils/async_client.jsx');
|
||||
var CreatePost = require('./create_post.jsx');
|
||||
var Post = require('./post.jsx');
|
||||
var LoadingScreen = require('./loading_screen.jsx');
|
||||
var SocketStore = require('../stores/socket_store.jsx');
|
||||
@@ -341,7 +340,7 @@ module.exports = React.createClass({
|
||||
}
|
||||
}
|
||||
|
||||
if (channel.name === Constants.DEFAULT_CHANNEL) {
|
||||
if (ChannelStore.isDefault(channel)) {
|
||||
more_messages = (
|
||||
<div className="channel-intro">
|
||||
<h4 className="channel-intro-title">Welcome</h4>
|
||||
|
||||
@@ -37,17 +37,13 @@ var NavbarDropdown = React.createClass({
|
||||
var invite_link = "";
|
||||
var manage_link = "";
|
||||
var rename_link = "";
|
||||
var currentUser = UserStore.getCurrentUser()
|
||||
var currentUser = UserStore.getCurrentUser();
|
||||
var isAdmin = false;
|
||||
|
||||
if (currentUser != null) {
|
||||
isAdmin = currentUser.roles.indexOf("admin") > -1;
|
||||
|
||||
invite_link = (
|
||||
<li>
|
||||
<a href="#" data-toggle="modal" data-target="#invite_member">Invite New Member</a>
|
||||
</li>
|
||||
);
|
||||
invite_link = ( <li> <a href="#" data-toggle="modal" data-target="#invite_member">Invite New Member</a> </li>);
|
||||
|
||||
if (this.props.teamType == "O") {
|
||||
team_link = (
|
||||
@@ -59,16 +55,8 @@ var NavbarDropdown = React.createClass({
|
||||
}
|
||||
|
||||
if (isAdmin) {
|
||||
manage_link = (
|
||||
<li>
|
||||
<a href="#" data-toggle="modal" data-target="#team_members">Manage Team</a>
|
||||
</li>
|
||||
);
|
||||
rename_link = (
|
||||
<li>
|
||||
<a href="#" data-toggle="modal" data-target="#rename_team_link">Rename</a>
|
||||
</li>
|
||||
);
|
||||
manage_link = ( <li> <a href="#" data-toggle="modal" data-target="#team_members">Manage Team</a> </li>);
|
||||
rename_link = ( <li> <a href="#" data-toggle="modal" data-target="#rename_team_link">Rename</a> </li>);
|
||||
}
|
||||
|
||||
var teams = [];
|
||||
@@ -95,7 +83,7 @@ var NavbarDropdown = React.createClass({
|
||||
</a>
|
||||
<ul className="dropdown-menu" role="menu">
|
||||
<li><a href="#" data-toggle="modal" data-target="#user_settings1">Account Settings</a></li>
|
||||
{ isAdmin ? <li><a href="#" data-toggle="modal" data-target="#team_settings">Team Settings</a></li> : "" }
|
||||
{ isAdmin ? <li><a href="#" data-toggle="modal" data-target="#team_settings">Team Settings</a></li> : null }
|
||||
{ invite_link }
|
||||
{ team_link }
|
||||
{ manage_link }
|
||||
@@ -113,28 +101,30 @@ var NavbarDropdown = React.createClass({
|
||||
});
|
||||
|
||||
module.exports = React.createClass({
|
||||
handleSubmit: function(e) {
|
||||
e.preventDefault();
|
||||
},
|
||||
getInitialState: function() {
|
||||
return { };
|
||||
displayName: 'SidebarHeader',
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
teamName: config.SiteName
|
||||
};
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var teamName = this.props.teamName ? this.props.teamName : config.SiteName;
|
||||
var me = UserStore.getCurrentUser()
|
||||
var me = UserStore.getCurrentUser();
|
||||
|
||||
if (!me) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="team__header theme">
|
||||
<img className="user__picture" src={"/api/v1/users/" + me.id + "/image?time=" + me.update_at} />
|
||||
<div className="header__info">
|
||||
<div className="user__name">@{me.username}</div>
|
||||
<a className="team__name" href="/channels/town-square">{ teamName }</a>
|
||||
<div className="user__name">{'@' + me.username}</div>
|
||||
<a className="team__name" href="/channels/town-square">{this.props.teamName}</a>
|
||||
</div>
|
||||
<NavbarDropdown teamType={this.props.teamType} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,40 +44,24 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
|
||||
removeExtraInfoChangeListener: function(callback) {
|
||||
this.removeListener(EXTRA_INFO_EVENT, callback);
|
||||
},
|
||||
get: function(id) {
|
||||
var current = null;
|
||||
var c = this._getChannels();
|
||||
|
||||
c.some(function(channel) {
|
||||
if (channel.id == id) {
|
||||
current = channel;
|
||||
return true;
|
||||
findFirstBy: function(field, value) {
|
||||
var channels = this._getChannels();
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
if (channels[i][field] == value) {
|
||||
return channels[i];
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
return current;
|
||||
return null;
|
||||
},
|
||||
get: function(id) {
|
||||
return this.findFirstBy('id', id);
|
||||
},
|
||||
getMember: function(id) {
|
||||
var current = null;
|
||||
return this.getAllMembers()[id];
|
||||
},
|
||||
getByName: function(name) {
|
||||
var current = null;
|
||||
var c = this._getChannels();
|
||||
|
||||
c.some(function(channel) {
|
||||
if (channel.name == name) {
|
||||
current = channel;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
return current;
|
||||
|
||||
return this.findFirstBy('name', name);
|
||||
},
|
||||
getAll: function() {
|
||||
return this._getChannels();
|
||||
@@ -120,7 +104,7 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
|
||||
getCurrent: function() {
|
||||
var currentId = this.getCurrentId();
|
||||
|
||||
if (currentId != null)
|
||||
if (currentId)
|
||||
return this.get(currentId);
|
||||
else
|
||||
return null;
|
||||
@@ -128,7 +112,7 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
|
||||
getCurrentMember: function() {
|
||||
var currentId = ChannelStore.getCurrentId();
|
||||
|
||||
if (currentId != null)
|
||||
if (currentId)
|
||||
return this.getAllMembers()[currentId];
|
||||
else
|
||||
return null;
|
||||
@@ -143,7 +127,7 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
|
||||
var currentId = ChannelStore.getCurrentId();
|
||||
var extra = null;
|
||||
|
||||
if (currentId != null)
|
||||
if (currentId)
|
||||
extra = this._getExtraInfos()[currentId];
|
||||
|
||||
if (extra == null)
|
||||
@@ -154,7 +138,7 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
|
||||
getExtraInfo: function(channel_id) {
|
||||
var extra = null;
|
||||
|
||||
if (channel_id != null)
|
||||
if (channel_id)
|
||||
extra = this._getExtraInfos()[channel_id];
|
||||
|
||||
if (extra == null)
|
||||
@@ -192,7 +176,10 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
|
||||
},
|
||||
_getExtraInfos: function() {
|
||||
return BrowserStore.getItem("extra_infos", {});
|
||||
}
|
||||
},
|
||||
isDefault: function(channel) {
|
||||
return channel.name == Constants.DEFAULT_CHANNEL;
|
||||
}
|
||||
});
|
||||
|
||||
ChannelStore.dispatchToken = AppDispatcher.register(function(payload) {
|
||||
@@ -231,4 +218,4 @@ ChannelStore.dispatchToken = AppDispatcher.register(function(payload) {
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = ChannelStore;
|
||||
module.exports = ChannelStore;
|
||||
@@ -177,7 +177,7 @@ var UserStore = assign({}, EventEmitter.prototype, {
|
||||
},
|
||||
getCurrentMentionKeys: function() {
|
||||
var user = this.getCurrentUser();
|
||||
if (user.notify_props && user.notify_props.mention_keys) {
|
||||
if (user && user.notify_props && user.notify_props.mention_keys) {
|
||||
var keys = user.notify_props.mention_keys.split(',');
|
||||
|
||||
if (user.full_name.length > 0 && user.notify_props.first_name === "true") {
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
font-size: 16px;
|
||||
.heading {
|
||||
margin-right: 3px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
}
|
||||
.header-dropdown__icon {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
<link rel="stylesheet" href="/static/css/styles.css">
|
||||
|
||||
<script src="/static/js/perfect-scrollbar-0.6.3.jquery.js"></script>
|
||||
<script src="/static/js/bundle.js"></script>
|
||||
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['annotationchart']}]}"></script>
|
||||
|
||||
@@ -102,5 +101,7 @@
|
||||
}
|
||||
</script>
|
||||
<!-- Snowplow stops plowing -->
|
||||
|
||||
<script src="/static/js/bundle.js"></script>
|
||||
</head>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user