Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#41053] fixed work package representer links

Eric Schubert9ab492551af3
diff --git a/docs/api/apiv3/components/schemas/work_package_model.yml b/docs/api/apiv3/components/schemas/work_package_model.yml
index e6fdbe4f794..6b61caf2245 100644
--- a/docs/api/apiv3/components/schemas/work_package_model.yml
+++ b/docs/api/apiv3/components/schemas/work_package_model.yml
@@ -1,4 +1,4 @@
-# Schema: Work_PackageModel
+# Schema: WorkPackageModel
---
type: object
required:
@@ -61,7 +61,7 @@ properties:
duration:
type: string
format: duration
- description: |-
+ description: |-
**(NOT IMPLEMENTED)** The amount of time in hours the work package needs to be completed.
Not available for milestone type of work packages.
readOnly: true
@@ -76,7 +76,7 @@ properties:
readOnly: true
ignoreNonWorkingDays:
type: boolean
- description: |-
+ description: |-
**(NOT IMPLEMENTED)** When scheduling, whether or not to ignore the non working days being defined.
A work package with the flag set to true will be allowed to be scheduled to a non working day.
readOnly: true
@@ -125,16 +125,6 @@ properties:
- status
- type
properties:
- addAttachment:
- allOf:
- - $ref: "./link.yml"
- - description: |-
- Attach a file to the WP
-
- # Conditions
-
- **Permission**: edit work package
- readOnly: true
addComment:
allOf:
- $ref: "./link.yml"
@@ -170,12 +160,12 @@ properties:
readOnly: true
items:
allOf:
- - $ref: "./link.yml"
- - description: |-
- A predefined action that can be applied to the work package.
+ - $ref: "./link.yml"
+ - description: |-
+ A predefined action that can be applied to the work package.
- **Resource**: CustomAction
- readOnly: true
+ **Resource**: CustomAction
+ readOnly: true
previewMarkup:
allOf:
- $ref: "./link.yml"
@@ -192,6 +182,46 @@ properties:
**Permission**: delete watcher
readOnly: true
+ delete:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ Delete this work package
+
+ # Conditions
+
+ **Permission**: delete_work_packages
+ readOnly: true
+ logTime:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ Create time entries on the work package
+
+ # Conditions
+
+ **Permission**: log_time or log_own_time
+ readOnly: true
+ move:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ Link to page for moving this work package
+
+ # Conditions
+
+ **Permission**: move_work_packages
+ readOnly: true
+ copy:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ Link to page for copying this work package
+
+ # Conditions
+
+ **Permission**: add_work_packages
+ readOnly: true
unwatch:
allOf:
- $ref: "./link.yml"
@@ -206,7 +236,7 @@ properties:
allOf:
- $ref: "./link.yml"
- description: |-
- Form endpoint that aids in preparing and performing edits on a WP
+ Form endpoint that aids in preparing and performing edits on a work package
# Conditions
@@ -270,6 +300,30 @@ properties:
The files attached to this work package
**Resource**: Collection
+
+ # Conditions
+
+ - **Setting**: deactivate_work_package_attachments set to false in related project
+ addAttachment:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ Attach a file to the work package
+
+ # Conditions
+
+ - **Permission**: edit work package
+ readOnly: true
+ prepareAttachment:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ Attach a file to the work package
+
+ # Conditions
+
+ - **Setting**: direct uploads enabled
+ readOnly: true
author:
allOf:
- $ref: "./link.yml"
@@ -338,7 +392,7 @@ properties:
# Conditions
- **Permission**: manage file links
+ **Permission**: manage_file_links
fileLinks:
allOf:
- $ref: './link.yml'
@@ -347,7 +401,7 @@ properties:
# Conditions
- **Permission**: view file links
+ **Permission**: view_file_links
parent:
allOf:
- $ref: "./link.yml"
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rb
index 8794762cec3..51126dea542 100644
--- a/lib/api/v3/work_packages/work_package_representer.rb
+++ b/lib/api/v3/work_packages/work_package_representer.rb
@@ -96,7 +96,7 @@ module API
{
href: api_v3_paths.time_entries,
- title: "Log time on #{represented.subject}"
+ title: "Log time on work package '#{represented.subject}'"
}
end
@@ -107,7 +107,7 @@ module API
{
href: new_work_package_move_path(represented),
type: "text/html",
- title: "Move #{represented.subject}"
+ title: "Move work package '#{represented.subject}'"
}
end
@@ -117,7 +117,8 @@ module API
{
href: work_package_path(represented, "copy"),
- title: "Copy #{represented.subject}"
+ type: "text/html",
+ title: "Copy work package '#{represented.subject}'"
}
end
diff --git a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
index a511900c879..4a0ebbeb200 100644
--- a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
+++ b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
@@ -1087,7 +1087,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter do
let(:link) { "logTime" }
let(:permission) { %i(log_time log_own_time) }
let(:href) { api_v3_paths.time_entries }
- let(:title) { "Log time on #{work_package.subject}" }
+ let(:title) { "Log time on work package '#{work_package.subject}'" }
end
end
@@ -1096,7 +1096,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter do
let(:link) { "move" }
let(:href) { work_package_path(work_package, "move/new") }
let(:permission) { :move_work_packages }
- let(:title) { "Move #{work_package.subject}" }
+ let(:title) { "Move work package '#{work_package.subject}'" }
end
end
@@ -1105,7 +1105,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter do
let(:link) { "copy" }
let(:href) { work_package_path(work_package, "copy") }
let(:permission) { :add_work_packages }
- let(:title) { "Copy #{work_package.subject}" }
+ let(:title) { "Copy work package '#{work_package.subject}'" }
end
end