Commit Graph

1810 Commits

Author SHA1 Message Date
Markus Kahl d3a4d2ee74 fix: delay adding role to make migration not crash due to schema errors (#23426)
* fix: delay adding role to make migration not crash due to schema errors

* update spec to execute part of migration now done in background
2026-05-28 14:26:01 +02:00
Klaus Zanders 581776e359 Add index for OU flag 2026-04-14 09:58:07 +02:00
Tomas Hykel c4debc8aaa [#73523] Implement WorkPackage semantic ID allocation system 2026-04-01 17:25:19 +02:00
OpenProject Actions CI 72cd07e1ff Merge branch 'release/17.3' into dev 2026-03-31 13:57:55 +00:00
Dombi Attila 872c689474 [#73556] Add Start/Stop sprint permission to users with Create sprint
https://community.openproject.org/work_packages/73556
2026-03-31 13:18:20 +03:00
Kabiru Mwenja 2c95192f44 Use SettingRenamer.rename_value in identifier setting migration
Simplify the migration by delegating to the new SettingRenamer utility
instead of inlining the SQL.
2026-03-28 10:06:30 +03:00
Kabiru Mwenja d240267b25 Add rename_value to SettingRenamer migration utility
Complement the existing rename (for setting names) with rename_value
for updating stored setting values. This provides a reusable helper
for future migrations that need to rename allowed values.
2026-03-28 10:05:37 +03:00
Kabiru Mwenja d3734a7485 Rename work_packages_identifier setting values to "classic" and "semantic"
The setting previously used "numeric" and "alphanumeric" as its allowed
values. Rename them to "classic" and "semantic" to better align with the
product terminology for the work package identifier modes.

Includes a migration to update any stored setting values in the database,
updated constants and helper methods on Setting::WorkPackageIdentifier,
and all corresponding references across models, components, forms,
frontend controllers, locales, and specs.
2026-03-28 10:01:57 +03:00
Kabiru Mwenja 2b4478da68 Merge pull request #22406 from opf/open-point/73149-how-do-we-handle-project-identifiers-case-insensitive-storage
Add case-insensitive uniqueness enforcement for project identifier
2026-03-27 13:26:38 +03:00
Jan Sandbrink f9d8bc6614 Introduce SubclassResponsibility error
This error is intended for cases when a method is
intentionally not implemented, because the module/class defining
it expects a subclass (or class including the module) to implement
the method.

This is intended to distinguish it from other cases, such as:
* feature not implemented yet
* edge case of a method call not yet supported

Notably it avoids the misuse of the Ruby-defined NotImplementedError,
which is only intended for much more specific scenarios:

> Raised when a feature is not implemented on the current platform. For example, methods depending on the fsync or fork system calls may raise this exception [...]

Also see https://docs.ruby-lang.org/en/master/NotImplementedError.html
2026-03-27 08:14:56 +01:00
Kabiru Mwenja f0ff8030ec Cleanup tests and add lossy rollback note
Unify test helpers into a single create_project_with_raw_identifier
method that better communicates intent (bypasses validations to set
an exact identifier). Add project.reload after update_all so the
in-memory object stays consistent with the database.

Also documents that the migration rollback is intentionally lossy —
deduplicated identifiers keep their suffixes under the restored
case-sensitive index.
2026-03-24 08:10:18 +03:00
Kabiru Mwenja db932c049f Harden deduplication against secondary collisions
Switch suffix from dash to underscore so deduplicated identifiers
remain valid in both numeric and alphanumeric modes. Add a NOT EXISTS
guard to skip rows where the suffixed identifier would itself collide
with an existing LOWER(identifier). In the astronomically unlikely
event of a secondary collision, the subsequent CREATE UNIQUE INDEX
will fail loudly rather than silently produce bad data.
2026-03-24 08:04:08 +03:00
Kabiru Mwenja 674b5cd96c Deduplicate case-colliding identifiers before adding unique index
PostgreSQL enforces uniqueness constraints at index build time — when
CREATE INDEX encounters duplicate key values, the entire operation
fails. For concurrent index builds (algorithm: :concurrently), this is
particularly problematic: a failed build leaves behind an "invalid"
index entry in pg_class that is ignored for queries but still incurs
write overhead on every INSERT/UPDATE, and must be explicitly dropped
before retrying.

Since this migration introduces a unique index on LOWER(identifier),
any pre-existing case collisions (e.g. "MyProject" and "myproject")
would cause the index build to fail. This adds a deduplication step
that resolves collisions before the index is created: the oldest
project (lowest id) keeps its identifier unchanged while newer
duplicates receive a "-N" suffix via a window function partitioned
over LOWER(identifier).
2026-03-23 19:14:47 +03:00
Kabiru Mwenja e369227c39 Add case-insensitive project identifier storage
Introduce case-insensitive handling for project identifiers:

- Add `normalizes :identifier` to automatically upcase (alphanumeric
  mode) or downcase (numeric mode) identifiers on assignment
- Add `parse_friendly_id` to normalize FriendlyId lookups for
  case-insensitive finder queries
- Switch uniqueness validation to `case_sensitive: false`
- Replace inline `exclusion:` validator with explicit
  `identifier_not_reserved` that checks case-insensitively
- Consolidate alphanumeric format validators into a single
  `identifier_alphanumeric_format` method with early return to
  prevent cascading error messages
- Use case-insensitive LOWER() comparison in historical identifier
  reservation check
- Add `post_process` support to the OpActiveRecord acts_as_url
  adapter with an allowlist of safe transforms (upcase/downcase)
- Add migration to replace the unique index on projects.identifier
  with a case-insensitive LOWER(identifier) index
- Update table definition to match the new index

Includes corresponding test additions for normalization, case-
insensitive uniqueness, reserved identifier rejection, and the
create_spec fixture fix for alphanumeric mode.
2026-03-20 20:27:04 +03:00
Judith Roth d688db21e3 Merge pull request #22397 from opf/implementation/72917-save-the-previous-value-when-a-project-identifier-changes
[#72917] Save the previous value when a project identifier changes
2026-03-19 09:56:01 +01:00
Judith Roth 359cd1c2ae [#72917] Squash migrations for readability 2026-03-18 16:59:42 +01:00
Klaus Zanders 3e873e1649 Merge branch 'dev' into user-working-times 2026-03-18 15:58:55 +01:00
Judith Roth df4cb24217 [#72917] Save the previous value when a project identifier changes
https://community.openproject.org/work_packages/72917

This leverages friendly_id's history module:
https://github.com/norman/friendly_id/tree/master
https://norman.github.io/friendly_id/file.Guide.html#History__Avoiding_404_s_When_Slugs_Change

We decided on keeping friendly_id because it was already used and offers
exactly the functionality we need.

Implementing redirects from routes that use an old identifier to the
current one will be a separate commit (see
https://community.openproject.org/wp/72918)
2026-03-18 14:25:59 +01:00
Dombi Attila 7d49707c4b Revert "Split the root Agent.md files into subdirectories." 2026-03-18 14:56:43 +02:00
Klaus Zanders 7a3a78ceae Merge branch 'dev' into user-working-times 2026-03-18 11:16:01 +01:00
Dombi Attila 1902ec436c Split the root Agent.md files into subdirectories. 2026-03-18 11:25:42 +02:00
Klaus Zanders 31a2536f51 Implement has_principal_details concern and use it for the group 2026-03-16 15:42:27 +01:00
Andrej 15baa3520d Merge branch 'dev' into merge-release/17.2-20260316105331 2026-03-16 11:54:11 +01:00
Oliver Günther c3b075d391 Merge remote-tracking branch 'origin/release/17.1' into release/17.2 2026-03-16 11:11:43 +01:00
Oliver Günther 30ef57877c Merge remote-tracking branch 'origin/release/17.0' into release/17.1 2026-03-16 11:10:12 +01:00
Oliver Günther 8d61c5fe7f Merge remote-tracking branch 'origin/release/16.6' into release/17.0 2026-03-16 11:08:23 +01:00
Klaus Zanders 41f3e47475 Run migration to remove ascii control characters from Custom Field Names 2026-03-13 10:18:28 +01:00
Andrej 0f3e6bd56e Merge branch 'dev' into merge-release/17.2-20260311143330 2026-03-11 15:35:31 +01:00
Klaus Zanders 59696bbd7d Merge branch 'dev' into user-working-times 2026-03-11 14:25:33 +01:00
Markus Kahl 05ac3219e3 handle case where show_work_package_attachments is not defined 2026-03-11 06:48:29 +00:00
Alexander Brandon Coles bb1eb75e20 Merge branch 'dev' into merge-release/17.2-20260310041552
# Conflicts:
#	config/locales/crowdin/uk.yml
#	modules/backlogs/config/locales/crowdin/uk.yml
#	modules/budgets/config/locales/crowdin/ko.yml
#	modules/meeting/config/locales/crowdin/de.yml
2026-03-10 05:37:12 -03:00
Pavel Balashou 58cfb67c54 Fix Rubocop and add some jira related specs. 2026-03-09 16:10:52 +01:00
Pavel Balashou 10299f9943 Fix some jira import bugs. Add finalization modal.
- Modify jira_open_project_references unique constrant
  It must include jira_id, because multiple jira configuration can refer same op entities.
- Add finalization modal
- Add finalization job
  The job activates all imported users. Checks that user_limit has not been exceeded with specific contact.
  Destroys jira_* objects.
- Destroy jira object on revert as well.
- Use EmptyContract when creating Attachements, WorkPackages, Members
- Import only users fetched in the current jira_import. It was a bug.
2026-03-09 16:10:17 +01:00
Jens Ulferts 6085432e9f Merge pull request #22195 from opf/bug/72801-sharing-permission-dependencies-are-not-migrated
[#72801] Sharing permission dependencies are not migrated
2026-03-09 09:21:34 +01:00
Dombi Attila 116ed1ccf8 Restore the select_done_statuses permission. 2026-03-06 17:07:13 +02:00
Klaus Zanders 0db321fe73 Fix setup for constraint 2026-03-06 13:28:40 +01:00
Klaus Zanders 727cb945e8 Refactor UserNonWorkingDay into a model that covers date ranges 2026-03-06 13:28:35 +01:00
Klaus Zanders 83a92ba250 Fix display of history to include current, unique constraint 2026-03-06 13:28:22 +01:00
Klaus Zanders 8cb25833de Add working hours and non working days for users 2026-03-06 13:27:42 +01:00
OpenProject Actions CI 5b9c7e7d0d Merge branch 'release/17.2' into dev 2026-03-05 10:40:44 +00:00
Dombi Attila 4fb1f385f9 [#72801] Sharing permission dependencies are not migrated
https://community.openproject.org/work_packages/72801

- Complete missing dependencies for view_sprints, create_sprints,
manage_sprint_items
- When migrating backlog permissions down, do not restore permissions
where the source permission cannot be determined.
- When migrating up, do not add manage_sprint_items to roles with add or
edit work package permission
- Remove unnecessary dependencies of the manage_sprint_items
2026-03-05 11:51:31 +02:00
Jan Sandbrink bce72903e5 Fix migration that sets default value for deactivate_work_package_attachments
The global setting and the project-level setting are inverted w.r.t. each other,
thus the migration needs to negate the boolean from the global setting.

This is now ensured with a migration spec as well.
2026-03-05 10:43:14 +01:00
Christophe Bliard baeb6e733c Fix default section missing overview visibility area
https://community.openproject.org/wp/72671

The default custom field section was created with an empty
`display_representation` (`{}`), causing project attributes to not appear
on the project overview page even when enabled by users.

New sections correctly receive the default overview visibility area
(`"sidebar"`), but the default section was not initialized with it.

Add a migration to backfill existing default sections that have an
empty `display_representation` with the default value
`{ overview: "sidebar" }`.
2026-03-04 17:52:10 +01:00
Dombi Attila 0ad584217a [#72773] Rework Permission Renamer
https://community.openproject.org/work_packages/72773
2026-03-03 16:39:34 +02:00
Dombi Attila 60e747be2b Apply manage_sprint_items permissions on the work packages model and update specs.
- Do not remove the assign_versions permission anymore, it still has
purpose in the context of updating work packages.
- Update backlog related specs.
2026-03-03 15:40:36 +02:00
Dombi Attila 9352da7a9a [#71253] Migrate and rework Sprint permissions
https://community.openproject.org/work_packages/71253
2026-03-03 15:40:36 +02:00
Ivan Kuchin 41d82d8322 Merge pull request #21452 from opf/feature/64264-comment-fields-for-project-attributes
Feature/64264 comment fields for project attributes
2026-02-25 20:45:14 +01:00
Ivan Kuchin 314f6960d8 migration to add has_comment to custom_fields + custom comment model 2026-02-25 16:00:15 +01:00
Pavel Balashou f3b9f1c540 Fix Rubocop complaints volume 2. 2026-02-25 15:59:13 +01:00
Pavel Balashou 089e3f46f7 Address Rubocop complaints volume 1. 2026-02-25 11:05:33 +01:00