This avoids having to reset the subject first and having to save the automatic subject in an after_perform.
This is especially useful if no change is performed at all. Without the change, even without a change saving would lead to a new journal
The API v3 was allowing reading/writing internal comments when both the
enterprise token doesn't allow it and when the project setting is disabled.
Reading (GET):
- Added EnterpriseToken check to internal_visible scope
Writing (POST):
- Added project.enabled_internal_comments check to CreateNoteContract
When doing a project copy, copy as-is and accept that the state can be
faulty.
Before, it was disabling parts of the validations while keeping some
other parts, which made the experience confusing: the
SetAttributesService would be ok, but then saving the work package would
fail, and later the work package would be saved again without validation
in the `UpdateAncestorsService`.
Actually it was working previously only due to side-effects of
`UpdateAncestorsService` which does save and also due to changes
introduced in 0700299 which refactored the part that detect `save`
returned `false`, leading to believe that `save` always returned `true`.
Now the validation are done solely by the `SetAttributesService`, and
when saving the work package validations are ignored.
https://community.openproject.org/wp/66592
In case the values ever get corrupted, instead of annoying the user with
a validation message which prevents saving the work package, it tries to
automatically correct the values.
The autocorrection is possible only if all values are set and are valid.
https://community.openproject.org/wp/66592
Previous check of % complete consistency with work and remaining work
was allowing a small range of % complete values. For instance with work
= 0.25h and remaining work=0.06h, it was allowing the range 76..77. But
when setting % complete to 75%, the derived remaining work would be
0.06h so 75% value *is* valid.
The fixed check is now simpler: it checks if the % complete value is the
one that would be calculated from work and remaining work, or if the
remaining work value is the one that would be calculated from work and %
complete.
A module has been extracted to ensure the same methods are used to
calculate the values in both validation and derivation.
Validation will only take place when the project_phase_definition_id value is changed. Before, it was always validated (unless the project was changed).
But with the larger amount of possibilities to disable project phases and with subsequent changes to the work package potentically being done by somebody
who does not have the permission to change the value, the validation needs to be more precise.
https://community.openproject.org/wp/64203
When updating a work package to be parent of itself, `closure_tree` gem
has hooks to update the work_package_hierarchies table and can detect
cycles. When a cycle is detected, it adds a "You cannot add an ancestor
as a descendant" error on `:parent_id`.
The fix is to remove this error before providing our own error message.
https://community.openproject.org/wp/65062
When there is a cycle in the hierarchy, like trying to set the root
parent as a child of its own child, the scheduling dependency would loop
when trying to find all the automatically scheduled ancestors of the
work package.
This is now fixed by marking the visited work packages.
Only when creating a work package. The only case where it's possible is
when creating a work package with a parent explicitly set, and that
parent is automatically scheduled and has at least one predecessor.
When copying work packages, this restriction is removed as predecessors
and children are added later in the process.
Claim inline attachments that are actually in use- leave any previosly uploaded but unclaimed
attachemnts for clean up (later)- this way we don't clog up storage with unused image files