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
2 changes: 1 addition & 1 deletion apps/lookup_server_connector/lib/UpdateLookupServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function sendToLookupServer(IUser $user, array $publicData) {
* @return bool
*/
private function shouldUpdateLookupServer() {
return $this->lookupServerEnabled || !empty($this->lookupServer);
return $this->lookupServerEnabled && !empty($this->lookupServer);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted to #15022 so we can merge this quickly for 16

}

}
5 changes: 0 additions & 5 deletions lib/private/Avatar/UserAvatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,6 @@ public function getDisplayName(): string {
* @throws \OCP\PreConditionNotMetException
*/
public function userChanged($feature, $oldValue, $newValue) {
// We only change the avatar on display name changes
if ($feature !== 'displayName') {
return;
}

// If the avatar is not generated (so an uploaded image) we skip this
if (!$this->folder->fileExists('generated')) {
return;
Expand Down
8 changes: 6 additions & 2 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,9 @@ public function __construct($webRoot, \OC\Config $config) {
$userSession->listen('\OC\User', 'logout', function () {
\OC_Hook::emit('OC_User', 'logout', array());
});
$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) {
$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
/** @var $user \OC\User\User */
\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
$dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the very same event is dispatched already in the OC\User\User::triggerChange:

$this->dispatcher->dispatch(IUser::class . '::changeUser', new GenericEvent($this, [
'feature' => $feature,
'value' => $value,
'oldValue' => $oldValue,
]));

Right before the legacy hook is emitted, which will call this place and trigger the event again.

});
return $userSession;
});
Expand Down Expand Up @@ -1257,6 +1256,11 @@ private function connectDispatcher() {
$oldValue = $e->getArgument('oldValue');
$value = $e->getArgument('value');

// We only change the avatar on display name changes
if ($feature !== 'displayName') {
return;
}

try {
$avatar = $manager->getAvatar($user->getUID());
$avatar->userChanged($feature, $oldValue, $value);
Expand Down