summaryrefslogtreecommitdiffstats
path: root/webapp/actions
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-11-29 12:15:46 -0300
committerChristopher Speller <crspeller@gmail.com>2016-11-29 10:15:46 -0500
commit702c4cb12146d4b3d18807d56e013da3aed15836 (patch)
tree9168eb7ca5e86986c98d90c053c53bdedd0e6f2e /webapp/actions
parent02d581c1599c5d50cc507bd2633f1e3c34b1cc84 (diff)
downloadchat-702c4cb12146d4b3d18807d56e013da3aed15836.tar.gz
chat-702c4cb12146d4b3d18807d56e013da3aed15836.tar.bz2
chat-702c4cb12146d4b3d18807d56e013da3aed15836.zip
Fix more react warnings & fix saving theme (#4667)
Diffstat (limited to 'webapp/actions')
-rw-r--r--webapp/actions/user_actions.jsx18
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();
}