Skip to content

Commit

Permalink
MM-12082 Don't clear user's Teammate Name Display when it matches sys…
Browse files Browse the repository at this point in the history
…tem default (mattermost#1814)
  • Loading branch information
hmhealey committed Oct 3, 2018
1 parent 397d4db commit 2fa439f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions components/user_settings/display/user_settings_display.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from 'react';
import {getTimezoneRegion} from 'mattermost-redux/utils/timezone_utils';
import {FormattedMessage} from 'react-intl';

import {deletePreferences, savePreferences} from 'actions/user_actions.jsx';
import {savePreferences} from 'actions/user_actions.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import UserStore from 'stores/user_store.jsx';

Expand Down Expand Up @@ -110,12 +110,14 @@ export default class UserSettingsDisplay extends React.Component {

this.setState({isSaving: true});

const preferences = [timePreference, channelDisplayModePreference, messageDisplayPreference, collapseDisplayPreference, linkPreviewDisplayPreference];
if (this.state.teammateNameDisplay === this.props.configTeammateNameDisplay) {
deletePreferences([teammateNameDisplayPreference]);
} else {
preferences.push(teammateNameDisplayPreference);
}
const preferences = [
timePreference,
channelDisplayModePreference,
messageDisplayPreference,
collapseDisplayPreference,
linkPreviewDisplayPreference,
teammateNameDisplayPreference,
];

savePreferences(preferences, () => {
this.updateSection('');
Expand Down

0 comments on commit 2fa439f

Please sign in to comment.