summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/preference.go2
-rw-r--r--api/preference_test.go2
-rw-r--r--model/outgoing_webhook.go2
-rw-r--r--model/outgoing_webhook_test.go2
-rw-r--r--model/preference.go2
-rw-r--r--model/preference_test.go2
-rw-r--r--model/preferences.go2
-rw-r--r--store/sql_preference_store.go2
-rw-r--r--store/sql_preference_store_test.go2
-rw-r--r--web/react/components/edit_channel_header_modal.jsx52
-rw-r--r--web/react/components/team_general_tab.jsx133
-rw-r--r--web/react/components/user_settings/manage_outgoing_hooks.jsx2
-rw-r--r--web/react/stores/channel_store.jsx4
-rw-r--r--web/react/stores/preference_store.jsx2
-rw-r--r--web/react/utils/client.jsx7
15 files changed, 136 insertions, 82 deletions
diff --git a/api/preference.go b/api/preference.go
index 6d6ac1a7f..e9c74aafe 100644
--- a/api/preference.go
+++ b/api/preference.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package api
diff --git a/api/preference_test.go b/api/preference_test.go
index 2f6204246..310b4dcdb 100644
--- a/api/preference_test.go
+++ b/api/preference_test.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package api
diff --git a/model/outgoing_webhook.go b/model/outgoing_webhook.go
index 9a1b89a85..0b4fd6bbe 100644
--- a/model/outgoing_webhook.go
+++ b/model/outgoing_webhook.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
diff --git a/model/outgoing_webhook_test.go b/model/outgoing_webhook_test.go
index 0d1cd773e..665b85b6f 100644
--- a/model/outgoing_webhook_test.go
+++ b/model/outgoing_webhook_test.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
diff --git a/model/preference.go b/model/preference.go
index 4f2ba0099..a3230959c 100644
--- a/model/preference.go
+++ b/model/preference.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
diff --git a/model/preference_test.go b/model/preference_test.go
index 66b7ac50b..e29250bba 100644
--- a/model/preference_test.go
+++ b/model/preference_test.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
diff --git a/model/preferences.go b/model/preferences.go
index 1ef16151f..f11b5fd80 100644
--- a/model/preferences.go
+++ b/model/preferences.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
diff --git a/store/sql_preference_store.go b/store/sql_preference_store.go
index f73dad3ac..307761150 100644
--- a/store/sql_preference_store.go
+++ b/store/sql_preference_store.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package store
diff --git a/store/sql_preference_store_test.go b/store/sql_preference_store_test.go
index 6f8f44f47..ec9d1df6c 100644
--- a/store/sql_preference_store_test.go
+++ b/store/sql_preference_store_test.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package store
diff --git a/web/react/components/edit_channel_header_modal.jsx b/web/react/components/edit_channel_header_modal.jsx
index 209e30fcc..e4817f6e4 100644
--- a/web/react/components/edit_channel_header_modal.jsx
+++ b/web/react/components/edit_channel_header_modal.jsx
@@ -1,8 +1,9 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
+import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import * as Client from '../utils/client.jsx';
-import * as AsyncClient from '../utils/async_client.jsx';
+import Constants from '../utils/constants.jsx';
import * as Utils from '../utils/utils.jsx';
const Modal = ReactBootstrap.Modal;
@@ -11,12 +12,14 @@ export default class EditChannelHeaderModal extends React.Component {
constructor(props) {
super(props);
- this.handleEdit = this.handleEdit.bind(this);
+ this.handleChange = this.handleChange.bind(this);
+ this.handleSubmit = this.handleSubmit.bind(this);
this.onShow = this.onShow.bind(this);
this.onHide = this.onHide.bind(this);
this.state = {
+ header: props.channel.header,
serverError: ''
};
}
@@ -27,27 +30,38 @@ export default class EditChannelHeaderModal extends React.Component {
}
}
+ componentWillReceiveProps(nextProps) {
+ if (this.props.channel.header !== nextProps.channel.header) {
+ this.setState({
+ header: nextProps.channel.header
+ });
+ }
+ }
+
componentDidUpdate(prevProps) {
if (this.props.show && !prevProps.show) {
this.onShow();
}
}
- handleEdit() {
- var data = {};
- data.channel_id = this.props.channel.id;
-
- if (data.channel_id.length !== 26) {
- return;
- }
-
- data.channel_header = ReactDOM.findDOMNode(this.refs.textarea).value;
+ handleChange(e) {
+ this.setState({
+ header: e.target.value
+ });
+ }
- Client.updateChannelHeader(data,
- () => {
+ handleSubmit() {
+ Client.updateChannelHeader(
+ this.props.channel.id,
+ this.state.header,
+ (channel) => {
this.setState({serverError: ''});
- AsyncClient.getChannel(this.props.channel.id);
this.onHide();
+
+ AppDispatcher.handleServerAction({
+ type: Constants.ActionTypes.RECIEVED_CHANNEL,
+ channel
+ });
},
(err) => {
if (err.message === 'Invalid channel_header parameter') {
@@ -66,7 +80,8 @@ export default class EditChannelHeaderModal extends React.Component {
onHide() {
this.setState({
- serverError: ''
+ serverError: '',
+ header: this.props.channel.header
});
this.props.onHide();
@@ -94,7 +109,8 @@ export default class EditChannelHeaderModal extends React.Component {
rows='6'
id='edit_header'
maxLength='1024'
- defaultValue={this.props.channel.header}
+ value={this.state.header}
+ onChange={this.handleChange}
/>
{serverError}
</Modal.Body>
@@ -102,14 +118,14 @@ export default class EditChannelHeaderModal extends React.Component {
<button
type='button'
className='btn btn-default'
- onClick={this.props.onHide}
+ onClick={this.onHide}
>
{'Cancel'}
</button>
<button
type='button'
className='btn btn-primary'
- onClick={this.handleEdit}
+ onClick={this.handleSubmit}
>
{'Save'}
</button>
diff --git a/web/react/components/team_general_tab.jsx b/web/react/components/team_general_tab.jsx
index 03715d585..dc615f2e8 100644
--- a/web/react/components/team_general_tab.jsx
+++ b/web/react/components/team_general_tab.jsx
@@ -12,6 +12,7 @@ export default class GeneralTab extends React.Component {
constructor(props) {
super(props);
+ this.updateSection = this.updateSection.bind(this);
this.handleNameSubmit = this.handleNameSubmit.bind(this);
this.handleInviteIdSubmit = this.handleInviteIdSubmit.bind(this);
this.handleOpenInviteSubmit = this.handleOpenInviteSubmit.bind(this);
@@ -27,11 +28,22 @@ export default class GeneralTab extends React.Component {
this.handleTeamListingRadio = this.handleTeamListingRadio.bind(this);
this.handleGenerateInviteId = this.handleGenerateInviteId.bind(this);
- this.state = {
- name: props.team.display_name,
- invite_id: props.team.invite_id,
- allow_open_invite: props.team.allow_open_invite,
- allow_team_listing: props.team.allow_team_listing,
+ this.state = this.setupInitialState(props);
+ }
+
+ updateSection(section) {
+ this.setState(this.setupInitialState(this.props));
+ this.props.updateSection(section);
+ }
+
+ setupInitialState(props) {
+ const team = props.team;
+
+ return {
+ name: team.display_name,
+ invite_id: team.invite_id,
+ allow_open_invite: team.allow_open_invite,
+ allow_team_listing: team.allow_team_listing,
serverError: '',
clientError: ''
};
@@ -71,7 +83,7 @@ export default class GeneralTab extends React.Component {
(team) => {
TeamStore.saveTeam(team);
TeamStore.emitChange();
- this.props.updateSection('');
+ this.updateSection('');
},
(err) => {
state.serverError = err.message;
@@ -91,7 +103,7 @@ export default class GeneralTab extends React.Component {
(team) => {
TeamStore.saveTeam(team);
TeamStore.emitChange();
- this.props.updateSection('');
+ this.updateSection('');
},
(err) => {
state.serverError = err.message;
@@ -129,7 +141,7 @@ export default class GeneralTab extends React.Component {
(team) => {
TeamStore.saveTeam(team);
TeamStore.emitChange();
- this.props.updateSection('');
+ this.updateSection('');
},
(err) => {
state.serverError = err.message;
@@ -164,7 +176,7 @@ export default class GeneralTab extends React.Component {
(team) => {
TeamStore.saveTeam(team);
TeamStore.emitChange();
- this.props.updateSection('');
+ this.updateSection('');
},
(err) => {
state.serverError = err.message;
@@ -180,8 +192,7 @@ export default class GeneralTab extends React.Component {
}
handleClose() {
- this.setState({clientError: '', serverError: ''});
- this.props.updateSection('');
+ this.updateSection('');
}
componentDidMount() {
@@ -195,36 +206,36 @@ export default class GeneralTab extends React.Component {
onUpdateNameSection(e) {
e.preventDefault();
if (this.props.activeSection === 'name') {
- this.props.updateSection('');
+ this.updateSection('');
} else {
- this.props.updateSection('name');
+ this.updateSection('name');
}
}
onUpdateInviteIdSection(e) {
e.preventDefault();
if (this.props.activeSection === 'invite_id') {
- this.props.updateSection('');
+ this.updateSection('');
} else {
- this.props.updateSection('invite_id');
+ this.updateSection('invite_id');
}
}
onUpdateOpenInviteSection(e) {
e.preventDefault();
if (this.props.activeSection === 'open_invite') {
- this.props.updateSection('');
+ this.updateSection('');
} else {
- this.props.updateSection('open_invite');
+ this.updateSection('open_invite');
}
}
onUpdateTeamListingSection(e) {
e.preventDefault();
if (this.props.activeSection === 'team_listing') {
- this.props.updateSection('');
+ this.updateSection('');
} else {
- this.props.updateSection('team_listing');
+ this.updateSection('team_listing');
}
}
@@ -248,44 +259,59 @@ export default class GeneralTab extends React.Component {
serverError = this.state.serverError;
}
+ const enableTeamListing = global.window.mm_config.EnableTeamListing === 'true';
+
let teamListingSection;
if (this.props.activeSection === 'team_listing') {
- const inputs = [
- <div key='userTeamListingOptions'>
- <div className='radio'>
- <label>
- <input
- name='userTeamListingOptions'
- type='radio'
- defaultChecked={this.state.allow_team_listing}
- onChange={this.handleTeamListingRadio.bind(this, true)}
- />
- {'Yes'}
- </label>
- <br/>
+ const inputs = [];
+ let submitHandle = null;
+
+ if (enableTeamListing) {
+ submitHandle = this.handleTeamListingSubmit;
+
+ inputs.push(
+ <div key='userTeamListingOptions'>
+ <div className='radio'>
+ <label>
+ <input
+ name='userTeamListingOptions'
+ type='radio'
+ defaultChecked={this.state.allow_team_listing}
+ onChange={this.handleTeamListingRadio.bind(this, true)}
+ />
+ {'Yes'}
+ </label>
+ <br/>
+ </div>
+ <div className='radio'>
+ <label>
+ <input
+ ref='teamListingRadioNo'
+ name='userTeamListingOptions'
+ type='radio'
+ defaultChecked={!this.state.allow_team_listing}
+ onChange={this.handleTeamListingRadio.bind(this, false)}
+ />
+ {'No'}
+ </label>
+ <br/>
+ </div>
+ <div><br/>{'Including this team will display the team name from the Team Directory section of the Home Page, and provide a link to the sign-in page.'}</div>
</div>
- <div className='radio'>
- <label>
- <input
- ref='teamListingRadioNo'
- name='userTeamListingOptions'
- type='radio'
- defaultChecked={!this.state.allow_team_listing}
- onChange={this.handleTeamListingRadio.bind(this, false)}
- />
- {'No'}
- </label>
- <br/>
+ );
+ } else {
+ inputs.push(
+ <div key='userTeamListingOptions'>
+ <div><br/>{'Contact your system administrator to turn on the team directory on the system home page.'}</div>
</div>
- <div><br/>{'Including this team will display the team name from the Team Directory section of the Home Page, and provide a link to the sign-in page.'}</div>
- </div>
- ];
+ );
+ }
teamListingSection = (
<SettingItemMax
title='Include this team in the Team Directory'
inputs={inputs}
- submit={this.handleTeamListingSubmit}
+ submit={submitHandle}
server_error={serverError}
client_error={clientError}
updateSection={this.onUpdateTeamListingSection}
@@ -293,10 +319,15 @@ export default class GeneralTab extends React.Component {
);
} else {
let describe = '';
- if (this.state.allow_team_listing === true) {
- describe = 'Yes';
+
+ if (enableTeamListing) {
+ if (this.state.allow_team_listing === true) {
+ describe = 'Yes';
+ } else {
+ describe = 'No';
+ }
} else {
- describe = 'No';
+ describe = 'Team directory is turned off for this system.';
}
teamListingSection = (
diff --git a/web/react/components/user_settings/manage_outgoing_hooks.jsx b/web/react/components/user_settings/manage_outgoing_hooks.jsx
index 9c0fe3709..fdbac9831 100644
--- a/web/react/components/user_settings/manage_outgoing_hooks.jsx
+++ b/web/react/components/user_settings/manage_outgoing_hooks.jsx
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import LoadingScreen from '../loading_screen.jsx';
diff --git a/web/react/stores/channel_store.jsx b/web/react/stores/channel_store.jsx
index 0bfde77b4..afc960fcf 100644
--- a/web/react/stores/channel_store.jsx
+++ b/web/react/stores/channel_store.jsx
@@ -317,7 +317,9 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
case ActionTypes.RECIEVED_CHANNEL:
ChannelStore.pStoreChannel(action.channel);
- ChannelStore.pStoreChannelMember(action.member);
+ if (action.member) {
+ ChannelStore.pStoreChannelMember(action.member);
+ }
currentId = ChannelStore.getCurrentId();
if (currentId) {
ChannelStore.resetCounts(currentId);
diff --git a/web/react/stores/preference_store.jsx b/web/react/stores/preference_store.jsx
index 068bc29c2..c9bf53bc7 100644
--- a/web/react/stores/preference_store.jsx
+++ b/web/react/stores/preference_store.jsx
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import Constants from '../utils/constants.jsx';
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 09e962161..5d02a8c88 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -590,7 +590,12 @@ export function updateChannel(channel, success, error) {
track('api', 'api_channels_update');
}
-export function updateChannelHeader(data, success, error) {
+export function updateChannelHeader(channelId, header, success, error) {
+ const data = {
+ channel_id: channelId,
+ channel_header: header
+ };
+
$.ajax({
url: '/api/v1/channels/update_header',
dataType: 'json',