-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkp/pkp-lib#10090 Ensure anonymity in discussions for double blind reviews #10391
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -327,14 +327,11 @@ public function fetch($request, $template = null, $display = false, $actionArgs | |
// if current user is an anonymous reviewer, filter out authors | ||
foreach ($reviewAssignments as $reviewAssignment) { | ||
if ($reviewAssignment->getReviewerId() == $user->getId()) { | ||
if ($reviewAssignment->getReviewMethod() != ReviewAssignment::SUBMISSION_REVIEW_METHOD_OPEN) { | ||
// Replaces StageAssignmentDAO::getBySubmissionAndRoleId | ||
$excludeUsers = StageAssignment::withSubmissionIds([$query->assocId]) | ||
if ($reviewAssignment->getReviewMethod() == ReviewAssignment::SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS) { | ||
$stageAssignments = StageAssignment::withSubmissionIds([$query->assocId]) | ||
->withRoleIds([Role::ROLE_ID_AUTHOR]) | ||
->withUserId($user->getId()) | ||
->get() | ||
->pluck('userId') | ||
->all(); | ||
->get(); | ||
$excludeUsers = $stageAssignments->pluck('userId')->all(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we retrieve excluded users without intermediate variables? Like: $excludeUsers = StageAssignment::withSubmissionIds([$query->assocId])
->withRoleIds([Role::ROLE_ID_AUTHOR])
->get()
->pluck('userId')
->all();
``` There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update the code as you suggested here. But as mentioned in the comment about the accessor, I'll proceed with the final update once we decide on the approach regarding the accessor. |
||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this method in the PR?
HasCamelCasing
trait should handle all cases of transforming between camel and snake case when Model is instantiated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vitaliy-1 Yes I also wanted to avoid adding the
getUserIdAttribute
accessor. But I had to implement this accessor because thepluck('userId')
method does not trigger theHasCamelCasing
transformation. This trait works for direct property access and method calls, butpluck
directly queries the database fields, which are in snake-case (user_id
). Without the accessor,pluck('userId')
returnsnull
values since it doesn't recognize the camel-case attribute, this is how the original code was and caused the issue of author names being visible in double-anonymous reviews.I initially faced this issue when trying to use
pluck('userId')
directly, which is why I added the accessor to ensure the correct transformation.If preferred, I can remove the accessor and revert to using the snake_case user_id like
→pluck('user_id')
, but this approach is not ideal within our codebase.Another alternative could be using
map()
to iterate over the collection and access theuserId
attribute but it is less efficient thanpluck()
and introduces unnecessary overhead.