fixes #1836
This commit is contained in:
@@ -13,7 +13,8 @@ class PostsController < ApplicationController
|
|||||||
@post = Post.find_by_md5(params[:md5])
|
@post = Post.find_by_md5(params[:md5])
|
||||||
redirect_to post_path(@post)
|
redirect_to post_path(@post)
|
||||||
else
|
else
|
||||||
@post_set = PostSets::Post.new(tag_query, params[:page], params[:limit] || CurrentUser.user.per_page, params[:raw])
|
limit = params[:limit] || (params[:tags] =~ /(?:^|\s)limit:(\d+)(?:$|\s)/ && $1) || CurrentUser.user.per_page
|
||||||
|
@post_set = PostSets::Post.new(tag_query, params[:page], limit, params[:raw])
|
||||||
@posts = @post_set.posts
|
@posts = @post_set.posts
|
||||||
respond_with(@posts) do |format|
|
respond_with(@posts) do |format|
|
||||||
format.atom
|
format.atom
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Tag < ActiveRecord::Base
|
class Tag < ActiveRecord::Base
|
||||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|artcomm|-pool|pool|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|-source|id|-id|date|age|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv"
|
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|artcomm|-pool|pool|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv"
|
||||||
attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin]
|
attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin]
|
||||||
attr_accessible :is_locked, :as => [:moderator, :janitor, :admin]
|
attr_accessible :is_locked, :as => [:moderator, :janitor, :admin]
|
||||||
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
|
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
|
||||||
@@ -343,7 +343,7 @@ class Tag < ActiveRecord::Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
scan_query(query).each do |token|
|
scan_query(query).each do |token|
|
||||||
q[:tag_count] += 1 unless token == "status:deleted"
|
q[:tag_count] += 1 unless token == "status:deleted" || token =~ /\Alimit:.+\Z/
|
||||||
|
|
||||||
if token =~ /\A(#{METATAGS}):(.+)\Z/i
|
if token =~ /\A(#{METATAGS}):(.+)\Z/i
|
||||||
case $1.downcase
|
case $1.downcase
|
||||||
@@ -485,6 +485,9 @@ class Tag < ActiveRecord::Base
|
|||||||
when "order"
|
when "order"
|
||||||
q[:order] = $2.downcase
|
q[:order] = $2.downcase
|
||||||
|
|
||||||
|
when "limit"
|
||||||
|
# Do nothing. The controller takes care of it.
|
||||||
|
|
||||||
when "-status"
|
when "-status"
|
||||||
q[:status_neg] = $2.downcase
|
q[:status_neg] = $2.downcase
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user