Skip to content

Commit

Permalink
Revert "Add reminder note as an embedded notification detail"
Browse files Browse the repository at this point in the history
This reverts commit a13494c.
  • Loading branch information
akabiru committed Dec 2, 2024
1 parent 4bb7007 commit 220ca16
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 143 deletions.
1 change: 0 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,6 @@ en:
login: "Username"
mail: "Email"
name: "Name"
note: "Note"
password: "Password"
priority: "Priority"
project: "Project"
Expand Down
2 changes: 1 addition & 1 deletion lib/api/v3/notifications/notification_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _type
"Notification"
end

self.to_eager_load = %i[actor journal reminder]
self.to_eager_load = %i[actor journal]
end
end
end
Expand Down
45 changes: 0 additions & 45 deletions lib/api/v3/notifications/property_factory/reminder.rb

This file was deleted.

33 changes: 0 additions & 33 deletions lib/api/v3/values/property_generic_representer.rb

This file was deleted.

13 changes: 5 additions & 8 deletions lib/api/v3/values/schemas/value_schema_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -64,13 +64,10 @@ def i18n_for(property)
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
Original file line number Diff line number Diff line change
Expand Up @@ -267,60 +267,5 @@
.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

0 comments on commit 220ca16

Please sign in to comment.