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 "Add reminder note as an embedded notification detail"

Kabiru Mwenja220ca16ef022
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5ab4b6bae1b..3d2a4e308d2 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1510,7 +1510,6 @@ en:
login: "Username"
mail: "Email"
name: "Name"
- note: "Note"
password: "Password"
priority: "Priority"
project: "Project"
diff --git a/lib/api/v3/notifications/notification_representer.rb b/lib/api/v3/notifications/notification_representer.rb
index 6984fe23518..5b67c4dd9a3 100644
--- a/lib/api/v3/notifications/notification_representer.rb
+++ b/lib/api/v3/notifications/notification_representer.rb
@@ -104,7 +104,7 @@ module API
"Notification"
end
- self.to_eager_load = %i[actor journal reminder]
+ self.to_eager_load = %i[actor journal]
end
end
end
diff --git a/lib/api/v3/notifications/property_factory/reminder.rb b/lib/api/v3/notifications/property_factory/reminder.rb
deleted file mode 100644
index e8bd4e210c2..00000000000
--- a/lib/api/v3/notifications/property_factory/reminder.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# --copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-# ++
-
-module API::V3::Notifications::PropertyFactory
- module Reminder
- extend ::API::V3::Utilities::PathHelper
-
- module_function
-
- def for(notification)
- return [] unless notification.reminder
-
- [
- ::API::V3::Values::PropertyGenericRepresenter
- .new(::API::V3::Values::PropertyModel.new(:note, notification.reminder.note),
- self_link: api_v3_paths.notification_detail(notification.id, 0))
- ]
- end
- end
-end
diff --git a/lib/api/v3/values/property_generic_representer.rb b/lib/api/v3/values/property_generic_representer.rb
deleted file mode 100644
index ed814ef2fa3..00000000000
--- a/lib/api/v3/values/property_generic_representer.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# --copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-# ++
-
-module API::V3::Values
- class PropertyGenericRepresenter < PropertyRepresenter
- property :value
- end
-end
diff --git a/lib/api/v3/values/schemas/value_schema_factory.rb b/lib/api/v3/values/schemas/value_schema_factory.rb
index 441bb673472..de98a68e279 100644
--- a/lib/api/v3/values/schemas/value_schema_factory.rb
+++ b/lib/api/v3/values/schemas/value_schema_factory.rb
@@ -29,7 +29,7 @@
module API::V3::Values::Schemas
module ValueSchemaFactory
extend ::API::V3::Utilities::PathHelper
- SUPPORTED = %w(start_date due_date date note).freeze
+ SUPPORTED = %w(start_date due_date date).freeze
module_function
@@ -64,13 +64,10 @@ module API::V3::Values::Schemas
I18n.t("attributes.#{property}")
end
- def type_for(property)
- case property
- when "start_date", "due_date", "date"
- "Date"
- when "note"
- "String"
- end
+ def type_for(_property)
+ # This is but a stub. Currently, only 'start_date' and 'due_date'
+ # need to be supported so this simple approach works.
+ "Date"
end
end
end
diff --git a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb
index bb3aef99788..c0fb12c42cb 100644
--- a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb
@@ -267,60 +267,5 @@ RSpec.describe API::V3::Notifications::NotificationRepresenter, "rendering" do
.at_path("_embedded/details")
end
end
-
- shared_examples_for "embeds a Values::Property for reminder note" do
- it "embeds a Values::Property" do
- expect(generated)
- .to be_json_eql("Values::Property".to_json)
- .at_path("_embedded/details/0/_type")
- end
-
- it "has a note value for the `property` property" do
- expect(generated)
- .to be_json_eql("note".to_json)
- .at_path("_embedded/details/0/property")
- end
-
- it "has a reminder`s note for the value" do
- expect(generated)
- .to be_json_eql(notification.reminder.note.to_json)
- .at_path("_embedded/details/0/value")
- end
- end
-
- context "for a reminder when embedding" do
- let(:reminder) { build_stubbed(:reminder) }
- let(:reason) { :reminder }
- let(:embed_links) { true }
-
- before do
- allow(notification).to receive(:reminder).and_return(reminder)
- end
-
- it_behaves_like "embeds a Values::Property for reminder note"
- end
-
- context "for a reminder when not embedding" do
- let(:reminder) { build_stubbed(:reminder) }
- let(:reason) { :reminder }
- let(:embed_links) { false }
-
- before do
- allow(notification).to receive(:reminder).and_return(reminder)
- end
-
- it_behaves_like "embeds a Values::Property for reminder note"
- end
-
- context "for a reminder with no notification" do
- let(:reminder) { nil }
- let(:reason) { :reminder }
-
- it "has an empty details array" do
- expect(generated)
- .to have_json_size(0)
- .at_path("_embedded/details")
- end
- end
end
end