mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #903 from mattermost/PLT-44
PLT-44 allow team switching without the need to login
This commit is contained in:
@@ -9,7 +9,7 @@ var TeamStore = require('../stores/team_store.jsx');
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
|
||||
function getStateFromStores() {
|
||||
return {teams: UserStore.getTeams(), currentTeam: TeamStore.getCurrent()};
|
||||
return {teams: UserStore.getTeams()};
|
||||
}
|
||||
|
||||
export default class NavbarDropdown extends React.Component {
|
||||
@@ -142,10 +142,10 @@ export default class NavbarDropdown extends React.Component {
|
||||
>
|
||||
</li>
|
||||
);
|
||||
if (this.state.teams.length > 1 && this.state.currentTeam) {
|
||||
var curTeamName = this.state.currentTeam.name;
|
||||
|
||||
if (this.state.teams.length > 1) {
|
||||
this.state.teams.forEach((teamName) => {
|
||||
if (teamName !== curTeamName) {
|
||||
if (teamName !== this.props.teamName) {
|
||||
teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>{'Switch to ' + teamName}</a></li>);
|
||||
}
|
||||
});
|
||||
@@ -234,5 +234,7 @@ NavbarDropdown.defaultProps = {
|
||||
teamType: ''
|
||||
};
|
||||
NavbarDropdown.propTypes = {
|
||||
teamType: React.PropTypes.string
|
||||
teamType: React.PropTypes.string,
|
||||
teamDisplayName: React.PropTypes.string,
|
||||
teamName: React.PropTypes.string
|
||||
};
|
||||
|
||||
@@ -512,6 +512,7 @@ export default class Sidebar extends React.Component {
|
||||
/>
|
||||
<SidebarHeader
|
||||
teamDisplayName={this.props.teamDisplayName}
|
||||
teamName={this.props.teamName}
|
||||
teamType={this.props.teamType}
|
||||
/>
|
||||
<SearchBox />
|
||||
@@ -591,5 +592,6 @@ Sidebar.defaultProps = {
|
||||
};
|
||||
Sidebar.propTypes = {
|
||||
teamType: React.PropTypes.string,
|
||||
teamDisplayName: React.PropTypes.string
|
||||
teamDisplayName: React.PropTypes.string,
|
||||
teamName: React.PropTypes.string
|
||||
};
|
||||
|
||||
@@ -52,6 +52,8 @@ export default class SidebarHeader extends React.Component {
|
||||
<NavbarDropdown
|
||||
ref='dropdown'
|
||||
teamType={this.props.teamType}
|
||||
teamDisplayName={this.props.teamDisplayName}
|
||||
teamName={this.props.teamName}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -64,5 +66,6 @@ SidebarHeader.defaultProps = {
|
||||
};
|
||||
SidebarHeader.propTypes = {
|
||||
teamDisplayName: React.PropTypes.string,
|
||||
teamName: React.PropTypes.string,
|
||||
teamType: React.PropTypes.string
|
||||
};
|
||||
|
||||
@@ -36,11 +36,14 @@ var RemovedFromChannelModal = require('../components/removed_from_channel_modal.
|
||||
var FileUploadOverlay = require('../components/file_upload_overlay.jsx');
|
||||
var RegisterAppModal = require('../components/register_app_modal.jsx');
|
||||
var ImportThemeModal = require('../components/user_settings/import_theme_modal.jsx');
|
||||
var TeamStore = require('../stores/team_store.jsx');
|
||||
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
|
||||
function setupChannelPage(props) {
|
||||
TeamStore.setCurrentId(props.TeamId);
|
||||
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.CLICK_CHANNEL,
|
||||
name: props.ChannelName,
|
||||
@@ -71,6 +74,7 @@ function setupChannelPage(props) {
|
||||
React.render(
|
||||
<Sidebar
|
||||
teamDisplayName={props.TeamDisplayName}
|
||||
teamName={props.TeamName}
|
||||
teamType={props.TeamType}
|
||||
/>,
|
||||
document.getElementById('sidebar-left')
|
||||
|
||||
Reference in New Issue
Block a user