posts index: clean up limit:<n> / order:random parsing (#2894)
* Move the limit:<n> / order:random metatag parsing from the controller to the post set. * Introduce `Tag.has_metatag?` and use it to parse these metatags instead of using a regex (#2894).
This commit is contained in:
@@ -10,9 +10,7 @@ class PostsController < ApplicationController
|
||||
format.html { redirect_to(@post) }
|
||||
end
|
||||
else
|
||||
limit = params[:limit] || (params[:tags] =~ /(?:^|\s)limit:(\d+)(?:$|\s)/ && $1) || CurrentUser.user.per_page
|
||||
@random = params[:random] || params[:tags] =~ /(?:^|\s)order:random(?:$|\s)/
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], limit, raw: params[:raw], random: @random, format: params[:format], read_only: params[:ro])
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], params[:limit], raw: params[:raw], random: params[:random], format: params[:format], read_only: params[:ro])
|
||||
@posts = @post_set.posts
|
||||
respond_with(@posts) do |format|
|
||||
format.atom
|
||||
|
||||
Reference in New Issue
Block a user