diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 102aa2dca..54d3e64fb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -69,6 +69,9 @@ protected fmt.json do render :json => {:success => false, :reason => "access denied"}.to_json, :status => 403 end + fmt.js do + render :nothing => true, :status => 403 + end end end @@ -106,10 +109,15 @@ protected def normalize_search if request.get? - params[:search] ||= {} - changed = params[:search].reject! {|k,v| v.blank?} - unless changed.nil? - redirect_to params + if params[:search].blank? + params[:search] = {} + end + + if params[:search].is_a?(Hash) + changed = params[:search].reject! {|k,v| v.blank?} + unless changed.nil? + redirect_to params + end end end end diff --git a/app/models/artist.rb b/app/models/artist.rb index 741336c1e..ae802eca9 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -431,4 +431,8 @@ class Artist < ActiveRecord::Base def deletable_by?(user) user.is_builder? end + + def visible? + !is_banned? || CurrentUser.user.is_janitor? + end end diff --git a/app/models/artist_commentary_version.rb b/app/models/artist_commentary_version.rb index 95cd33e33..b969116d3 100644 --- a/app/models/artist_commentary_version.rb +++ b/app/models/artist_commentary_version.rb @@ -5,7 +5,7 @@ class ArtistCommentaryVersion < ActiveRecord::Base attr_accessible :post_id, :original_title, :original_description, :translated_title, :translated_description def self.search(params) - q = scoped + q = where("true") params = {} if params.blank? if params[:updater_id] diff --git a/app/models/mod_action.rb b/app/models/mod_action.rb index 491e2835b..c47ba0e5b 100644 --- a/app/models/mod_action.rb +++ b/app/models/mod_action.rb @@ -4,7 +4,7 @@ class ModAction < ActiveRecord::Base attr_accessible :description def self.search(params = {}) - q = scoped + q = where("true") return q if params.blank? if params[:creator_id].present? diff --git a/app/presenters/post_set_presenters/post.rb b/app/presenters/post_set_presenters/post.rb index 819682107..9ce17c617 100644 --- a/app/presenters/post_set_presenters/post.rb +++ b/app/presenters/post_set_presenters/post.rb @@ -31,7 +31,7 @@ module PostSetPresenters end def pattern_tags - Tag.name_matches(post_set.tag_string).all(:select => "name", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC").map(&:name) + Tag.name_matches(post_set.tag_string).select("name").limit(Danbooru.config.tag_query_limit).order("post_count DESC").map(&:name) end def related_tags_for_group diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb index 240a661b8..26a641373 100644 --- a/app/presenters/user_presenter.rb +++ b/app/presenters/user_presenter.rb @@ -75,7 +75,7 @@ class UserPresenter def favorites @favorites ||= begin - arel = user.favorites.limit(6).includes(:post).reorder("favorites.id desc") + arel = user.favorites.limit(6).joins(:post).reorder("favorites.id desc") if CurrentUser.user.hide_deleted_posts? arel = arel.where("posts.is_deleted = false") diff --git a/db/structure.sql b/db/structure.sql index ce3301569..35faad9a0 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -6726,4 +6726,5 @@ INSERT INTO schema_migrations (version) VALUES ('20140111191413'); INSERT INTO schema_migrations (version) VALUES ('20140204233337'); -INSERT INTO schema_migrations (version) VALUES ('20140221213349'); \ No newline at end of file +INSERT INTO schema_migrations (version) VALUES ('20140221213349'); +