Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Pass old value to user triggerChange hook
Signed-off-by: Morris Jobke <[email protected]>
  • Loading branch information
MorrisJobke committed Apr 11, 2019
commit 36618b111fde55ba5c8ddedc294e58927257d107
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public function composeAndStoreDisplayName($displayName, $displayName2 = '') {
if (!empty($oldName) && $user instanceof \OC\User\User) {
// if it was empty, it would be a new record, not a change emitting the trigger could
// potentially cause a UniqueConstraintViolationException, depending on some factors.
$user->triggerChange('displayName', $displayName);
$user->triggerChange('displayName', $displayName, $oldName);
}
}
return $displayName;
Expand Down
8 changes: 4 additions & 4 deletions lib/private/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ public function setDisplayName($displayName) {
$this->triggerChange('displayName', $displayName);
}
return $result !== false;
} else {
return false;
}
return false;
}

/**
Expand Down Expand Up @@ -365,7 +364,8 @@ public function setEnabled(bool $enabled = true) {
$oldStatus = $this->isEnabled();
$this->enabled = $enabled;
if ($oldStatus !== $this->enabled) {
$this->triggerChange('enabled', $enabled);
// TODO: First change the value, then trigger the event as done for all other properties.
$this->triggerChange('enabled', $enabled, $oldStatus);
$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
}
}
Expand Down Expand Up @@ -409,7 +409,7 @@ public function setQuota($quota) {
}
$this->config->setUserValue($this->uid, 'files', 'quota', $quota);
if($quota !== $oldQuota) {
$this->triggerChange('quota', $quota);
$this->triggerChange('quota', $quota, $oldQuota);
}
}

Expand Down