From 1b5d2c7ad4ce9a2c579d060613b0a5f7f1517672 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Sat, 9 Sep 2023 08:55:15 -0400 Subject: [PATCH] Error message to expand on assertion. --- src/pages/p_paper.php | 3 +++ src/permissionproblem.php | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/p_paper.php b/src/pages/p_paper.php index 2f029edc7..dcef7149f 100644 --- a/src/pages/p_paper.php +++ b/src/pages/p_paper.php @@ -196,6 +196,9 @@ function handle_update($action) { $conf->feedback_msg($this->ps->decorated_message_list()); return; } + if (!$this->user->can_view_paper($new_prow)) { + error_log("{$conf->dbname}: user {$this->user->email} #{$this->user->contactId} cannot view new paper #{$new_prow->paperId} because " . json_encode($this->user->perm_view_paper($new_prow))); + } assert($this->user->can_view_paper($new_prow)); // submit paper if no error so far diff --git a/src/permissionproblem.php b/src/permissionproblem.php index 77da9ebbf..f234e8787 100644 --- a/src/permissionproblem.php +++ b/src/permissionproblem.php @@ -89,7 +89,13 @@ function count() { #[\ReturnTypeWillChange] function jsonSerialize() { - return $this->as_array(); + $a = $this->as_array(); + if (isset($a["option"])) { + $opt = $a["option"]; + '@phan-var PaperOption $opt'; + $a["option"] = ["id" => $opt->id, "name" => $opt->name]; + } + return $a; } /** @return array */