diff --git a/rails/app/controllers/api/stories_controller.rb b/rails/app/controllers/api/stories_controller.rb index 3abcfaa08..aac857f6e 100644 --- a/rails/app/controllers/api/stories_controller.rb +++ b/rails/app/controllers/api/stories_controller.rb @@ -5,9 +5,6 @@ def index @page = Api::StoriesPage.new(community, story_params) @stories = @page.data - - # Ensure distinct - @stories = @stories.distinct end def show diff --git a/rails/spec/requests/api/public_stories_spec.rb b/rails/spec/requests/api/public_stories_spec.rb index 9bce86f93..12782b87d 100644 --- a/rails/spec/requests/api/public_stories_spec.rb +++ b/rails/spec/requests/api/public_stories_spec.rb @@ -29,10 +29,8 @@ context "filters and sort" do let!(:place_1) { create(:place, community: community, region: "the internet") } let!(:place_2) { create(:place, community: community, type_of_place: "online") } - let!(:place_being_deleted) { create(:place, community: orphan_community, type_of_place: "being deleted") } let!(:speaker_1) { create(:speaker, community: community) } let!(:speaker_2) { create(:speaker, community: community, speaker_community: "ruby for good") } - let!(:speaker_being_deleted) { create(:speaker, community: orphan_community) } # Story: # - place 2 @@ -86,38 +84,6 @@ ) end - # Story: - # - place 1 - # - speaker - will be deleted in test - # - language: English - let!(:story_with_no_speaker) do - create( - :story, - community: orphan_community, - topic: "test work", - language: "English", - places: [place_1], - speakers: [speaker_being_deleted], - permission_level: :anonymous - ) - end - - # Story: - # - place - will be deleted in test - # - speaker 1 - # - language: English - let!(:story_with_no_place) do - create( - :story, - community: orphan_community, - topic: "test work", - language: "English", - places: [place_being_deleted], - speakers: [speaker_1], - permission_level: :anonymous - ) - end - it "correctly filters" do # filter by place (id / name) get "/api/communities/cool_community/stories", params: {places: [place_2.id]} @@ -167,7 +133,6 @@ get "/api/communities/cool_community/stories" - expect(json_meta["total"]).to eq(1) expect(json_response["stories"].map { |s| s["id"] }).to contain_exactly(story_1.id) end @@ -215,16 +180,5 @@ expect(json_response["stories"].count).to eq(1) expect(json_meta["hasNextPage"]).to be false end - - it "orphaned stories are excluded" do - # ensures that story_with_no_speaker does not show up in list: - speaker_being_deleted.destroy - # ensures that story_with_no_place does not show up in list: - place_being_deleted.destroy - - get "/api/communities/orphaned_community/stories" - expect(json_response["total"]).to eq(0) - expect(json_response["stories"].length).to eq(0) - end end end diff --git a/rails/spec/requests/home_request_spec.rb b/rails/spec/requests/home_request_spec.rb index 71de1d578..f3e598c6f 100644 --- a/rails/spec/requests/home_request_spec.rb +++ b/rails/spec/requests/home_request_spec.rb @@ -49,10 +49,6 @@ ) end - def json_response - JSON.parse(response.body) - end - before do login_as user end