Skip to content
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

Code review v2 clean-up #46549

Merged
merged 7 commits into from
May 27, 2022
Merged

Conversation

maureensturgeon
Copy link
Contributor

@maureensturgeon maureensturgeon commented May 26, 2022

  • Adds CSRF token to code_review GET response
  • Removes request to code review v1 endpoint (used for csrf)
  • Adds comment requested in a previous PR
  • Updates ability logic for project_commits to use code review v2 logic

Links

Testing story

Tested locally

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@maureensturgeon maureensturgeon changed the title Maureen/lp 2357 fix commits ability Code review v2 clean-up May 26, 2022
@maureensturgeon maureensturgeon marked this pull request as ready for review May 26, 2022 17:53
@maureensturgeon maureensturgeon requested review from a team May 26, 2022 17:53
@@ -24,7 +24,7 @@ def project_commits
user_storage_id, project_id = storage_decrypt_channel_id(params[:channel_id])
project_owner = User.find_by(id: user_id_for_storage_id(user_storage_id))
return render :not_acceptable unless project_owner
return render :forbidden unless can?(:project_commits, ProjectVersion.new, project_owner, project_id)
return render :forbidden unless can?(:project_commits, ProjectVersion.new, project_owner)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) This seems a little strange to create a ProjectVersion object and then not use it at all. Maybe define an action on Project or User instead? Also ok to just leave as-is.

Also, should the create endpoint above check some kind of permissions? (ok to fix later).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to fix create endpoint right now

@@ -201,6 +202,11 @@ def initialize(user)
)
can_view_as_user_for_code_review = true
end

# Code review V2
if user != user_to_assume && !user_to_assume.student_of?(user) && can?(:code_review, user_to_assume)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What case does !user_to_assume.student_of?(user) cover?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from v1, I guess the teacher isn't viewing as a code reviewer like the student is, the teacher is viewing through the teacher view? We should probably run through all of these scenarios in a bug bash and make sure it all works as expected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, we don't have to hold up this PR, but we should clarify with mike what this pane looks like for the teacher of a student. Does it looks just like when a (student) peer views it? If not, what's different?

What happens if a teacher creates a code review?

Also, I wonder if teachers practice this in PL and what view (student or teacher) they expect to see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching up after a week out -- did y'all get clarity on this? I had to some work in the spring to get V1 to work for teacher accounts acting as participants (ie, the PL scenario), and my understanding at that point was that we wanted code review to work for a teacher account enrolled as in a section as it would for a student account:

#45755

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems right, that we'd want the teacher to be able to participate as a student. We'll want to make sure that scenario works. During the bug bash last week it was decided that the teacher should be able to comment on student's code reviews and delete comments, but there wasn't more clarity given on specific teacher scenario teachers/experience.

@maureensturgeon maureensturgeon merged commit f76fc90 into staging May 27, 2022
@maureensturgeon maureensturgeon deleted the maureen/LP-2357-fix-commits-ability branch May 27, 2022 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants