diff --git a/src/mentionparser.php b/src/mentionparser.php index 06019fc038..29243214fd 100644 --- a/src/mentionparser.php +++ b/src/mentionparser.php @@ -120,6 +120,15 @@ static function parse($s, ...$user_lists) { if (in_array($u->contactId, $matchuids)) { continue; } + // check email prefix (require 2 or more letters) + $at = (int) strpos($u->email, "@"); + if ($at > 1 + && substr_compare($s, $u->email, $pos + 1, $at, true) === 0 + && self::mention_ends_at($s, $pos + 1 + $at)) { + $uset[] = new PossibleMentionParse($u, substr($u->email, 0, $at) . " ", $at + 1, $listindex); + $matchuids[] = $u->contactId; + continue; + } // check name if ($u->firstName === "" && $u->lastName === "") { continue; diff --git a/test/db.json b/test/db.json index b49d140c41..4d3fd72be2 100644 --- a/test/db.json +++ b/test/db.json @@ -20,7 +20,8 @@ {"name": "Van Jacobson", "email": "van@ee.lbl.gov", "affiliation": "Lawrence Berkeley National Laboratory"}, {"name": "Wilma Ojuelegba", "email": "ojuelegba@gmail.com", "affiliation": "INRIA", "roles": ["pc"]}, {"name": "Véra Djükuba", "email": "vera@bombay.com", "affiliation": "Bombay Institute", "roles": ["pc"]}, - {"name": "Randy H. Katz", "email": "randy@cs.berkeley.edu", "affiliation": "University of California, Berkeley"} + {"name": "Randy H. Katz", "email": "randy@cs.berkeley.edu", "affiliation": "University of California, Berkeley"}, + {"name": "Dottie Francis", "email": "d.francis2@place.edu", "affiliation": "Place Investigations", "roles": ["pc"]} ], "papers": [{ "_id_": 1, diff --git a/test/emails.txt b/test/emails.txt index 59857b240a..7198532558 100644 --- a/test/emails.txt +++ b/test/emails.txt @@ -472,6 +472,32 @@ concerns. - Testconf I Submissions ******** create-randy@cs.berkeley.edu +******** create-d.francis2@place.edu +To: Dottie Francis +Subject: [Testconf I] Welcome to the program committee + +Greetings, + +You have been added to the program committee on the Test Conference I +(Testconf I) submission site. + +* Site: http://hotcrp.lcdf.org/test/ +* Email: d.francis2@place.edu + +You will need a password to sign in. Use this link to set one up: + +http://hotcrp.lcdf.org/test/resetpassword/{{}} + +Should the link expire, obtain a new one using "Forgot my password". + +If you already have an account under a different email address, you may +merge this new account into that one. Go to your profile page and select +"Merge with another account". + +Contact Eddie Kohler with any questions or +concerns. + +- Testconf I Submissions ******** create-micke@cdt.luth.se To: Mikael Degermark Subject: [Testconf I] Account information @@ -2186,3 +2212,123 @@ Contact Eddie Kohler with any questions or concerns. - Testconf I Submissions +******** t_comments-email-mentions +To: Mary Baker , Lixia Zhang , George Varghese +Subject: [Testconf I] Comment for #1 "Scalable Timers for Soft State + Protocols" + +Comment @3 by Jane Chair (Administrator) +--------------------------------------------------------------------------- +@Christian Huitema @rguerin @christophe.diot @d.francis2 @veraxx + + +\*************************************************************************** + + +You’re following comments for Test Conference I (Testconf I) submission +#1. For the most up-to-date comments, or to unsubscribe from email +notification, see the submission site. + +* Title: Scalable Timers for Soft State Protocols +* Site: http://hotcrp.lcdf.org/test/paper/1 + +Contact Eddie Kohler with any questions or +concerns. + +- Testconf I Submissions +******** t_comments-email-mentions +To: Christian Huitema +Subject: [Testconf I] Mentioned for #1 "Scalable Timers for Soft State + Protocols" + +Comment @3 by Jane Chair (Administrator) +--------------------------------------------------------------------------- +@Christian Huitema @rguerin @christophe.diot @d.francis2 @veraxx + + +\*************************************************************************** + + +You were mentioned in this comment for Test Conference I (Testconf I) +submission #1. For the most up-to-date comments, see the submission +site. + +* Title: Scalable Timers for Soft State Protocols +* Site: http://hotcrp.lcdf.org/test/paper/1 + +Contact Eddie Kohler with any questions or +concerns. + +- Testconf I Submissions +******** t_comments-email-mentions +To: Roch Guerin +Subject: [Testconf I] Mentioned for #1 "Scalable Timers for Soft State + Protocols" + +Comment @3 by Jane Chair (Administrator) +--------------------------------------------------------------------------- +@Christian Huitema @rguerin @christophe.diot @d.francis2 @veraxx + + +\*************************************************************************** + + +You were mentioned in this comment for Test Conference I (Testconf I) +submission #1. For the most up-to-date comments, see the submission +site. + +* Title: Scalable Timers for Soft State Protocols +* Site: http://hotcrp.lcdf.org/test/paper/1 + +Contact Eddie Kohler with any questions or +concerns. + +- Testconf I Submissions +******** t_comments-email-mentions +To: Christophe Diot +Subject: [Testconf I] Mentioned for #1 "Scalable Timers for Soft State + Protocols" + +Comment @3 by Jane Chair (Administrator) +--------------------------------------------------------------------------- +@Christian Huitema @rguerin @christophe.diot @d.francis2 @veraxx + + +\*************************************************************************** + + +You were mentioned in this comment for Test Conference I (Testconf I) +submission #1. For the most up-to-date comments, see the submission +site. + +* Title: Scalable Timers for Soft State Protocols +* Site: http://hotcrp.lcdf.org/test/paper/1 + +Contact Eddie Kohler with any questions or +concerns. + +- Testconf I Submissions +******** t_comments-email-mentions +To: Dottie Francis +Subject: [Testconf I] Mentioned for #1 "Scalable Timers for Soft State + Protocols" + +Comment @3 by Jane Chair (Administrator) +--------------------------------------------------------------------------- +@Christian Huitema @rguerin @christophe.diot @d.francis2 @veraxx + + +\*************************************************************************** + + +You were mentioned in this comment for Test Conference I (Testconf I) +submission #1. For the most up-to-date comments, see the submission +site. + +* Title: Scalable Timers for Soft State Protocols +* Site: http://hotcrp.lcdf.org/test/paper/1 + +Contact Eddie Kohler with any questions or +concerns. + +- Testconf I Submissions diff --git a/test/setup.php b/test/setup.php index b8d27254ed..ca9e842feb 100644 --- a/test/setup.php +++ b/test/setup.php @@ -1239,7 +1239,7 @@ static function reset_db($rebuild = false) { if ($user) { MailChecker::check_db("create-{$c->email}"); } else { - fwrite(STDERR, "* failed to create user $c->email\n"); + fwrite(STDERR, "* failed to create user {$c->email}\n"); $ok = false; } } diff --git a/test/t_autoassign.php b/test/t_autoassign.php index 7944a3636f..967d73d087 100644 --- a/test/t_autoassign.php +++ b/test/t_autoassign.php @@ -33,7 +33,7 @@ function __construct(Conf $conf) { $this->cflts[$prow->paperId][$cflt->contactId] = true; } } - assert(count($this->pcc) === 16); + assert(count($this->pcc) === 17); } function setup() { @@ -216,7 +216,7 @@ function test_ensure_reviews_per_user() { $prows = $this->conf->paper_set(["paperId" => $this->cur_pids]); foreach ($prows as $prow) { - xassert_le(count($prow->reviews_as_list()), 5); + xassert_le(count($prow->reviews_as_list()), 6); } $rbu = $this->reviews_by_user($prows); diff --git a/test/t_comments.php b/test/t_comments.php index cce5144682..60aad2b53d 100644 --- a/test/t_comments.php +++ b/test/t_comments.php @@ -150,6 +150,16 @@ function test_multiple_mentions() { MailChecker::check_db("t_comments-multiple-mentions"); } + function test_email_mentions() { + xassert_eqq($this->conf->setting("viewrev"), null); + $this->conf->save_refresh_setting("viewrev", 1); + $paper1 = $this->conf->checked_paper_by_id(1); + $j = call_api("=comment", $this->u_chair, ["c" => "new", "text" => "@Christian Huitema @rguerin @christophe.diot @d.francis2 @veraxx"], $paper1); + xassert($j->ok); + MailChecker::check_db("t_comments-email-mentions"); + $this->conf->save_refresh_setting("viewrev", null); + } + function test_attachments() { $paper1 = $this->conf->checked_paper_by_id(1); $qreq = new Qrequest("POST", ["c" => "new", "text" => "Hello", "attachment:1" => "new"]);