Skip to content

Implementation/72816 limit sprint creation based on project s sharing settings#22438

Merged
ulferts merged 5 commits intodevfrom
implementation/72816-limit-sprint-creation-based-on-project-s-sharing-settings
Mar 25, 2026
Merged

Implementation/72816 limit sprint creation based on project s sharing settings#22438
ulferts merged 5 commits intodevfrom
implementation/72816-limit-sprint-creation-based-on-project-s-sharing-settings

Conversation

@ulferts
Copy link
Copy Markdown
Contributor

@ulferts ulferts commented Mar 20, 2026

Ticket

https://community.openproject.org/wp/72816

What are you trying to accomplish?

If the project is configured to receive sprints, creating own sprints should no longer be possible. Updating sprints that might still stick around (e.g. because a work package is associated to them) should still be possible, though.

To that end:

  • The button to create sprints is hidden.
  • The contract prevents creation of sprints. Serves as a safety net and once the API for sprints exists, the limitation will be enforced as well.

Merge checklist

  • Added/updated tests

@ulferts ulferts marked this pull request as ready for review March 23, 2026 08:38
@ulferts ulferts force-pushed the implementation/72816-limit-sprint-creation-based-on-project-s-sharing-settings branch from e53e5ec to 61c9c2a Compare March 23, 2026 11:13
Copy link
Copy Markdown
Contributor

@toy toy left a comment

Choose a reason for hiding this comment

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

More or less only nitpicks, even the base error not shown is sort of hard to trigger

def user_authorized
return if model.project.nil?

unless user.allowed_in_project?(:create_sprints, model.project)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be better for the permission to be named edit_sprints, but it was not added in this PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think manage_sprints would be even better. But as you said, out of scope.

unless user.allowed_in_project?(:create_sprints, model.project)
errors.add :base, :error_unauthorized
if model.project.receive_shared_sprints?
errors.add :project, :receiving_sprints
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Base errors are not displayed in the dialog, so if I open dialog, then switch the project to receiving shared sprints and then submit the dialog, it re-renders without any explanation of the problem

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True, but for now, it probably isn't a real problem, given that the button to create a sprint doesn't exist if the user lacks the permission.

The modal should still display the base errors but that is out of scope I feel.

@toy toy closed this Mar 25, 2026
@toy toy deleted the implementation/72816-limit-sprint-creation-based-on-project-s-sharing-settings branch March 25, 2026 11:53
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2026
@toy toy restored the implementation/72816-limit-sprint-creation-based-on-project-s-sharing-settings branch March 25, 2026 11:54
@toy toy reopened this Mar 25, 2026
@toy
Copy link
Copy Markdown
Contributor

toy commented Mar 25, 2026

Sorry, used wrong git command

@ulferts ulferts merged commit 015902d into dev Mar 25, 2026
17 checks passed
@ulferts ulferts deleted the implementation/72816-limit-sprint-creation-based-on-project-s-sharing-settings branch March 25, 2026 15:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants