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

Add backend support for ownership requests #740

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

gabeweng
Copy link

@gabeweng gabeweng commented Oct 15, 2024

Implement backend for new Ownership Requests feature and update Membership Request feature.

New:

  • OwnershipRequest model
  • UserMembershipRequestSerializer and OwnershipRequestViewSet to see/create/destroy Ownership Requests for a user
  • Routes for users to manage their own requests under api/requests/ownership
  • OwnershipRequestSerializer and OwnershipRequestManagementViewSet for management (including accept and deny) of Ownership Requests by club admin and site admin
  • Routes for clubs and superusers to manage requests under api/clubs/{club_code}/ownershiprequests
  • Email template for sending out ownership requests

Modified:

  • MembershipRequest model (person renamed to requester, withdrew renamed to withdrawn, related names for MembershipRequest added for requester and club)
  • api/requests/membership used instead of api/requests/ for membership requests

@gabeweng gabeweng requested a review from rm03 October 15, 2024 18:45
Copy link
Member

@rm03 rm03 left a comment

Choose a reason for hiding this comment

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

Off to a great start! Left some comments; feel free to reply/reach out with any questions. Please also add some test cases when you get a chance 🙂

backend/clubs/admin.py Outdated Show resolved Hide resolved
backend/clubs/migrations/0114_ownershiprequest.py Outdated Show resolved Hide resolved
backend/clubs/models.py Outdated Show resolved Hide resolved
backend/clubs/models.py Outdated Show resolved Hide resolved
backend/clubs/models.py Outdated Show resolved Hide resolved
backend/clubs/views.py Outdated Show resolved Hide resolved
backend/clubs/views.py Outdated Show resolved Hide resolved
backend/templates/emails/ownershiprequest.html Outdated Show resolved Hide resolved
backend/templates/emails/ownershiprequest.html Outdated Show resolved Hide resolved
backend/templates/emails/ownershiprequest.html Outdated Show resolved Hide resolved
Copy link
Member

@aviupadhyayula aviupadhyayula left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, this looks like a great start! Rohan was (very) thorough, not much to add. One last nit: consider updating the PR's title and description to be a little more descriptive. (Take a look at past PRs for examples.) It's a small detail, but when you're reviewing code years in the future, it's great to understand what the author was thinking.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 90.27778% with 14 lines in your changes missing coverage. Please review.

Project coverage is 72.59%. Comparing base (b280dc0) to head (6315065).

Files with missing lines Patch % Lines
backend/clubs/admin.py 66.66% 6 Missing ⚠️
backend/clubs/views.py 91.52% 5 Missing ⚠️
backend/clubs/models.py 91.30% 2 Missing ⚠️
backend/clubs/permissions.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #740      +/-   ##
==========================================
+ Coverage   71.95%   72.59%   +0.63%     
==========================================
  Files          32       32              
  Lines        6953     7056     +103     
==========================================
+ Hits         5003     5122     +119     
+ Misses       1950     1934      -16     

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

@gabeweng gabeweng marked this pull request as ready for review November 10, 2024 17:17
@aviupadhyayula aviupadhyayula changed the title Feat/ownership requests Add backend support for ownership requests Nov 13, 2024
Copy link
Member

@rm03 rm03 left a comment

Choose a reason for hiding this comment

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

Thanks for resolving the comments from earlier! Left a few more, but mostly looks good to me!

backend/clubs/models.py Outdated Show resolved Hide resolved
backend/clubs/serializers.py Outdated Show resolved Hide resolved
backend/clubs/views.py Outdated Show resolved Hide resolved
backend/tests/clubs/test_views.py Show resolved Hide resolved
Copy link
Member

@aviupadhyayula aviupadhyayula left a comment

Choose a reason for hiding this comment

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

Great work Gabe! Rohan did a great job with his review, so not much to add outside of minor comments.

backend/tests/clubs/test_views.py Outdated Show resolved Hide resolved
backend/clubs/models.py Outdated Show resolved Hide resolved
backend/clubs/serializers.py Outdated Show resolved Hide resolved
Comment on lines +3996 to +3998
queryset = OwnershipRequest.objects.filter(
withdrawn=False, created_at__lte=timezone.now() - datetime.timedelta(days=7)
)
Copy link
Member

@aviupadhyayula aviupadhyayula Nov 15, 2024

Choose a reason for hiding this comment

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

@rm03 Do you know why we're limiting this to requests that are a week old? I feel like admins should be able to view all requests. We've had situations where someone needs to take over a club a day before the renewal deadline / Wharton applications / club fair.

Copy link
Member

@rm03 rm03 Nov 17, 2024

Choose a reason for hiding this comment

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

The idea was that we give club owners a week to resolve the request before it goes to OSA; if we show all requests to OSA at once, they might resolve the request before the club owners have a chance to address it. This could be problematic in the scenario that you described, so maybe we should show all requests but highlight the ones that are over a week old on the frontend.

backend/templates/emails/ownership_request.html Outdated Show resolved Hide resolved
backend/templates/emails/ownership_request.html Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants