diff --git a/src/api/api_user.php b/src/api/api_user.php index dac8cdfbb..4639c09a5 100644 --- a/src/api/api_user.php +++ b/src/api/api_user.php @@ -29,7 +29,7 @@ static function user(Contact $user, Qrequest $qreq, ?PaperInfo $prow) { $found = null; if (strcasecmp($user->email, $email) >= 0 && strcasecmp($user->email, "{$email}~") < 0) { - $found = $user; + $found = $user->populated_user(); } if (($user->can_view_pc() || $broad_lookup) diff --git a/src/contact.php b/src/contact.php index 4543fd123..33b556d40 100644 --- a/src/contact.php +++ b/src/contact.php @@ -1019,6 +1019,15 @@ function update_cdb() { } } + /** @return Contact */ + function populated_user() { + if ($this->contactId <= 0 && $this->has_email()) { + return $this->cdb_user() ?? $this; + } else { + return $this; + } + } + /** @return bool */ function is_actas_user() { diff --git a/src/options/o_authors.php b/src/options/o_authors.php index 628bd6783..bedc952aa 100644 --- a/src/options/o_authors.php +++ b/src/options/o_authors.php @@ -259,8 +259,8 @@ private function echo_editable_authors_line($pt, $n, $au, $reqau, $shownum) { if ($n === 1 && !$au && !$pt->user->can_administer($pt->prow) - && (!$reqau || $reqau->nea_equals($pt->user))) { - $reqau = new Author($pt->user); + && (!$reqau || $reqau->nea_equals($pt->user->populated_user()))) { + $reqau = new Author($pt->user->populated_user()); $ignore_diff = true; }