* Fix for Pixiv changes
* Fix for artist/wiki pages for -names
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
/*
|
|
||||||
*= require_tree "./mobile"
|
|
||||||
*/
|
|
||||||
@@ -9,6 +9,8 @@ module PostSets
|
|||||||
|
|
||||||
def posts
|
def posts
|
||||||
::Post.tag_match(@artist.name)
|
::Post.tag_match(@artist.name)
|
||||||
|
rescue ::Post::SearchError
|
||||||
|
::Post.where("false")
|
||||||
end
|
end
|
||||||
|
|
||||||
def presenter
|
def presenter
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ module PostSets
|
|||||||
end
|
end
|
||||||
|
|
||||||
@posts ||= ::Post.tag_match(tag_string).paginate(page)
|
@posts ||= ::Post.tag_match(tag_string).paginate(page)
|
||||||
|
rescue ::Post::SearchError
|
||||||
|
@posts = ::Post.where("false")
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_artist?
|
def has_artist?
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ module Sources
|
|||||||
def get_image_url_from_page(page)
|
def get_image_url_from_page(page)
|
||||||
meta = page.search("meta[property=\"og:image\"]").first
|
meta = page.search("meta[property=\"og:image\"]").first
|
||||||
if meta
|
if meta
|
||||||
meta.attr("content").sub(/_m\./, ".")
|
meta.attr("content").sub(/_[ms]\./, ".")
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -171,13 +171,17 @@ class Artist < ActiveRecord::Base
|
|||||||
|
|
||||||
def ban!
|
def ban!
|
||||||
Post.transaction do
|
Post.transaction do
|
||||||
Post.tag_match(name).each do |post|
|
begin
|
||||||
begin
|
Post.tag_match(name).each do |post|
|
||||||
post.flag!("Artist requested removal")
|
begin
|
||||||
rescue PostFlag::Error
|
post.flag!("Artist requested removal")
|
||||||
# swallow
|
rescue PostFlag::Error
|
||||||
|
# swallow
|
||||||
|
end
|
||||||
|
post.delete!
|
||||||
end
|
end
|
||||||
post.delete!
|
rescue Post::SearchError
|
||||||
|
# swallow
|
||||||
end
|
end
|
||||||
|
|
||||||
# potential race condition but unlikely
|
# potential race condition but unlikely
|
||||||
|
|||||||
@@ -659,6 +659,8 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
count
|
count
|
||||||
|
rescue SearchError
|
||||||
|
0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><%= yield :page_title %></title>
|
|
||||||
<%= csrf_meta_tag %>
|
|
||||||
<%= stylesheet_link_tag "application", :media => "screen" %>
|
|
||||||
<%#= stylesheet_link_tag "mobile", :media => "only screen and (max-width: 480px), only screen and (max-device-width: 480px)" %>
|
|
||||||
<%= javascript_include_tag "application" %>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<%= yield :html_header %>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header id="top">
|
|
||||||
<%= render "news_updates/listing" %>
|
|
||||||
|
|
||||||
<h1><%= link_to Danbooru.config.app_name, "/" %></h1>
|
|
||||||
<nav>
|
|
||||||
<%= render "layouts/main_links" %>
|
|
||||||
<%= yield :secondary_links %>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<%= render "layouts/more_links" %>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div id="page">
|
|
||||||
<%- if flash[:notice] -%>
|
|
||||||
<div class="ui-corner-all ui-state-highlight" id="notice"><%= flash[:notice] %></div>
|
|
||||||
<%- else -%>
|
|
||||||
<div class="ui-corner-all ui-state-highlight" id="notice" style="display: none;"></div>
|
|
||||||
<%- end -%>
|
|
||||||
|
|
||||||
<%= yield :layout %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<%= yield :page_footer_content %>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<%= render "static/footer" %>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -178,6 +178,8 @@ Danbooru::Application.routes.draw do
|
|||||||
|
|
||||||
namespace :mobile do
|
namespace :mobile do
|
||||||
resources :posts
|
resources :posts
|
||||||
|
resource :session
|
||||||
|
resources :favorites
|
||||||
end
|
end
|
||||||
|
|
||||||
# aliases
|
# aliases
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ class ArtistsControllerTest < ActionController::TestCase
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "get the show page for a negated tag" do
|
||||||
|
@artist.update_attribute(:name, "-aaa")
|
||||||
|
get :show, {:id => @artist.id}
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
should "get the index page" do
|
should "get the index page" do
|
||||||
get :index
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ class WikiPagesControllerTest < ActionController::TestCase
|
|||||||
get :show, {:id => @wiki_page.id}
|
get :show, {:id => @wiki_page.id}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "render for a negated tag" do
|
||||||
|
@wiki_page.update_attribute(:title, "-aaa")
|
||||||
|
get :show, {:id => @wiki_page.id}
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "create action" do
|
context "create action" do
|
||||||
|
|||||||
Reference in New Issue
Block a user