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

Revert "feature/64166 Add work package internal comments (write,form) API"

Kabiru Mwenjabb50db699a9a
diff --git a/lib/api/v3/activities/activities_by_work_package_api.rb b/lib/api/v3/activities/activities_by_work_package_api.rb
index ca01eb6abfe..e7adcf4eeb4 100644
--- a/lib/api/v3/activities/activities_by_work_package_api.rb
+++ b/lib/api/v3/activities/activities_by_work_package_api.rb
@@ -33,12 +33,6 @@ module API
module Activities
class ActivitiesByWorkPackageAPI < ::API::OpenProjectAPI
resource :activities do
- helpers do
- def to_boolean(value, default)
- ActiveRecord::Type::Boolean.new.cast(value.presence || default)
- end
- end
-
get do
self_link = api_v3_paths.work_package_activities @work_package.id
@@ -64,13 +58,11 @@ module API
raise ::API::Errors::NotFound.new
end
- internal = to_boolean(params[:internal], false)
call = AddWorkPackageNoteService
.new(user: current_user,
work_package: @work_package)
.call(params[:comment][:raw],
- send_notifications: to_boolean(params[:notify], true),
- internal:)
+ send_notifications: !(params.has_key?(:notify) && params[:notify] == "false"))
if call.success?
Activities::ActivityRepresenter.new(call.result, current_user:)
diff --git a/spec/requests/api/v3/activities_by_work_package_resource_spec.rb b/spec/requests/api/v3/activities_by_work_package_resource_spec.rb
index 904b8890c03..9876ba410a5 100644
--- a/spec/requests/api/v3/activities_by_work_package_resource_spec.rb
+++ b/spec/requests/api/v3/activities_by_work_package_resource_spec.rb
@@ -148,50 +148,6 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI do # rubocop:disa
.at_path("message")
end
end
-
- context "when creating an internal comment" do
- shared_context "to create internal comment" do |internal: false|
- before do
- header "Content-Type", "application/json"
- post api_v3_paths.work_package_activities(work_package.id),
- { comment: { raw: comment }, internal: }.to_json
- end
- end
-
- context "and the user has the permission to create internal comments" do
- it_behaves_like "valid activity request" do
- let(:permissions) { %i(view_work_packages view_internal_comments add_internal_comments) }
- let(:status_code) { 201 }
-
- include_context "to create internal comment", internal: true
-
- it "creates an internal comment" do
- expect(last_response.body).to be_json_eql(true.to_json).at_path("internal")
- end
- end
-
- it_behaves_like "valid activity request" do
- let(:permissions) { %i(view_work_packages view_internal_comments add_internal_comments) }
- let(:status_code) { 201 }
-
- include_context "to create internal comment", internal: false
-
- it "creates an internal comment" do
- expect(last_response.body).to be_json_eql(false.to_json).at_path("internal")
- end
- end
- end
-
- context "and the user does not have the permission to create internal comments" do
- let(:permissions) { %i(view_work_packages add_work_package_comments view_internal_comments) }
-
- it_behaves_like "safeguarded API" do
- let(:permissions) { %i(view_work_packages) }
-
- include_context "to create internal comment", internal: true
- end
- end
- end
end
end
end