Commit Graph

2910 Commits

Author SHA1 Message Date
Oliver Günther 4cc9faef4f Consistently use OpenProject::SqlSanitization instead of forwarding to sanitize_sql_array 2026-05-27 10:08:16 +02:00
Oliver Günther 4724150e3d Avoid quote_string in favor of bindings where possible 2026-05-27 10:08:16 +02:00
OpenProject Actions CI 1e62f01690 Merge branch 'release/17.4' into release/17.5 2026-05-26 05:10:56 +00:00
Oliver Günther 61cd01b784 Add associated_visible_resource to properly handle undisclosed work packages 2026-05-26 07:09:59 +02:00
Tomas Hykel 948fa43321 chore: Remove feature flag for project-based work package identifiers 2026-05-25 17:45:06 +02:00
Oliver Günther e396a5bb53 Merge remote-tracking branch 'origin/release/17.4' into dev 2026-05-19 18:26:45 +02:00
Oliver Günther 637ec7d10f Merge remote-tracking branch 'origin/release/17.3' into release/17.4 2026-05-19 18:26:23 +02:00
Oliver Günther 91a8bf7ba8 Use .to_hash on the schema representer before caching 2026-05-19 18:25:37 +02:00
Alexander Brandon Coles 9d4881216b Merge remote-tracking branch 'opf/dev' into HEAD
# Conflicts:
#	frontend/src/assets/sass/backlogs/_master_backlog.sass
#	modules/backlogs/config/locales/crowdin/ru.yml
#	modules/wikis/config/locales/crowdin/ru.yml
#	modules/wikis/config/locales/crowdin/uk.yml
#	modules/wikis/config/locales/crowdin/zh-CN.yml
2026-05-08 10:35:12 +02:00
Oliver Günther 7ae5604869 Merge pull request #23070 from opf/fix/relation-visible-scope
The performance decreased because of a combination of calls that were supposed to increase performance. 

We have a mechanism in place which automatically eager loads models needed in the element representers when a collection of them is rendered. This is to avoid N+1 queries of course. But, if eager loading is  combined with e.g., a LIMIT, which we do because we paginate, rails automatically falls back to issuing two instead of just one SQL statement. Which makes sense as otherwise LEFT JOINS might mess with the result set. 

