ToggleInstanceFeaturesCommandForm: Only issue a command for changes

This commit is contained in:
Johannes Meyer 2015-07-03 13:36:24 +02:00
parent caca219aa1
commit 3e5e6ec64e
1 changed files with 7 additions and 6 deletions

View File

@ -254,18 +254,19 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
);
foreach ($this->getValues() as $feature => $enabled) {
if ((bool) $this->status->{$feature} !== (bool) $enabled) {
$toggleFeature = new ToggleInstanceFeatureCommand();
$toggleFeature
->setFeature($feature)
->setEnabled($enabled);
$this->getTransport($this->request)->send($toggleFeature);
if ((bool) $this->status->{$feature} !== (bool) $enabled) {
Notification::success(
$notifications[$feature][$enabled ? 0 : 1]
);
}
}
return true;
}
}