Don't blindly update the user prefs for display_calendars.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 2 Sep 2009 15:52:31 +0000 (11:52 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 2 Sep 2009 15:58:47 +0000 (11:58 -0400)
Only update the pref if we explicitly pass a toggle_calendar or if we
are creating the user's first share.

kronolith/lib/Kronolith.php

index 5c1b619..1666cff 100644 (file)
@@ -760,6 +760,8 @@ class Kronolith
                     $GLOBALS['display_calendars'][] = $calendarId;
                 }
             }
+
+            $GLOBALS['prefs']->setValue('display_cals', serialize($GLOBALS['display_calendars']));
         }
 
         /* Make sure all shares exists now to save on checking later. */
@@ -875,9 +877,9 @@ class Kronolith
                     $GLOBALS['notification']->push(sprintf(_("New calendar created and automatically shared with the following group(s): %s."), implode(', ', $group_list)), 'horde.success');
                 }
             }
-        }
 
-        $GLOBALS['prefs']->setValue('display_cals', serialize($GLOBALS['display_calendars']));
+            $GLOBALS['prefs']->setValue('display_cals', serialize($GLOBALS['display_calendars']));
+        }
 
     }