Skip to content

Extend invite expiration time to 7 days #22

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

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

Conversation

AnthonyRonning
Copy link
Contributor

@AnthonyRonning AnthonyRonning commented Mar 13, 2025

This PR extends the invite expiration time from 24 hours to 7 days (168 hours).

Changes:

  • Updated the expiry time in create_invite function from 24 hours to 168 hours (7 days)
  • No changes to the method signature or behavior, just updated the expiration duration

Fixes #19

Summary by CodeRabbit

  • New Features
    • Invite codes now remain valid for 7 days instead of 24 hours, offering users an extended period to utilize their invite links.

Copy link

coderabbitai bot commented Mar 13, 2025

Walkthrough

The pull request contains two minor changes. One change removes a trailing newline from the NewInviteCode implementation in the invite codes model file without affecting functionality. The other change updates the invite creation function to extend the expiry duration from 24 hours to 168 hours (7 days). No modifications were made to public entities.

Changes

File Change Summary
src/models/invite_codes.rs Removed a trailing newline from the NewInviteCode implementation, with no impact on functionality.
src/web/…/invite_routes.rs Updated the create_invite function to set the invite code expiry from 24 hours to 168 hours (7 days).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant InviteRoutes
    participant InviteModel

    Client->>InviteRoutes: Request to create invite
    Note over InviteRoutes, InviteModel: Set expiry duration to 168 hours
    InviteRoutes->>InviteModel: Generate invite code with updated expiry
    InviteModel-->>InviteRoutes: Return new invite code
    InviteRoutes-->>Client: Respond with invite details
Loading

Poem

Oh, I hop with glee, a change so fine,
A subtle trim at the end of a line.
Expiry lengths now stretch for days,
In code and invites, magic stays.
A rabbit's cheer, with 🐰 and vibrant rays!


📜 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 f6a9fd7 and 2f33b52.

📒 Files selected for processing (2)
  • src/models/invite_codes.rs (1 hunks)
  • src/web/platform/invite_routes.rs (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Rust CI
src/models/invite_codes.rs

[error] 161-161: Formatting check failed. Please run 'cargo fmt' to format the code.

src/web/platform/invite_routes.rs

[error] 344-344: Formatting check failed. Please run 'cargo fmt' to format the code.

⏰ Context from checks skipped due to timeout of 100000ms (1)
  • GitHub Check: Development Reproducible Build
🔇 Additional comments (3)
src/models/invite_codes.rs (1)

163-163:

❓ Verification inconclusive

Formatting issue detected.

The pipeline indicates a formatting check failure. You should run cargo fmt to ensure consistent formatting in the code.


🏁 Script executed:

#!/bin/bash
# Verify if the file has the correct formatting
cargo fmt --check src/models/invite_codes.rs

Length of output: 142


Ensure Rust Toolchain is Available for Formatting Verification

The formatting check did not run as expected because the cargo command was not found in the verification environment. Please verify that the Rust toolchain is installed and accessible (i.e., cargo is in your PATH). Once confirmed, rerun cargo fmt to ensure consistent formatting in src/models/invite_codes.rs.

  • Verify that Rust and Cargo are correctly installed in your CI and local development environments.
  • Rerun the formatting check once the toolchain is available to confirm that no formatting issues remain.
src/web/platform/invite_routes.rs (2)

90-90: Successfully extended invite expiration time to 7 days.

The change from 24 hours to 168 hours (7 days) for the invite expiration time aligns with the PR objectives to extend the default expiration window. This gives users more time to accept invitations.


346-346:

❓ Verification inconclusive

Formatting issue detected.

The pipeline indicates a formatting check failure. Please run cargo fmt to fix the formatting issue.


🏁 Script executed:

#!/bin/bash
# Verify if the file has the correct formatting
cargo fmt --check src/web/platform/invite_routes.rs

Length of output: 149


Action Required: Verify Rust Toolchain Setup and File Formatting

The formatting check using cargo fmt --check src/web/platform/invite_routes.rs failed because the cargo command was not found. Please ensure that the Rust toolchain (including cargo and rustfmt) is installed in your CI/local environment. Manually run cargo fmt on src/web/platform/invite_routes.rs and confirm that there are no formatting issues. Once the toolchain is available and the formatting check passes, update your environment or pipeline configuration accordingly.

✨ 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.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR modifies the invite code expiration logic to extend the default duration from 24 hours to 7 days, while adding flexibility through an optional parameter.

  • Missing validation for negative or unreasonably large expiry durations in NewInviteCode::new()
  • Should align validation with similar patterns in PlatformEmailVerification and PlatformPasswordReset which enforce positive durations and reasonable limits
  • Consider adding unit tests to verify expiration time calculations
  • Recommend adding documentation for the new optional parameter behavior
  • Should update related error handling to include specific expiration validation errors

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

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.

Extend invite expiration time
1 participant