Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Enhanced onSettingsChange event to get old setting values
Including `name` and `description` attributes

Signed-off-by: Tortue Torche <[email protected]>
  • Loading branch information
tortuetorche authored and backportbot[bot] committed Apr 9, 2020
commit e23480771b7b22f500357c1573e5fbda79421320
10 changes: 9 additions & 1 deletion lib/Service/CirclesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ public function settingsCircle($circleUniqueId, $settings) {
$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
$this->hasToBeOwner($circle->getHigherViewer());

$oldSettings = array_merge(
$circle->getSettings(),
[
'circle_name' => $circle->getName(),
'circle_desc' => $circle->getDescription(),
]
);

if (!$this->viewerIsAdmin()) {
$settings['members_limit'] = $circle->getSetting('members_limit');
}
Expand All @@ -329,7 +337,7 @@ public function settingsCircle($circleUniqueId, $settings) {

$this->circlesRequest->updateCircle($circle, $this->userId);

$this->eventsService->onSettingsChange($circle);
$this->eventsService->onSettingsChange($circle, $oldSettings);
} catch (\Exception $e) {
throw $e;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/Service/EventsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,10 @@ public function onLinkRemove(Circle $circle, FederatedLink $link) {
* Called when the circle's settings are changed
*
* @param Circle $circle
* @param array $oldSettings
*/
public function onSettingsChange(Circle $circle) {
$this->dispatch('\OCA\Circles::onSettingsChange', ['circle' => $circle]);
public function onSettingsChange(Circle $circle, array $oldSettings = []) {
$this->dispatch('\OCA\Circles::onSettingsChange', ['circle' => $circle, 'oldSettings' => $oldSettings]);
}


Expand Down