mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Stringify displayId in auto_complete payload for APIv3 parity
The auto_complete endpoint exposed `displayId` as the bare `work_package.display_id`, which is an Integer in classic mode and a String in semantic mode. APIv3 already coerces this field on the work package representer (and on its `:children` and `:ancestors` link collections), so the auto_complete payload was the lone outlier. The single CKEditor consumer interpolates the value into a string, so this change is purely a consistency fix at the JSON boundary; nothing behavioural depends on the wire type.
This commit is contained in:
@@ -60,10 +60,11 @@ class WorkPackages::AutoCompletesController < ApplicationController
|
||||
# `displayId` collapses to the numeric id in classic mode and to the
|
||||
# semantic identifier in semantic mode. The CKEditor mention plugin
|
||||
# reads it to insert `#PROJ-7` (or `#1234`) into the markdown source
|
||||
# and to build the mention's link URL.
|
||||
# and to build the mention's link URL. Stringified for parity with
|
||||
# APIv3 (`WorkPackageRepresenter` serialises `displayId` as a string).
|
||||
work_package.attributes.merge(
|
||||
"to_s" => work_package.to_s,
|
||||
"displayId" => work_package.display_id
|
||||
"displayId" => work_package.display_id.to_s
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user