Skip to content

Commit

Permalink
Begin supporting decision comment thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Aug 29, 2024
1 parent de4727a commit 67b5415
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 22 deletions.
3 changes: 3 additions & 0 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6821,6 +6821,9 @@ function cmt_identity_time(frag, cj, editing) {
if (cj.topic === "paper") {
cmt_header_dotsep(frag);
frag.appendChild($e("div", {"class": "cmtvis", title: "Visible when reviews are hidden"}, "submission thread"));
} else if (cj.topic === "dec") {
cmt_header_dotsep(frag);
frag.appendChild($e("div", {"class": "cmtvis", title: "Visible when decision is visible"}, "decision thread"));
}
if (cj.tags) {
const tage = $e("div", "cmttags");
Expand Down
15 changes: 12 additions & 3 deletions src/commentinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class CommentInfo {
const CT_HASDOC = 0x20;
const CT_TOPIC_PAPER = 0x40;
const CT_TOPIC_REVIEW = 0x80; // only used internally, not in database
const CTM_TOPIC = 0xC0;
const CTM_TOPIC_NONREVIEW = 0x40;
const CTM_TOPIC = 0x2C0;
const CTM_TOPIC_NONREVIEW = 0x240;
const CT_BYADMINISTRATOR = 0x100;
const CT_TOPIC_DECISION = 0x200;
const CT_FROZEN = 0x4000;
const CT_SUBMIT = 0x8000; // only used internally, not in database
const CTVIS_ADMINONLY = 0x00000;
Expand Down Expand Up @@ -645,6 +646,8 @@ function unparse_json(Contact $viewer) {
}
if (($this->commentType & self::CTM_TOPIC) === self::CT_TOPIC_PAPER) {
$cj["topic"] = "paper";
} else if (($this->commentType & self::CTM_TOPIC) === self::CT_TOPIC_DECISION) {
$cj["topic"] = "dec";
}
if (($fmt = $this->commentFormat ?? $this->conf->default_format)) {
$cj["format"] = $fmt;
Expand Down Expand Up @@ -992,7 +995,13 @@ function save_comment($req, Contact $acting_user) {
$x = $response_name == "1" ? "" : " ({$response_name})";
$log = "Response {$cmtid}{$x}";
} else {
$x = ($ctype & self::CT_TOPIC_PAPER) !== 0 ? " on submission" : "";
if (($ctype & self::CT_TOPIC_PAPER) !== 0) {
$x = " on submission thread";
} else if (($ctype & self::CT_TOPIC_DECISION) !== 0) {
$x = " on decision thread";
} else {
$x = "";
}
$log = "Comment {$cmtid}{$x}";
}
if ($text === false) {
Expand Down
47 changes: 28 additions & 19 deletions src/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -4893,27 +4893,36 @@ function preferred_response_round(PaperInfo $prow) {
function can_view_comment(PaperInfo $prow, $crow, $textless = false) {
$ctype = $crow ? $crow->commentType : CommentInfo::CTVIS_AUTHOR;
$rights = $this->rights($prow);
return ($crow && $this->is_my_comment($prow, $crow))
if (($crow && $this->is_my_comment($prow, $crow))
|| ($rights->can_administer()
&& ($ctype >= CommentInfo::CTVIS_AUTHOR
|| $rights->potential_reviewer()))
|| ($rights->act_author_view()
&& (($ctype & CommentInfo::CTM_BYAUTHOR) !== 0
|| ($ctype >= CommentInfo::CTVIS_AUTHOR
&& ($ctype & CommentInfo::CT_DRAFT) === 0
&& (($ctype & CommentInfo::CT_TOPIC_PAPER) !== 0
|| $this->can_view_submitted_review_as_author($prow)))))
|| (!$rights->view_conflict_type
&& (($ctype & CommentInfo::CT_DRAFT) === 0
|| ($textless && ($ctype & CommentInfo::CT_RESPONSE)))
&& ($rights->allow_pc()
? $ctype >= CommentInfo::CTVIS_PCONLY
: $ctype >= CommentInfo::CTVIS_REVIEWER)
&& (($ctype & CommentInfo::CT_TOPIC_PAPER) !== 0
|| $this->can_view_review($prow, null))
&& ($ctype >= CommentInfo::CTVIS_AUTHOR
|| $this->conf->setting("cmt_revid")
|| $this->can_view_comment_identity($prow, $crow)));
|| $rights->potential_reviewer()))) {
return true;
}
if ($rights->act_author_view()
&& (($ctype & CommentInfo::CTM_BYAUTHOR) !== 0
|| ($ctype >= CommentInfo::CTVIS_AUTHOR
&& ($ctype & CommentInfo::CT_DRAFT) === 0
&& (($ctype & CommentInfo::CT_TOPIC_PAPER) !== 0
|| (($ctype & CommentInfo::CT_TOPIC_DECISION) !== 0
? $rights->can_view_decision()
: $this->can_view_submitted_review_as_author($prow)))))) {
return true;
}
if (!$rights->view_conflict_type
&& $ctype >= ($rights->allow_pc() ? CommentInfo::CTVIS_PCONLY : CommentInfo::CTVIS_REVIEWER)
&& (($ctype & CommentInfo::CT_DRAFT) === 0
|| ($textless && ($ctype & CommentInfo::CT_RESPONSE)) !== 0)
&& ($ctype >= CommentInfo::CTVIS_AUTHOR
|| $this->conf->setting("cmt_revid")
|| $this->can_view_comment_identity($prow, $crow))
&& (($ctype & CommentInfo::CT_TOPIC_PAPER) !== 0
|| (($ctype & CommentInfo::CT_TOPIC_DECISION) !== 0
? $rights->can_view_decision()
: $this->can_view_review($prow, null)))) {
return true;
}
return false;
}

/** @param ?CommentInfo $crow
Expand Down

0 comments on commit 67b5415

Please sign in to comment.