Skip to content
This repository was archived by the owner on Dec 11, 2018. It is now read-only.

Commit cf4be39

Browse files
committed
Allow admins to see reviews without reviewing
If there is no review by the admin then the section for reviews by others will be collapsed by default. A happy medium solution.
1 parent 9a9a035 commit cf4be39

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

data/templates/proposals/view_reviews.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ <h3 class="panel-title">{{ ( 'review-' ~ crit )|message }}
7676
<div class="panel-heading">
7777
<h2 class="panel-title">
7878
{{ 'proposal-summary'|message }}
79-
<a class="accordion-toggle" data-toggle="collapse" href="#summary-body"></a>
80-
</h2>
79+
<a class="accordion-toggle {% if myreview is empty %}collapsed{% endif %}" data-toggle="collapse" href="#summary-body"></a> </h2>
8180
</div>
82-
<div id="summary-body" class="panel-body panel-collapse collapse in">
81+
<div id="summary-body" class="panel-body panel-collapse collapse {% if myreview is not empty %}in{% endif %}">
8382
<dl class="dl-horizontal">
8483
<dt>{{ 'summary-list-reviewers'|message }}</dt>
8584
<dd><ul class="list-inline">

src/Controllers/Proposals/View.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,21 @@ protected function handleGet( $id ) {
4747
$this->view->setData( 'proposal', $proposal );
4848

4949
if ( $this->authManager->isReviewer() ) {
50-
// Reviewers can only see reviews after they have reviewed
51-
// a proposal themselves
5250
$myReview = $this->reviewsDao->reviewByUser( $id );
5351
if ( $myReview ) {
5452
$this->view->setData( 'myreview', $myReview );
55-
$this->addReviewsToView( $id );
5653
} else {
5754
$this->view->setData( 'myreview', array() );
5855
}
56+
57+
// Reviewers can only see reviews after they have reviewed
58+
// the proposal themselves or if they are also an admin
59+
if ( $myReview || $this->authManager->isAdmin() ) {
60+
$this->addReviewsToView( $id );
61+
}
5962
} else {
63+
// Non-reviewers always see reviews. The template is responsible for
64+
// showing/hiding information based on the user's permissions.
6065
$this->addReviewsToView( $id );
6166
}
6267

0 commit comments

Comments
 (0)