Handles issue 6122 - the self contact will be updated when it seems to be invalid

This commit is contained in:
Michael 2018-12-22 20:12:32 +00:00
parent 6f8c9a08a1
commit faa30adf68
2 changed files with 19 additions and 5 deletions

View file

@ -98,6 +98,19 @@ class User
if (!DBA::isResult($r)) {
return false;
}
if (empty($r['nickname'])) {
return false;
}
// Check if the returned data is valid, otherwise fix it. See issue #6122
$url = System::baseUrl() . '/profile/' . $r['nickname'];
$addr = $r['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
if (($addr != $r['addr']) || ($r['url'] != $url) || ($r['nurl'] != Strings::normaliseLink($r['url']))) {
Contact::updateSelfFromUserID($uid);
}
return $r;
}