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

[#62130] Add internal:boolean property to activity comments (read) API (#18995)

Kabiru Mwenja917ddb87e0f6
diff --git a/docs/api/apiv3/components/examples/activity_response.yml b/docs/api/apiv3/components/examples/activity_response.yml
index b424c9e77af..5cdeaa38410 100644
--- a/docs/api/apiv3/components/examples/activity_response.yml
+++ b/docs/api/apiv3/components/examples/activity_response.yml
@@ -9,6 +9,7 @@ value:
html: "<p class=\"op-uc-p\">I can give you a CR70 corvette, you have to make do, Leia...</p>"
details: [ ]
version: 4
+ internal: false
createdAt: "2025-04-17T13:54:40.737Z"
updatedAt: "2025-04-17T13:54:40.737Z"
_embedded:
diff --git a/docs/api/apiv3/components/schemas/activity_model.yml b/docs/api/apiv3/components/schemas/activity_model.yml
index f02f905ebc5..4a68ac572b5 100644
--- a/docs/api/apiv3/components/schemas/activity_model.yml
+++ b/docs/api/apiv3/components/schemas/activity_model.yml
@@ -20,6 +20,9 @@ properties:
type: array
items:
$ref: './formattable.yml'
+ internal:
+ type: boolean
+ description: Whether this activity is internal (only visible to users with view_internal_comments permission)
createdAt:
type: string
format: date-time
@@ -40,9 +43,9 @@ properties:
- $ref: './work_package_model.yml'
- description: |-
The work package this activity belongs to
-
+
# Conditions
-
+
Only embedded when the `journable` of the activity is a work package
_links:
type: object
@@ -87,7 +90,7 @@ properties:
# Conditions
- **Permissions**:
+ **Permissions**:
- `add_work_package_comments`
- for internal comments: `add_internal_comments`
example:
diff --git a/lib/api/v3/activities/activity_representer.rb b/lib/api/v3/activities/activity_representer.rb
index f20037bcc29..8bcaffc01bf 100644
--- a/lib/api/v3/activities/activity_representer.rb
+++ b/lib/api/v3/activities/activity_representer.rb
@@ -76,6 +76,8 @@ module API
property :version, render_nil: true
+ property :internal
+
property :work_package,
embedded: true,
exec_context: :decorator,
diff --git a/spec/lib/api/v3/activities/activity_representer_rendering_spec.rb b/spec/lib/api/v3/activities/activity_representer_rendering_spec.rb
index 8be54e9b4e0..b2749c65c6b 100644
--- a/spec/lib/api/v3/activities/activity_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/activities/activity_representer_rendering_spec.rb
@@ -110,6 +110,24 @@ RSpec.describe API::V3::Activities::ActivityRepresenter, "rendering" do
end
end
+ describe "internal" do
+ context "when internal" do
+ let(:journal) { build_stubbed(:work_package_journal, internal: true) }
+
+ it_behaves_like "property", :internal do
+ let(:value) { true }
+ end
+ end
+
+ context "when not internal" do
+ let(:journal) { build_stubbed(:work_package_journal, internal: false) }
+
+ it_behaves_like "property", :internal do
+ let(:value) { false }
+ end
+ end
+ end
+
describe "comment" do
it_behaves_like "API V3 formattable", "comment" do
let(:format) { "markdown" }