diff --git a/model/config.go b/model/config.go index 2847d17da5..3c0ada423f 100644 --- a/model/config.go +++ b/model/config.go @@ -105,8 +105,6 @@ type RateLimitSettings struct { type PrivacySettings struct { ShowEmailAddress bool - ShowPhoneNumber bool - ShowSkypeId bool ShowFullName bool } diff --git a/utils/config.go b/utils/config.go index c0e0391374..cef99d7d97 100644 --- a/utils/config.go +++ b/utils/config.go @@ -161,8 +161,6 @@ func getSanitizeOptions(c *model.Config) map[string]bool { options := map[string]bool{} options["fullname"] = c.PrivacySettings.ShowFullName options["email"] = c.PrivacySettings.ShowEmailAddress - options["skypeid"] = c.PrivacySettings.ShowSkypeId - options["phonenumber"] = c.PrivacySettings.ShowPhoneNumber return options } diff --git a/web/react/components/admin_console/admin_controller.jsx b/web/react/components/admin_console/admin_controller.jsx index 0dc0ec45be..9db1c945e1 100644 --- a/web/react/components/admin_console/admin_controller.jsx +++ b/web/react/components/admin_console/admin_controller.jsx @@ -10,6 +10,7 @@ var EmailSettingsTab = require('./email_settings.jsx'); var LogSettingsTab = require('./log_settings.jsx'); var LogsTab = require('./logs.jsx'); var ImageSettingsTab = require('./image_settings.jsx'); +var PrivacySettingsTab = require('./privacy_settings.jsx'); export default class AdminController extends React.Component { constructor(props) { @@ -56,6 +57,8 @@ export default class AdminController extends React.Component { tab = ; } else if (this.state.selected === 'image_settings') { tab = ; + } else if (this.state.selected === 'privacy_settings') { + tab = ; } } diff --git a/web/react/components/admin_console/admin_sidebar.jsx b/web/react/components/admin_console/admin_sidebar.jsx index 5544f9c6d0..5f471ec2cb 100644 --- a/web/react/components/admin_console/admin_sidebar.jsx +++ b/web/react/components/admin_console/admin_sidebar.jsx @@ -74,6 +74,15 @@ export default class AdminSidebar extends React.Component { {'Image Settings'} +
  • + + {'Privacy Settings'} + +
  • diff --git a/web/react/components/admin_console/privacy_settings.jsx b/web/react/components/admin_console/privacy_settings.jsx new file mode 100644 index 0000000000..8ce6939258 --- /dev/null +++ b/web/react/components/admin_console/privacy_settings.jsx @@ -0,0 +1,163 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +var Client = require('../../utils/client.jsx'); +var AsyncClient = require('../../utils/async_client.jsx'); + +export default class PrivacySettings extends React.Component { + constructor(props) { + super(props); + + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + + this.state = { + saveNeeded: false, + serverError: null + }; + } + + handleChange() { + var s = {saveNeeded: true, serverError: this.state.serverError}; + + this.setState(s); + } + + handleSubmit(e) { + e.preventDefault(); + $('#save-button').button('loading'); + + var config = this.props.config; + config.PrivacySettings.ShowEmailAddress = React.findDOMNode(this.refs.ShowEmailAddress).checked; + config.PrivacySettings.ShowFullName = React.findDOMNode(this.refs.ShowFullName).checked; + + Client.saveConfig( + config, + () => { + AsyncClient.getConfig(); + this.setState({ + serverError: null, + saveNeeded: false + }); + $('#save-button').button('reset'); + }, + (err) => { + this.setState({ + serverError: err.message, + saveNeeded: true + }); + $('#save-button').button('reset'); + } + ); + } + + render() { + var serverError = ''; + if (this.state.serverError) { + serverError =
    ; + } + + var saveClass = 'btn'; + if (this.state.saveNeeded) { + saveClass = 'btn btn-primary'; + } + + return ( +
    +

    {'Privacy Settings'}

    +
    + +
    + +
    + + +

    {'Hides email address of users from other users including team administrator.'}

    +
    +
    + +
    + +
    + + +

    {'Hides full name of users from other users including team administrator.'}

    +
    +
    + +
    +
    + {serverError} + +
    +
    + +
    +
    + ); + } +} + +PrivacySettings.propTypes = { + config: React.PropTypes.object +};