From 4d2aa247e9f3dc67bd92f142bf1f2c9e946e6062 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Thu, 8 Feb 2024 21:47:26 -0500 Subject: [PATCH] Use rflags to compute PaperContactInfo. --- src/contact.php | 2 +- src/papercolumns/pc_assignreview.php | 2 +- src/paperinfo.php | 63 ++++++++++++++-------------- test/t_reviews.php | 2 +- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/contact.php b/src/contact.php index 409a563336..e886024799 100644 --- a/src/contact.php +++ b/src/contact.php @@ -4147,7 +4147,7 @@ function can_view_review_identity(PaperInfo $prow, $rbase = null) { && $rights->review_status > PaperContactInfo::CIRS_UNSUBMITTED) || ($seerevid_setting === Conf::VIEWREV_IFASSIGNED && $rights->reviewType > 0 - && !$rights->self_assigned + && !$rights->self_assigned() && $rights->review_status > 0); } diff --git a/src/papercolumns/pc_assignreview.php b/src/papercolumns/pc_assignreview.php index 9ae8b99f8b..8483b870bc 100644 --- a/src/papercolumns/pc_assignreview.php +++ b/src/papercolumns/pc_assignreview.php @@ -74,7 +74,7 @@ function content(PaperList $pl, PaperInfo $row) { } else { $rt = ReviewInfo::unparse_type(min(max($ci->reviewType, 0), REVIEW_META)); } - $rs = $ci->reviewSubmitted ? " s" : ""; + $rs = $ci->review_submitted() ? " s" : ""; $pl->need_render = true; $t = 'mark_review_type($conf, (int) $a[0], (int) $a[1], (int) $a[2], (int) $a[3], (int) $a[4]); + $this->mark_review_type($conf, (int) $a[0], (int) $a[1], (int) $a[2]); } } } @@ -250,7 +250,7 @@ static function load_into(PaperInfo $prow, $user) { } // two queries is marginally faster than one union query $mresult = Dbl::multi_qe($prow->conf->dblink, "select paperId, contactId, conflictType from PaperConflict where paperId?a and contactId?a; - select paperId, contactId, null, reviewType, reviewSubmitted, reviewNeedsSubmit, reviewRound, requestedBy from PaperReview where paperId?a and {$prwhere}", + select paperId, contactId, null, rflags, reviewNeedsSubmit, reviewRound from PaperReview where paperId?a and {$prwhere}", $row_set->paper_ids(), array_keys($user_set), $row_set->paper_ids(), array_keys($user_set), ...$qv); while (($result = $mresult->next())) { @@ -260,7 +260,7 @@ static function load_into(PaperInfo $prow, $user) { if ($x[2] !== null) { $ci->mark_conflict((int) $x[2]); } else { - $ci->mark_review_type($pr->conf, (int) $x[3], (int) $x[4], (int) $x[5], (int) $x[6], (int) $x[7]); + $ci->mark_review_type($pr->conf, (int) $x[3], (int) $x[4], (int) $x[5]); } } $result->close(); @@ -812,7 +812,8 @@ static function make_permissive_reviewer(Contact $user, $rtype, $tags) { $prow->outcome = 1; $prow->outcome_sign = 1; $prow->conflictType = "0"; - $prow->myReviewPermissions = "{$rtype} 1 0 0 -1"; + $rf = ReviewInfo::RF_LIVE | (1 << $rtype) | ReviewInfo::RF_ACCEPTED | ReviewInfo::RF_DRAFTED | ReviewInfo::RF_SUBMITTED; + $prow->myReviewPermissions = "{$rf} 0 0"; $prow->_row_set->add_paper($prow); $prow->myContactXid = $user->contactXid; $prow->_rights_version = Contact::$rights_version; @@ -828,7 +829,7 @@ function reload() { /** @param string $prefix * @return string */ static function my_review_permissions_sql($prefix = "") { - return "group_concat({$prefix}reviewType, ' ', coalesce({$prefix}reviewSubmitted,0), ' ', {$prefix}reviewNeedsSubmit, ' ', {$prefix}reviewRound, ' ', {$prefix}requestedBy)"; + return "group_concat({$prefix}rflags, ' ', {$prefix}reviewNeedsSubmit, ' ', {$prefix}reviewRound)"; } /** @return PermissionProblem */ diff --git a/test/t_reviews.php b/test/t_reviews.php index 97fbcb785f..6195a9765b 100644 --- a/test/t_reviews.php +++ b/test/t_reviews.php @@ -1433,7 +1433,7 @@ function test_self_assign() { xassert_eqq($rrow->requestedBy, $this->u_lixia->contactId); xassert_eqq($rrow->reviewType, REVIEW_PC); xassert_neqq($rrow->rflags & ReviewInfo::RF_SELF_ASSIGNED, 0); - xassert($prow->contact_info($this->u_lixia)->self_assigned); + xassert($prow->contact_info($this->u_lixia)->self_assigned()); } function test_rflags_type() {