Merge pull request #3875 from evazion/fix-3873

Fix #3873: Batch bookmarklet for tumblr reports wrong posts as already uploaded
This commit is contained in:
Albert Yi
2018-09-07 14:15:24 -07:00
committed by GitHub
13 changed files with 76 additions and 62 deletions

View File

@@ -179,6 +179,18 @@ module Sources
return {}
end
# A search query that should return any posts that were previously
# uploaded from the same source. These may be duplicates, or they may be
# other posts from the same gallery.
def related_posts_search_query
"source:#{canonical_url}"
end
def related_posts(limit = 5)
CurrentUser.as_system { Post.tag_match(related_posts_search_query).paginate(1, limit: limit) }
end
memoize :related_posts
def to_h
return {
:artist_name => artist_name,

View File

@@ -153,6 +153,10 @@ module Sources
translated_tags
end
def related_posts_search_query
illust_id.present? ? "pixiv:#{illust_id}" : "source:#{canonical_url}"
end
public
def image_urls_sub