pkp/pkp-lib#12035 (3.4.0) Fix issue where recommend-only users cannot add a new review round#12037
Conversation
| } elseif ($stageAssignment->getRecommendOnly()) { | ||
| if ($decisionType->getDecision() === Decision::NEW_EXTERNAL_ROUND) { | ||
| $isAllowed = true; | ||
| } |
There was a problem hiding this comment.
I think all these ifs can be simplified into:
| } elseif ($stageAssignment->getRecommendOnly()) { | |
| if ($decisionType->getDecision() === Decision::NEW_EXTERNAL_ROUND) { | |
| $isAllowed = true; | |
| } | |
| $decision = $decisionType->getDecision(); | |
| if (!$stageAssignment->getRecommendOnly() || | |
| $decision === Decision::NEW_EXTERNAL_ROUND || | |
| Repo::decision()->isRecommendation($decision)) { | |
| $isAllowed = true; | |
| break; | |
| } |
There was a problem hiding this comment.
In fact, after checking the other nearby lines, I think a lot of improvements should be added here:
- The only purpose of the
foreachloop seems to perhaps set the$isAllowedto true, therefore, abreakcan be added once the value is set to true... - On the lines 62 and 66: the
elseisn't needed and can be removed, a decreased indentation simplifies reading code. - Looks like the block ranging from line 84 until 96 has no dependency with the inner variables of the
foreachloop, therefore, it doesn't need to be called many times (there's a query involved and this is expensive) and should be cached... (e.g.$cached ??= (function (){...})();or using an extra private method)
asmecher
left a comment
There was a problem hiding this comment.
I'm ambivalent about this change -- if you were asking me about whether recommend-only users should be able to start a new round, I'd probably say no (not that I'm particularly informed about this aspect of workflow); however, this is a regression from 3.3.0, probably an accidental one made during refactor of editorial decisions. So I'm OK either way.
However, we probably should stay consistent in this decision between internal and external reviews (for OMP).
jonasraoni
left a comment
There was a problem hiding this comment.
I've never touched this piece of code, but I've left a couple of suggestions, which I think are good to handle while there's someone touching this.
|
@asmecher Since this is working fine in 3.4, could you please apply it to 3.4 for now and consider further improvements in later versions? I’ve just simplified the if statements as @jonasraoni suggested, while the remaining enhancements can be addressed for 3.5 and beyond. |
ead1ecf to
5d52581
Compare
|
@salmanm2003, I'll leave that decision to @Vitaliy-1 as the workflow lead. |
|
@salmanm2003, I'm ok with this change. For consistency, this also should be applied for the 3.5 and main branch. Can you make necessary PRs? Also, I see some additional changes in this PRs which refer to another issue. Should they be here? |
0bbd45c to
0facd94
Compare
|
@Vitaliy-1 The PR for 3.4 is now ready to be merged, and I have removed the additional commits that were not related to this issue.
|
|
@Vitaliy-1 Would it be possible to merge this into 3.4 soon please? I can then look into the bug separately for 3.5 and main. |
Vitaliy-1
left a comment
There was a problem hiding this comment.
Thanks, @salmanm2003.
As per Alec's comment, I think we need one more minor change
| $decision = $decisionType->getDecision(); | ||
| if ( | ||
| !$stageAssignment->getRecommendOnly() || | ||
| $decision === Decision::NEW_EXTERNAL_ROUND || |
There was a problem hiding this comment.
Can we treat OMP specific internal review the same way? See NEW_INTERNAL_ROUND.
There was a problem hiding this comment.
Hi @Vitaliy-1 , The changes have been added for OMP as well.
Here is the PR for OMP: pkp/omp#2312
Could you review it please and let me know if any issues?
…itors_add_new_round
…nal review round
7b61194 to
297e2a9
Compare

This is for: #12035