Skip to content

Commit

Permalink
User-provided name strings must have whitespace simplified.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Feb 12, 2024
1 parent d19ac70 commit 3b1830a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/api/api_requestreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static function requestreview($user, $qreq, $prow) {
"name" => $qreq->name,
"affiliation" => $qreq->affiliation,
"email" => $email
]);
])->simplify_whitespace();
$reason = trim($qreq->reason ?? "");

// check proposal:
Expand Down Expand Up @@ -115,7 +115,7 @@ static function requestreview($user, $qreq, $prow) {
$ml[] = new MessageItem("email", "<5>Proposed an external review from " . $xreviewer->name_h(NAME_E), MessageSet::WARNING_NOTE);
$ml[] = new MessageItem("email", "<0>An administrator must approve this proposal for it to take effect.", MessageSet::INFORM);
}
$user->log_activity("Review proposal added for $email", $prow);
$user->log_activity("Review proposal added for {$email}", $prow);
$prow->conf->update_automatic_tags($prow, "review");
HotCRPMailer::send_administrators("@proposereview", $prow,
["requester_contact" => $requester,
Expand Down
11 changes: 11 additions & 0 deletions src/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ function assign_keyed($x) {
$this->affiliation = $a ?? "";
}

/** @return $this */
function simplify_whitespace() {
$this->firstName = simplify_whitespace($this->firstName);
$this->lastName = simplify_whitespace($this->lastName);
$this->affiliation = simplify_whitespace($this->affiliation);
if ($this->_name !== null) {
$this->_name = simplify_whitespace($this->_name);
}
return $this;
}

/** @param string $s
* @param int $paren
* @return int */
Expand Down
19 changes: 18 additions & 1 deletion test/emails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1886,7 +1886,7 @@ Reviewer expertise
******** test06-external3-request17
To: Christian Huitema <[email protected]>, Jane Chair <chair@_.com>, Scott Shenker <[email protected]>
Subject: [Testconf I] Review proposal for submission #17
X-Landmark: test/test06.php:885
X-Landmark: test/t_reviews.php:1263

Greetings,

Expand All @@ -1899,6 +1899,23 @@ Visit the assignment page to approve or deny the proposal.
the MBone
* Site: http://hotcrp.lcdf.org/test/assign/17

- Testconf I Submissions
******** test06-external4-request17
To: Christian Huitema <[email protected]>, Jane Chair <chair@_.com>, Scott Shenker <[email protected]>
Subject: [Testconf I] Review proposal for submission #17
X-Landmark: test/t_reviews.php:1280

Greetings,

Lixia Zhang <[email protected]> would like Beth March <external4@_.com>
to review Test Conference I (Testconf I) submission #17.

Visit the assignment page to approve or deny the proposal.

* Title: Network Text Editor (NTE): A Scalable Shared Text Editor for
the MBone
* Site: http://hotcrp.lcdf.org/test/assign/17

- Testconf I Submissions
******** test05-reject14-1
To: Henrik Frystyk Nielsen <[email protected]>, James Gettys <[email protected]>, Anselm Baird-Smith <[email protected]>
Expand Down
5 changes: 5 additions & 0 deletions test/t_reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,11 @@ function test_review_proposal() {
xassert_search($this->u_chair, "has:proposal admin:me", "17");
xassert_search($this->u_lixia, "has:proposal admin:me", "");
xassert_search($this->u_mgbaker, "has:proposal", "17");

$xqreq = new Qrequest("POST", ["email" => "external4@_.com", "firstName" => "Beth ", "lastName" => " March", "affiliation" => "Transcendent"]);
$paper17 = $this->conf->checked_paper_by_id(17);
$result = RequestReview_API::requestreview($this->u_lixia, $xqreq, $paper17);
MailChecker::check_db("test06-external4-request17");
}

function test_search_routstanding() {
Expand Down

0 comments on commit 3b1830a

Please sign in to comment.