diff options
Diffstat (limited to 'webapp/actions/user_actions.jsx')
-rw-r--r-- | webapp/actions/user_actions.jsx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx index 455ca1730..a93f84e7c 100644 --- a/webapp/actions/user_actions.jsx +++ b/webapp/actions/user_actions.jsx @@ -236,7 +236,7 @@ function onThemeSaved(teamId, theme, onSuccess) { const toDelete = []; for (const [name] of themePreferences) { - if (name === '') { + if (name === '' || name === teamId) { continue; } @@ -247,14 +247,16 @@ function onThemeSaved(teamId, theme, onSuccess) { }); } - // we're saving a new global theme so delete any team-specific ones - AsyncClient.deletePreferences(toDelete); + if (toDelete.length > 0) { + // we're saving a new global theme so delete any team-specific ones + AsyncClient.deletePreferences(toDelete); - // delete them locally before we hear from the server so that the UI flow is smoother - AppDispatcher.handleServerAction({ - type: ActionTypes.DELETED_PREFERENCES, - preferences: toDelete - }); + // delete them locally before we hear from the server so that the UI flow is smoother + AppDispatcher.handleServerAction({ + type: ActionTypes.DELETED_PREFERENCES, + preferences: toDelete + }); + } onSuccess(); } |