Skip to content
Permalink
Browse files

More log message improvements.

  • Loading branch information...
kohler committed Oct 10, 2019
1 parent 8fa639d commit 7bf1416664585323fca1c112ed7d81381d82fda1
Showing with 39 additions and 22 deletions.
  1. +15 −10 log.php
  2. +3 −3 review.php
  3. +1 −1 src/assigners/a_tag.php
  4. +4 −4 src/conference.php
  5. +16 −4 src/review.php
25 log.php
@@ -634,23 +634,28 @@ function render_users($users, $via) {
$act = $m[4];
} else if (substr($act, 0, 7) === "Comment"
&& preg_match('/\AComment (\d+)(.*)\z/s', $act, $m)) {
$at = "<a href=\"" . hoturl("paper", "p={$row->paperId}#cid{$m[1]}") . "\">Comment " . $m[1] . "</a>";
$at = "<a href=\"" . $Conf->hoturl("paper", "p={$row->paperId}#cid{$m[1]}") . "\">Comment " . $m[1] . "</a>";
$act = $m[2];
} else if (substr($act, 0, 8) === "Response"
&& preg_match('/\AResponse (\d+)(.*)\z/s', $act, $m)) {
$at = "<a href=\"" . hoturl("paper", "p={$row->paperId}#cid{$m[1]}") . "\">Response " . $m[1] . "</a>";
$at = "<a href=\"" . $Conf->hoturl("paper", "p={$row->paperId}#cid{$m[1]}") . "\">Response " . $m[1] . "</a>";
$act = $m[2];
} else if (strpos($act, " mail ") !== false
&& preg_match('/\A(Sending|Sent|Account was sent) mail #(\d+)(.*)\z/s', $act, $m)) {
$at = $m[1] . " <a href=\"" . hoturl("mail", "fromlog=$m[2]") . "\">mail #$m[2]</a>";
$at = $m[1] . " <a href=\"" . $Conf->hoturl("mail", "fromlog=$m[2]") . "\">mail #$m[2]</a>";
$act = $m[3];
} else if (substr($act, 0, 5) === "Tag: ") {
$at = "Tag: ";
$act = substr($act, 5);
while (preg_match('/\A([-+])#([^\s#]*)(#[-+\d.]+ ?| ?)(.*)\z/s', $act, $m)) {
$at .= $m[1] . "<a href=\"" . hoturl("search", "q=%23" . urlencode($m[2])) . "\">#"
. htmlspecialchars($m[2]) . "</a>" . htmlspecialchars($m[3]);
$act = $m[4];
} else if (substr($act, 0, 3) === "Tag"
&& preg_match('{\ATag:? ((?:[-+]#[^\s#]*(?:#[-+\d.]+|)(?: |\z))+)(.*)\z}s', $act, $m)) {
$at = "Tag";
$act = $m[2];
foreach (explode(" ", $m[1]) as $word) {
if (($hash = strpos($word, "#", 2)) === false) {
$hash = strlen($word);
}
$at .= " " . $word[0] . '<a href="'
. $Conf->hoturl("search", ["q" => substr($word, 1, $hash - 1)])
. '">' . htmlspecialchars(substr($word, 1, $hash - 1))
. '</a>' . substr($word, $hash);
}
} else if ($row->paperId > 0
&& (substr($act, 0, 8) === "Updated "
@@ -79,7 +79,7 @@ function loadRows() {
&& $Qreq->post_ok()) {
$result = $Me->unsubmit_review_row($paperTable->editrrow);
if ($result) {
$Me->log_activity_for($paperTable->editrrow->contactId, "Unsubmitted review {$paperTable->editrrow->reviewId}", $prow);
$Me->log_activity_for($paperTable->editrrow->contactId, "Review {$paperTable->editrrow->reviewId} unsubmitted", $prow);
$Conf->confirmMsg("Unsubmitted review.");
}
$Conf->self_redirect($Qreq); // normally does not return
@@ -146,7 +146,7 @@ function loadRows() {
else {
$result = $Conf->qe("delete from PaperReview where paperId=? and reviewId=?", $prow->paperId, $paperTable->editrrow->reviewId);
if ($result) {
$Me->log_activity_for($paperTable->editrrow->contactId, "Deleted review {$paperTable->editrrow->reviewId}", $prow);
$Me->log_activity_for($paperTable->editrrow->contactId, "Review {$paperTable->editrrow->reviewId} deleted", $prow);
$Conf->confirmMsg("Deleted review.");
$Conf->qe("delete from ReviewRating where paperId=? and reviewId=?", $prow->paperId, $paperTable->editrrow->reviewId);
if ($paperTable->editrrow->reviewToken != 0)
@@ -265,7 +265,7 @@ function download_one_text_review(ReviewInfo $rrow) {
$Now, $prow->paperId, $rrow->reviewId);
if ($Me->is_signed_in())
$rrow->delete_acceptor();
$Me->log_activity_for($rrow->contactId, "Accepted review {$rrow->reviewId}", $prow);
$Me->log_activity_for($rrow->contactId, "Review {$rrow->reviewId} accepted", $prow);
}
$Conf->confirmMsg("Thank you for confirming your intention to finish this review. You can download the paper and review form below.");
$Conf->self_redirect($Qreq);
@@ -344,7 +344,7 @@ function execute(AssignmentSet $aset) {
$aset->conf->save_setting("has_colontag", 1);
$aset->conf->invalidate_caches("taginfo");
});
$aset->user->log_activity("Tag: " . ($this->index === null ? "-" : "+") . "#$this->tag" . ($this->index ? "#$this->index" : ""), $this->pid);
$aset->user->log_activity("Tag " . ($this->index === null ? "-" : "+") . "#$this->tag" . ($this->index ? "#$this->index" : ""), $this->pid);
$aset->cleanup_notify_tracker($this->pid);
}
}
@@ -3679,12 +3679,12 @@ function save_logs($on) {
$what = substr($cid_text, $pos + 1);
$pids = array_keys($pids);
// Combine `Tag:` messages
if (substr($what, 0, 5) === "Tag: "
// Combine `Tag` messages
if (substr($what, 0, 4) === "Tag "
&& ($n = count($qv)) > 0
&& substr($qv[$n-1][4], 0, 5) === "Tag: "
&& substr($qv[$n-1][4], 0, 4) === "Tag "
&& $last_pids === $pids) {
$qv[$n-1][4] = $what . substr($qv[$n-1][4], 4);
$qv[$n-1][4] = $what . substr($qv[$n-1][4], 3);
} else {
foreach (self::format_log_values($what, $user, $dest_user, $true_user, $pids) as $x) {
$qv[] = $x;
@@ -2109,10 +2109,22 @@ private function do_save(Contact $user, PaperInfo $prow, $rrow) {
// log updates -- but not if review token is used
if (!$usedReviewToken
&& $diffinfo->nonempty()) {
$text = ($newsubmit ? "Submitted" : ($submit ? "Updated" : "Updated draft"))
. " review $reviewId";
if ($diffinfo->fields())
$text .= " " . join(", ", array_map(function ($f) { return $f->search_keyword(); }, $diffinfo->fields()));
$actions = [];
if (!$rrow) {
$actions[] = "started";
}
if ($newsubmit) {
$actions[] = "submitted";
}
if ($rrow && !$newsubmit && $diffinfo->fields()) {
$actions[] = "edited";
}
$text = "Review $reviewId " . join(", ", $actions) . ($submit ? "" : " draft");
if ($diffinfo->fields()) {
$text .= " " . join(", ", array_map(function ($f) {
return $f->search_keyword();
}, $diffinfo->fields()));
}
$user->log_activity_for($rrow ? $rrow->contactId : $user->contactId, $text, $prow);
}

0 comments on commit 7bf1416

Please sign in to comment.
You can’t perform that action at this time.