Skip to content

Fixes Study Groups: Enable users to form or join virtual study groups where they can invite friends or other users. #24#265

Closed
10done wants to merge 16 commits into
alphaonelabs:mainfrom
10done:reminderfeature
Closed

Fixes Study Groups: Enable users to form or join virtual study groups where they can invite friends or other users. #24#265
10done wants to merge 16 commits into
alphaonelabs:mainfrom
10done:reminderfeature

Conversation

@10done
Copy link
Copy Markdown
Contributor

@10done 10done commented Mar 24, 2025

I implemented the invitation feature so that when a user sends an invitation, the system processes the invite and then redirects the user back to the study group detail page with a confirmation message. To achieve this, I updated the invitation view to use proper URL parameters—passing the course slug and group ID—to ensure that redirection resolves to a valid URL. I also updated the course detail link in the group detail template to use the course slug instead of the course ID. This ensures that after sending an invite, users see a confirmation message on the correct study group page, providing a smooth and consistent user experience.
Fixes #24

study.group.invitations.mp4

image

Summary by CodeRabbit

  • New Features
    • Users now see invitation notifications in the main navigation, displaying pending study group invites.
    • A refreshed interface enables creating study groups and invites through dedicated pages and buttons in the dashboard and group details.
    • Enhanced member displays and interactive invite options allow users to easily invite friends and manage their study group memberships.
  • Tests
    • New tests validate the study group invitation process, ensuring smooth handling of invites and membership additions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes add new study group and invitation functionalities. A new context processor now supplies pending invitation counts to templates. A dedicated form and several view functions enable the creation of study groups, sending invitations, and responding to them. The StudyGroup model is updated with additional helper methods and its members field now accepts blank entries. A new StudyGroupInvite model is introduced with fields for tracking invitation details. Corresponding URL routes, templates, and tests have been added to support the full invitation workflow.

Changes

File(s) Change Summary
web/context_processors.py, web/settings.py Added invitation_notifications to provide pending invite count and updated TEMPLATES configuration to include this context processor.
web/migrations/0043_alter_studygroup_…, web/models.py Modified StudyGroup model’s members field to allow blank entries; added methods (can_add_member, add_member, is_full) and introduced the StudyGroupInvite model with a UUID id, timestamps, status field, foreign keys, and invitation response methods (accept, decline).
web/forms.py, web/views.py, web/urls.py Added StudyGroupForm for creating study groups; introduced new view functions (invite_to_study_group, user_invitations, respond_to_invitation, create_study_group) and new URL patterns for invitation and group creation functionality.
web/templates/base.html, web/templates/dashboard/student.html, web/templates/web/study/create_group.html, web/templates/web/study/group_detail.html, web/templates/web/study/invitations.html Updated templates by adding a notification button for invitations, modifying the student dashboard to include a “Create Study Group” button, and adding new pages for creating study groups, displaying group details (with invite friends functionality), and managing invitations.
web/tests/test_study_groups.py Added tests for study group invitation functionality, including verifying that duplicate invitations are handled correctly.

Sequence Diagram(s)

sequenceDiagram
    participant U as User (Inviter)
    participant B as Browser
    participant V as invite_to_study_group View
    participant SG as StudyGroup Model
    participant SI as StudyGroupInvite Model
    participant NS as Notification System

    U->>B: Click "Invite Friends"
    B->>V: Send POST request with recipient details
    V->>SG: Verify user is a group member and group is not full
    SG-->>V: Return group validation result
    V->>SI: Create new invitation record
    SI-->>V: Confirmation of created invitation
    V->>NS: Create notification for the recipient
    NS-->>V: Confirmation of notification dispatch
    V-->>B: Return success response
Loading
sequenceDiagram
    participant U as User (Invitee)
    participant B as Browser
    participant V as respond_to_invitation View
    participant SG as StudyGroup Model
    participant SI as StudyGroupInvite Model
    participant NS as Notification System

    U->>B: Click "Accept/Decline Invitation"
    B->>V: Send POST request with response decision
    V->>SI: Update invitation status (accepted/declined)
    SI-->>V: Return updated invitation status
    alt Invitation Accepted
      V->>SG: Add user to the study group
      SG-->>V: Confirmation of membership update
      V->>NS: Notify inviter of acceptance
      NS-->>V: Notification sent
    else Invitation Declined
      V->>NS: Notify inviter of decline
      NS-->>V: Notification sent
    end
    V-->>B: Return success response
Loading

Suggested labels

d:20, d:21, d:23

Suggested reviewers

  • A1L13N

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dea129c and 57d4637.

📒 Files selected for processing (13)
  • web/context_processors.py (1 hunks)
  • web/forms.py (2 hunks)
  • web/migrations/0043_alter_studygroup_members_studygroupinvite.py (1 hunks)
  • web/models.py (2 hunks)
  • web/settings.py (1 hunks)
  • web/templates/base.html (1 hunks)
  • web/templates/dashboard/student.html (2 hunks)
  • web/templates/web/study/create_group.html (1 hunks)
  • web/templates/web/study/group_detail.html (2 hunks)
  • web/templates/web/study/invitations.html (1 hunks)
  • web/tests/test_study_groups.py (1 hunks)
  • web/urls.py (1 hunks)
  • web/views.py (4 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown
Contributor

🚨 Missing Issue Link

This pull request appears to not reference any GitHub issue.

As per our workflow requirements, all PRs should address an existing issue. This ensures:

  • Changes are properly tracked
  • Work is discussed before implementation
  • Code reviews are more focused

How to Fix This

Please link this PR to an existing issue using one of these methods:

  1. Reference the issue in your PR description: "Fixes darkmode/about #123" or "Addresses darkmode/about #123"
  2. Use GitHub's interface to link the PR to an issue in the Development section
    • Look for the section that says "Development" on the right side of your PR
    • Click "Link an issue" or "Link issues"
    • Select the relevant issue(s)
  3. If no issue exists yet, please create one first

This PR will be automatically closed. Feel free to reopen it once you've linked it to an issue or added appropriate labels.

Thank you for your contribution!

@github-actions github-actions Bot closed this Mar 24, 2025
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.

Study Groups: Enable users to form or join virtual study groups where they can invite friends or other users.

1 participant