But Rails does so in a somewhat simple fashion. It uses the first query to get the DISTINCT ids. The second is used to load the values (without a limit). But instead of removing all WHERE statements in the second SQL statement and then apply just the one for the ids, it keeps the original WHERE statement and applies the one for the ids on top. The problem with that is that the database trips on that (I didn't check the why) and uses a less than optimal query plan. 

That was the problem here as well. The first query remained reasonable quick (300ms) but the second one took 25s. 

The fix is to split the two statements by hand in the representer whenever eager loading is defined. The first query has all the filters but no eager loading and fetches the ids. The second takes the ids, and with eager loading included loads the data. Et voila, second query takes 10ms.   

That at least works for relations, work_packages and projects. But there are other representers that also seem to have custom behaviour. I'm looking into whether they can be easily adapted.
2026-05-07 15:44:13 +02:00
OpenProject Actions CI 0778811719 Merge branch 'release/17.4' into dev 2026-05-06 12:47:03 +00:00
Oliver Günther c660802146 Merge remote-tracking branch 'origin/release/17.3' into release/17.4 2026-05-06 09:19:25 +02:00
Oliver Günther 5bf27bb868 Merge remote-tracking branch 'origin/release/17.4' into dev 2026-05-05 12:29:43 +02:00
ulferts 222639f8d4 include filter working with portfolios and programs 2026-04-30 10:18:09 +02:00
Kabiru Mwenja 0d79f5358c Bust WP representer JSON cache when identifier mode flips (#22960)
Include identifier mode in WP representer cache key
2026-04-28 14:22:56 +03:00
Klaus Zanders a9a6898153 Remove inline disables for DynamicFindBy 2026-04-27 09:22:18 +02:00
Oliver Günther ab301f7de4 Merge pull request #22875 from opf/fix/validate-conditions-on-custom-action-execute
Validate conditions on execution of custom action
2026-04-27 08:41:04 +02:00
OpenProject Actions CI 9569225e56 Merge branch 'release/17.4' into dev 2026-04-25 04:23:14 +00:00
Oliver Günther 8eca1925ec Respect activation limit in user unlocking
https://community.openproject.org/work_packages/74373
2026-04-24 09:19:06 +02:00
Oliver Günther 6877e29351 Validate current user password confirmation when changing passwords through API
https://community.openproject.org/work_packages/74335
2026-04-23 14:19:50 +02:00
Oliver Günther 8ca79798db Validate conditions on execution of custom action
https://community.openproject.org/projects/openproject/work_packages/74294/activity
2026-04-22 14:12:42 +02:00
Kabiru Mwenja b8471484e0 Include identifier in Hierarchy eager loader's children SELECT
The ancestors/children representer change calls `child.display_id`,
which consults `identifier` in semantic mode. The Hierarchy eager
loader preloads children with a minimal `SELECT id, subject, project_id,
parent_id` for performance, so `identifier` was missing and
`ActiveModel::MissingAttributeError` fired the moment a query endpoint
rendered a work package with visible children in semantic mode.

Add `identifier` to the SELECT. It's one extra short text column per
child row.
2026-04-22 08:50:32 +03:00
Kabiru Mwenja 3e0f738c2c Expose displayId on work package ancestor and children HAL links
In semantic mode, the work package breadcrumb renders numeric IDs
instead of the semantic identifier because ancestor HAL resources are
built from `_links.ancestors[]` entries that only carry `href` and
`title`. With no top-level `displayId` in `$source`, the frontend getter
falls through to the numeric id parsed from the href.

Emit `displayId` alongside `href`/`title` on each ancestor and child
link in the representer, and have the `displayId` getter fall back to
the self link's `displayId` so resources built from a link payload
alone still surface the semantic identifier.
2026-04-22 08:18:54 +03:00
Tobias Dillmann a42eb98f87 [#73104] Move api resource link out of the model 2026-04-21 13:55:12 +02:00
Tobias Dillmann 4d3205636e [#73104] Remove backlogs module pollution from core
We delegate the resource name to the object itself, that way we can
override it in our record and no knowledge about the backlogs module is
necessary in the core.
2026-04-21 13:55:12 +02:00
Tobias Dillmann 281e44762f [#73104] Allow resource linking for sprints
This is necessary to make the group_by work
2026-04-21 13:55:12 +02:00
Kabiru Mwenja 234a870060 Merge pull request #22704 from opf/feature/73716-adapt-work-package-show-view-for-project-based-semantic-work-package-identifiers
Adapt work package show view for semantic identifiers
2026-04-21 13:52:23 +03:00
Kabiru Mwenja 79d4e67a0d Merge pull request #22718 from opf/feature/73756-adapt-routes-for-project-based-semantic-work-package-identifiers
Make find/exists? resolve semantic work package identifiers
2026-04-21 13:13:54 +03:00
Klaus Zanders 8d15647333 Merge pull request #22372 from opf/departments-admin-menu
Manage organizations in Admin Menu
2026-04-20 12:39:43 +02:00
Alexander Brandon Coles 7b3b6bdbf3 Clean up remaining Backlogs dead code
Restore the minimal admin settings blankslate so the admin menu route
remains valid after the sprint-based cleanup. Remove the remaining
settings-driven story/task classification code, dead models and
services, and the obsolete filter and spec setup that depended on it.
2026-04-17 10:14:14 +01:00
Klaus Zanders 710eac52ba Do not allow changing the organizational_unit flag and allow setting parent in the API 2026-04-16 18:11:13 +02:00
Kabiru Mwenja 6c02cd1fea Separate displayId from wp.id to fix cascading bugs
Overriding wp.id to return the semantic identifier (e.g. "PROJ-42")
broke cache keys, API filters, row rendering, and CSS selectors that
all depend on the numeric PK.

Instead, keep wp.id as the numeric PK and add two new properties:
- displayId: returns the user-facing identifier ("PROJ-42" or "123")
- displayIdWithHash: returns "#PROJ-42" or "#123" for UI display

Also adds a COALESCE fallback in the SQL representer so work packages
created before semantic mode was enabled still get a valid displayId.
2026-04-15 18:59:42 +03:00
Kabiru Mwenja 8d13c2ac93 Fix grammar in multi-argument error and clarify API route param
- "find are not yet supported" → "find is not yet supported"
- Add semantic identifier example to API route param description
2026-04-15 16:42:18 +03:00
Kabiru Mwenja 63e9854836 Make find/exists? resolve semantic work package identifiers
Extract FinderMethods module that transparently resolves both numeric and
semantic identifiers (e.g. "PROJ-42") using FriendlyId's Object#friendly_id?
for dispatch. The module is included in both the WorkPackage class and
extended onto every relation, so scoped queries like
WorkPackage.visible(user).find("PROJ-42") work seamlessly.

- Override find to resolve semantic IDs via identifier column + alias table
- Override exists? with the same resolution chain
- Refactor find_by_id_or_identifier to use friendly_id? instead of semantic_id?
- Update API route to accept string IDs (type: Integer → type: String)
- Update controller and ViewComponent finders to use find_by_id_or_identifier
- Pass display_id from Rails views to Angular custom elements
2026-04-14 17:38:12 +03:00
Kabiru Mwenja 5bbc4e7563 Rename semanticId to displayId, make always present
Replace the conditional `semanticId` API field with `displayId` which is
always present in work package responses. In semantic mode it returns the
project-based identifier (e.g. "PROJ-42"), in classic mode it returns the
numeric ID as a string. This gives API consumers (frontend, mobile) a
single field to read without conditional logic.

- Add `WorkPackage#display_id` method that encapsulates the mode check
- Update both representers (JSON and SQL) to render `displayId` unconditionally
- Update OpenAPI schema documentation
2026-04-13 14:04:39 +03:00
Kabiru Mwenja d39b720e6e Expose semanticId in API v3 work package endpoints
Adds the computed semanticId property to the HAL representer,
SQL collection representer, and schema representer. The property is
gated behind the semantic_work_package_ids feature flag and returns the
value from WorkPackage#identifier. Includes OpenAPI docs
and the translation key for the schema name.
2026-04-13 14:04:38 +03:00
Oliver Günther 40bc3c04e5 Add OpenProject::Cache.fetch_request_cached for hot-path caching
Add fetch_request_cached method that layers RequestStore in front of Rails.cache.fetch

Used in the following places, as they are repeatedly accessed during schema initialization.

all_work_package_form_attributes, form_config_attribute_representation, Query.available_columns

In my tests, this improves cold cache access by reducing initial number of queries to access cache
2026-04-09 15:48:40 +02: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
ulferts 408e5061c2 Merge remote-tracking branch 'origin/dev' into feature/73105-filter-by-sprints-on-work-packages-table 2026-03-24 18:24:53 +01:00
ulferts 5160d69746 filtering on sprints in global work package table 2026-03-24 18:21:33 +01:00
ulferts 0fdd66074e have sprint filter working 2026-03-24 18:21:29 +01:00
Alexander Brandon Coles d3b457f56d Fix sprint filter schema dependency
Add a sprint-specific query schema dependency representer so the board
page can render filters without crashing after sprint start.

This fixes the CI failure in the sprint start feature spec caused by
SprintFilter not mapping to any dependency representer.
2026-03-24 18:21:27 +01:00
Alexander Brandon Coles cf4abf3a0a Merge pull request #22086 from opf/feature/69139-sprint-task-boards
[#69139] Create boards on Sprint start
2026-03-24 13:49:31 +00:00
Oliver Günther 2194810144 Limit deflation of zlib to 10MB
https://community.openproject.org/work_packages/73368
2026-03-24 13:35:06 +01:00
Jan Sandbrink 6b31d24de7 Remove feature flag for MCP server
The MCP server was introduced officially with 17.2, using
a forced feature flag. Thus we should now remove the feature flag
entirely, since there is no intent to disable it anymore.
2026-03-23 13:29:57 +01:00
Alexander Brandon Coles 68d1b2cefe Merge branch 'dev' into feature/69139-sprint-task-boards 2026-03-20 12:15:59 -07:00
Jens Ulferts 6e0121f935 Merge pull request #22054 from opf/feature/72227-sprints-included-in-api-get-sprint-and-sprint-on-work-package-resource
Add sprint GET end points to v3
2026-03-19 13:08:54 +01:00
Alexander Brandon Coles 411cc24d6d Fix sprint filter schema dependency
Add a sprint-specific query schema dependency representer so the board
page can render filters without crashing after sprint start.

This fixes the CI failure in the sprint start feature spec caused by
SprintFilter not mapping to any dependency representer.
2026-03-13 13:08:17 -05:00
Klaus Zanders 0a843a993e Correct response when a user with the manage_own_working_times requests times for another user (previously was empty collection) 2026-03-11 15:11:07 +01:00
Klaus Zanders 1d9e0b7c91 add api endpoint to edit non working days. fix api docs 2026-03-11 14:58:17 +01:00