* Fix for Pixiv changes

* Fix for artist/wiki pages for -names
This commit is contained in:
albert
2012-02-08 12:44:17 -05:00
parent 1eae813f6d
commit c14f020ce2
10 changed files with 31 additions and 51 deletions

View File

@@ -1,3 +0,0 @@
/*
*= require_tree "./mobile"
*/

View File

@@ -9,6 +9,8 @@ module PostSets
def posts
::Post.tag_match(@artist.name)
rescue ::Post::SearchError
::Post.where("false")
end
def presenter

View File

@@ -29,6 +29,8 @@ module PostSets
end
@posts ||= ::Post.tag_match(tag_string).paginate(page)
rescue ::Post::SearchError
@posts = ::Post.where("false")
end
def has_artist?

View File

@@ -42,7 +42,7 @@ module Sources
def get_image_url_from_page(page)
meta = page.search("meta[property=\"og:image\"]").first
if meta
meta.attr("content").sub(/_m\./, ".")
meta.attr("content").sub(/_[ms]\./, ".")
else
nil
end

View File

@@ -171,13 +171,17 @@ class Artist < ActiveRecord::Base
def ban!
Post.transaction do
Post.tag_match(name).each do |post|
begin
post.flag!("Artist requested removal")
rescue PostFlag::Error
# swallow
begin
Post.tag_match(name).each do |post|
begin
post.flag!("Artist requested removal")
rescue PostFlag::Error
# swallow
end
post.delete!
end
post.delete!
rescue Post::SearchError
# swallow
end
# potential race condition but unlikely

View File

@@ -659,6 +659,8 @@ class Post < ActiveRecord::Base
end
end
count
rescue SearchError
0
end
end

View File

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

View File

@@ -178,6 +178,8 @@ Danbooru::Application.routes.draw do
namespace :mobile do
resources :posts
resource :session
resources :favorites
end
# aliases

View File

@@ -29,6 +29,12 @@ class ArtistsControllerTest < ActionController::TestCase
assert_response :success
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
get :index
assert_response :success

View File

@@ -39,6 +39,12 @@ class WikiPagesControllerTest < ActionController::TestCase
get :show, {:id => @wiki_page.id}
assert_response :success
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
context "create action" do