Skip to content

Commit

Permalink
Speed up reviewers paper column by prefetching reviewer users.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 19, 2023
1 parent af27137 commit f256292
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/paperinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2516,6 +2516,7 @@ function mark_inactive_linked_documents() {
}


/** @param bool $always */
function load_reviews($always = false) {
++$this->_review_array_version;

Expand Down Expand Up @@ -2580,7 +2581,7 @@ function parse_ordinal_id($oid) {
/** @return array<int,ReviewInfo> */
function all_reviews() {
if ($this->_review_array === null) {
$this->load_reviews();
$this->load_reviews(false);
}
return $this->_review_array;
}
Expand Down Expand Up @@ -2866,7 +2867,7 @@ function may_have_viewable_scores($field, Contact $viewer) {

function ensure_reviews() {
if ($this->_review_array === null) {
$this->load_reviews();
$this->load_reviews(false);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/reviewinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ function viewable_fields(Contact $user, $include_nonexistent = false) {
/** @return Contact */
function reviewer() {
if ($this->_reviewer === null) {
$this->prow && $this->prow->ensure_reviewer_names();
$this->_reviewer = $this->conf->user_by_id($this->contactId, USER_SLICE)
?? Contact::make_placeholder($this->conf, $this->contactId);
}
Expand Down

0 comments on commit f256292

Please sign in to comment.