1345 Commits

Author SHA1 Message Date
Oliver Günther cd5ceba958 Allow embed_links to be parameterized, controlling which elements should be embedded 2026-06-10 13:43:06 +02:00
Tomas Hykel cee98d16bb fix(ui): Numeric ID instead of semantic one on the table of related work packages (WP #74942) 2026-05-27 15:03:40 +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
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
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 4dfdd6ec5d Drop numeric pins on auxilary links 2026-04-30 11:08:48 +03:00
Kabiru Mwenja eb049f26a2 Cover :self, :pdf, :atom, :generate_pdf HAL links in semantic mode
Minimal regression coverage for the rest of the WP HAL surface.
These links already pass `id:` kwargs (or go through api_v3_paths
which is pure string concatenation), so they stay numeric in
semantic mode today — but nothing in the test suite proved it.

Verified the :pdf / :atom / :generate_pdf specs fail if the kwargs
are dropped from the representer. The :self spec passes regardless,
since api_v3_paths doesn't go through Rails URL helpers; it stays
in as contract documentation for the API surface.
2026-04-30 08:27:29 +03:00
Kabiru Mwenja 7b310760d7 Cover :move and :copy HAL action links in semantic mode
The classic-mode coverage was either tautological (the :copy href was
re-derived via `work_package_path(work_package, "copy")` — the very
helper that produced the wrong URL in semantic mode before the pin) or
silently ambiguous in classic mode where `to_param == id&.to_s` masks
whether the representer is using the pin.

Add a semantic-mode context for both links that asserts the literal
numeric URL, and tighten the existing classic copy assertion to match
the move assertion's literal-URL style. Verified the new specs fail
without the pin in `lib/api/v3/work_packages/work_package_representer.rb`
and pass with it.
2026-04-30 08:27:29 +03: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
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
Kabiru Mwenja 61111f02b8 Fix display_id to fall back to numeric id when identifier is nil
In semantic mode, work packages created before the feature was enabled
have a nil identifier column. Previously display_id returned nil for
these, causing the Ruby representer to serialize displayId as null
while the SQL representer used COALESCE to return the numeric id.

Use identifier.presence to fall back to the numeric id, aligning both
representer paths.
2026-04-15 18:59:44 +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
ulferts 1240b066c3 work package creation and update including backlogs properties 2026-03-11 13:24:32 +01:00
ulferts 73e26148e0 add a sprints GET end point to v3 2026-03-11 13:24:31 +01: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
Ivan Kuchin 881fc34238 test custom comment injection into api 2026-02-25 20:07:16 +01:00
Henriette Darge 614f8ecc8d Apply negative currency format and change default from "EUR" to "€" 2026-02-25 09:54:56 +01:00
Klaus Zanders c83656b1d6 Merge branch 'dev' into more-visible-scopes 2026-02-13 09:34:20 +01:00
OpenProject Actions CI 14663b471a Merge branch 'release/17.1' into dev 2026-02-13 04:18:41 +00:00
Eric Schubert 887ded5714 [#71358] fixed version read model usage
- improved description of API spec
2026-02-12 13:13:11 +01:00
Klaus Zanders 538b3cd29b Merge branch 'dev' into more-visible-scopes 2026-02-12 11:19:23 +01:00
Dombi Attila c7eb130469 Merge branch 'dev' into merge-release/17.1-20260212041910 2026-02-12 10:28:06 +02:00
Jan Sandbrink 780d880eb1 Merge pull request #21904 from opf/project-api-schema
Only return projects from search_projects MCP tool
2026-02-11 11:18:33 +01:00
Klaus Zanders ca5e934da9 Merge branch 'dev' into more-visible-scopes 2026-02-10 13:27:01 +01:00
Jens Ulferts 1250412525 Merge pull request #21856 from opf/bug/59360-unexplicable-the-changes-were-retracted-journal-entries-automatic-subjects
Bug/59360 inexplicable the changes were retracted journal entries automatic subjects
2026-02-10 09:19:19 +01:00
Klaus Zanders d58aea5fee fix workpackage api specs 2026-02-09 15:08:05 +01:00
Jan Sandbrink 953ab1a6a8 Fix API::Errors::InternalError class
This class got broken during what seems to be a
drive-by style-improvement in fbe1215365. That change:

* made it incompatible with frozen strings as error messages
* broke the intended hiding of messages if they came from the
  wrong class

All of this went by unnoticed, because there were no specs
for the InternalError class.

Specs have now been added and the previous version of the code
mostly restored. Since there were some callers that always created the
exception with known safe error messages, I added a new class just for these
cases, because they were intended to "just show the message". So we can
keep using the original implementation for rescue_from handling.
2026-02-09 11:04:57 +01:00
Jan Sandbrink 8ca3c9eb66 Test portfolio and program schema against representer
Both are rendered through the ProjectRepresenter (because they are technically
implemented as Projects), but haven't been tested against it yet.

This also means that they still included required properties that were already
removed from the project schema (this was an error in the schema).
2026-02-06 15:50:27 +01:00
ulferts a1032a55a2 move placeholder functionality to backend schema 2026-02-05 17:04:08 +01:00
ulferts 959e7d75f3 resimplify copy service by relying on the contracts to provide the correct writable attributes 2026-02-04 13:37:31 +01:00
ulferts 53273d5fdf always generate subject unless overridden - no placeholder text set 2026-02-03 12:09:22 +01:00
Oliver Günther 896072d698 Release attribute highlighting to community 2026-01-30 15:02:45 +01:00
Jan Sandbrink f48e390bda Do not render nil titles for projectPhaseDefinition
This is against the schema for definition for links, which
already allow the title to be missing, but don't allow
it to be null. If it's present it must have a string as a value.
2026-01-20 15:22:39 +01:00
OpenProject Actions CI 7cab6fc19a Merge branch 'release/17.0' into dev 2026-01-05 14:57:22 +00:00
Klaus Zanders 5db6dc9356 Ignore order for custom fields test 2026-01-05 11:50:43 +01:00
Jan Sandbrink 452f5134b1 Merge pull request #21359 from opf/json-validate
Validate JSON schema of API representers
2025-12-15 14:18:52 +01:00
Oliver Günther 12919d106c Merge remote-tracking branch 'origin/release/17.0' into dev 2025-12-15 11:51:49 +01:00
Jan Sandbrink 0728d07ad1 Self-test basic schema compliance for a few API models
Those self-tests are "basic" in the sense that they only validate
their compliance with our documented schema in one representation.

These test cases don't yet cover/validate whether the generated
representation also fulfills the schema under different circumstances,
for example when rendering for a user with fewer privileges, not allowed
to see certain fields.

Where necessary, the schema was changed to reflect the reality, e.g.
when those tests revealed that a "required" field might be missing due to
a lack of permissions.

In a few cases the implementation was adapted to allow for stricter guarantees
of the specified schema, for example links allowed to leave out the title key
already, so its not necessary to emit `title: nil` in cases where a title is
not known.
2025-12-15 11:10:34 +01:00
ulferts 9064d094d0 exempt favorited property from being cached 2025-12-11 09:31:16 +01:00
Eric Schubert fd4fd82286 [#68226] fixed representer spec 2025-12-05 23:02:05 +01:00
Eric Schubert ac436b1cfe [#69129] harmonize suffix for hierarchy items
- https://community.openproject.org/work_packages/69129
- shorts and weights both are now serialized with parenthesis
2025-11-26 14:19:00 +01:00
Jens Ulferts 957534e3e7 Merge pull request #21148 from opf/implementation/67278-add-api-v3-workspaces-representer-references
Workspace references in representers and auxiliary endpoints
2025-11-26 12:05:34 +01:00
Jens Ulferts ca0770eeb2 Merge pull request #21144 from opf/implementation/67278-add-api-v3-workspaces-endpoints
Adding workspace types endpoints
2025-11-26 12:05:24 +01:00
Oliver Günther 96a3746162 Add caption to API 2025-11-26 09:53:35 +01:00