uploads: add new source:<url> dupe check (fix #3873)
* On the /uploads/new page, instead of just showing a "This post has probably already been uploaded" message, show the actual thumbnails of posts having the same source as what the user is trying to upload. * Move the iqdb results section up top, beside the related posts section.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,11 +23,5 @@ class UploadService
|
||||
|
||||
return [upload]
|
||||
end
|
||||
|
||||
def self.batch(url, ref = nil)
|
||||
if url
|
||||
return Sources::Strategies.find(url, ref)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user