-
Notifications
You must be signed in to change notification settings - Fork 35
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
Limit retention period #2618
base: main
Are you sure you want to change the base?
Limit retention period #2618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, good work! Just one thing about the moving of the validations on the retention periods, could you take a look at my comment?
|> validate_inclusion(:history_retention_period, @retention_periods) | ||
|> validate_inclusion(:dataclip_retention_period, @retention_periods) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this should still be validated no? We're extending the validation via a hook, but these constraints are still valid here right?
@@ -91,7 +91,7 @@ defmodule LightningWeb.ProjectLive.InviteCollaboratorComponent do | |||
|
|||
project_users = Ecto.Changeset.get_embed(changeset, :invited_collaborators) | |||
|
|||
case ProjectUsersLimiter.request_new( | |||
case ProjectLimiter.request_new_user( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 nice, I'm liking the renaming and conforming of the ProjectLimiter changes.
on_mount {LightningWeb.Hooks, :project_scope} | ||
on_mount {LightningWeb.Hooks, :limit_github_sync} | ||
on_mount {LightningWeb.Hooks, :limit_mfa} | ||
on_mount {LightningWeb.Hooks, :limit_retention_periods} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud here, I think these hooks are needing a rename, afaik all the hooks in the file are related to projects.
Also, at least 2/3 of these are only used in this live view, so we might be extending an 'implicit contract' - where this one live view expects a bunch of assigns that are added by another module.
I don't necessarily thing we need to change this now - but the settings module (when using hooks) feels a bit 'stringy' where we quietly plug in a bunch of assigns that are all very specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. Feels like we need a central place to extend the settings live view with limiters and extensions
<.input | ||
type="select" | ||
prompt="Select Period" | ||
options={ | ||
Enum.map([7, 14, 30, 90, 180, 365], fn days -> | ||
Enum.map(@data_retention_periods, fn days -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thank goodness 😅
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2618 +/- ##
==========================================
- Coverage 90.84% 90.82% -0.03%
==========================================
Files 320 319 -1
Lines 11221 11233 +12
==========================================
+ Hits 10194 10202 +8
- Misses 1027 1031 +4 ☔ View full report in Codecov by Sentry. |
Description
This PR adds an extension that allows for limiting retention period.
The extension allows for 3 things:
project changeset
when callingProjects.update_project/2
I also found a refactoring opportunity. I combined
ProjectAlertsLimiter
andProjectUsersLimiter
intoProjectLimiter
to avoid adding extra modules.Validation steps
This can be validated in the billing app. There are also tests that validate the functionality
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy
Pre-submission checklist
:owner
,:admin
,:editor
,:viewer
)