From f3c01d5a46e8a2c96906a0db7b7ab637eadd4242 Mon Sep 17 00:00:00 2001 From: cmrd Senya <35317-cmrd-senya@users.noreply.gitlab.gnome.org> Date: Sun, 4 Sep 2022 23:28:43 +0300 Subject: post fetch: remove check for type to allow fetching reshares --- lib/diaspora/fetcher/public.rb | 12 +----------- spec/lib/diaspora/fetcher/public_spec.rb | 13 ------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/diaspora/fetcher/public.rb b/lib/diaspora/fetcher/public.rb index 70a159bf5..30bdac2f6 100644 --- a/lib/diaspora/fetcher/public.rb +++ b/lib/diaspora/fetcher/public.rb @@ -128,9 +128,8 @@ module Diaspora; module Fetcher; class Public # @see check_existing # @see check_author # @see check_public - # @see check_type def validate post - check_existing(post) && check_author(post) && check_public(post) && check_type(post) + check_existing(post) && check_author(post) && check_public(post) end # hopefully there is no post with the same guid somewhere already... @@ -163,13 +162,4 @@ module Diaspora; module Fetcher; class Public ispublic end - - # see, if the type of the given post is something we can handle - def check_type post - type_ok = (post['post_type'] == "StatusMessage") - - logger.warn "the post (#{post['guid']}) has a type, which cannot be handled (#{post['post_type']})" unless type_ok - - type_ok - end end; end; end diff --git a/spec/lib/diaspora/fetcher/public_spec.rb b/spec/lib/diaspora/fetcher/public_spec.rb index 5809073da..3f914175a 100644 --- a/spec/lib/diaspora/fetcher/public_spec.rb +++ b/spec/lib/diaspora/fetcher/public_spec.rb @@ -208,7 +208,6 @@ describe Diaspora::Fetcher::Public do expect(public_fetcher).to receive(:check_existing).and_return(true) expect(public_fetcher).to receive(:check_author).and_return(true) expect(public_fetcher).to receive(:check_public).and_return(true) - expect(public_fetcher).to receive(:check_type).and_return(true) expect(public_fetcher.instance_eval { validate({}) }).to be true end @@ -256,17 +255,5 @@ describe Diaspora::Fetcher::Public do expect(public_fetcher.instance_eval { check_public post }).to be true end end - - describe "#check_type" do - it "returns false if the type is anything other that 'StatusMessage'" do - post = {"post_type"=>"Reshare"} - expect(public_fetcher.instance_eval { check_type post }).to be false - end - - it "returns true if the type is 'StatusMessage'" do - post = {"post_type"=>"StatusMessage"} - expect(public_fetcher.instance_eval { check_type post }).to be true - end - end end end -- cgit v1.2.3