post fetch: remove check for type to allow fetching reshares

This commit is contained in:
cmrd Senya 2022-09-04 23:28:43 +03:00
parent 93d61c7f21
commit f3c01d5a46
2 changed files with 1 additions and 24 deletions

View file

@ -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

View file

@ -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