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

Vouchers for user promotion - Part 1: Introduction of Vouchers #670

Merged
merged 59 commits into from
Sep 9, 2024

Conversation

fosterfarrell9
Copy link
Collaborator

@fosterfarrell9 fosterfarrell9 commented Aug 6, 2024

In this PR, we change the way in which users can become tutors, editors or teachers. Until now, they can be selected from a dropdown. With the change implemented in this PR, vouchers are issued, which can then be communicated externally (e.g. in persona or mail) to the people who are supposed to get the promotion in user status, and they can then in turn redeem these vouchers in their user profile to get the desired position (see part 2 of this PR: #671). The philosophy behind this is to further reduce the amount data that can be seen by users in elevated positions.

This should fit in nicely into the existing workflow where mails are sent to tutors anyways for information exchange. Adding the voucher code there is not too much of an effort. Note that tutors could of course go ahead and share the voucher with other people, we cannot control that. But if somebody really does that, the teacher will notice and can intervene.

Because of its size, this feature is split into two PRs. This is the first one which deals with the creation and destruction of vouchers. The second one deals with the actual redemption part, see #671.

Out of scope

This PR also

ToDo

  • Add Cypress Tests

Notes for reviewers

  • In order to make the cypress tests run through, Fix lecture edit page if active term is not set #683 needs to be merged.
  • Please check that generic users cannot create/destroy vouchers. This is covered in the unit tests (in vouchers_controller_spec.rb), but since this is security relevant, it would be good to check this in detail.

Preview

image

During the merge, I noticed that the version specifier for "selenium-webdriver"
was incorrectly placed inside the comment, so I fixed that
(not yet `bundle install` executed, will do in next commit)
(see also the merge comment before this commit)
Copy link

codecov bot commented Sep 8, 2024

Codecov Report

Attention: Patch coverage is 84.84848% with 15 lines in your changes missing coverage. Please review.

Project coverage is 54.40%. Comparing base (78467de) to head (6046ac7).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
app/controllers/vouchers_controller.rb 68.08% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #670      +/-   ##
==========================================
+ Coverage   53.86%   54.40%   +0.54%     
==========================================
  Files         157      160       +3     
  Lines        6645     6744      +99     
==========================================
+ Hits         3579     3669      +90     
- Misses       3066     3075       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Splines
Splines previously approved these changes Sep 8, 2024
Copy link
Member

@Splines Splines left a comment

Choose a reason for hiding this comment

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

LGTM now! I've added some more cypress tests to also test the expiration of vouchers there (via newly introduced time travelling).

Please make sure to review everything I added to this PR by means of my last commits before finally squashing and merging into the dev branch.

After the "squash and merge", I will take care of merge conflicts in the second part of the pull request.

app/models/voucher.rb Show resolved Hide resolved
Copy link
Member

@Splines Splines left a comment

Choose a reason for hiding this comment

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

the only thing left to do now is resolve the one conversation and merge dev into this branch where I fixed the flaky unit test, then rerun the tests and squash and merge

@fosterfarrell9 fosterfarrell9 merged commit c00ae31 into dev Sep 9, 2024
5 checks passed
@fosterfarrell9 fosterfarrell9 deleted the feature/vouchers-user-promotion branch September 9, 2024 21:25
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.

2 participants