Profile->getUser() gets the User independently from common_current_user.
This means that changes to one does not affect the other, even if they
are the same user.
This changes that, so that getUser() returns common_current_user() if
they are both the same user.
This is done to fix a bug in the user profile settings, where changes in
the language and timezone are applied to the return value of
Profile->getUser() but not propagated to common_cur_user(), which causes
the profile settings to display incorrect information until the page is
refreshed.
if (!$user instanceof User) {
throw new NoSuchUserException(array('id'=>$this->id));
}
+ $cur_user = common_current_user();
+ if ($user->id === $cur_user->id) {
+ $user = $cur_user;
+ }
$this->_user[$this->id] = $user;
}
return $this->_user[$this->id];