Browse Source

Pass old value to user triggerChange hook

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
tags/v16.0.0RC1
Morris Jobke 5 years ago
parent
commit
36618b111f
No account linked to committer's email address
2 changed files with 5 additions and 5 deletions
  1. 1
    1
      apps/user_ldap/lib/User/User.php
  2. 4
    4
      lib/private/User/User.php

+ 1
- 1
apps/user_ldap/lib/User/User.php View File

@@ -436,7 +436,7 @@ class User {
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;

+ 4
- 4
lib/private/User/User.php View File

@@ -145,9 +145,8 @@ class User implements IUser {
$this->triggerChange('displayName', $displayName);
}
return $result !== false;
} else {
return false;
}
return false;
}

/**
@@ -365,7 +364,8 @@ class User implements IUser {
$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');
}
}
@@ -409,7 +409,7 @@ class User implements IUser {
}
$this->config->setUserValue($this->uid, 'files', 'quota', $quota);
if($quota !== $oldQuota) {
$this->triggerChange('quota', $quota);
$this->triggerChange('quota', $quota, $oldQuota);
}
}


Loading…
Cancel
Save