2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-30 21:45:13 +00:00

include the whole PoolPost relevant to the post when doing a pool: search, not just the sequence

--HG--
branch : moe
extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%40452
This commit is contained in:
petopeto
2010-11-18 19:39:33 +00:00
parent 571472bfb1
commit 2db519db2d
3 changed files with 10 additions and 3 deletions

View File

@@ -115,7 +115,8 @@ class PoolController < ApplicationController
:order => "nat_sort(pools_posts.sequence), pools_posts.post_id",
:joins => "JOIN pools_posts ON posts.id = pools_posts.post_id",
:conditions => [conds.join(" AND "), *cond_params],
:select => "posts.*, pools_posts.sequence AS sequence",
:select => "posts.*,
pools_posts.pool_id AS pool_pool_id, pools_posts.sequence AS pool_sequence, pools_posts.next_post_id AS pool_next_post_id, pools_posts.prev_post_id AS pool_prev_post_id",
:page => params[:page],
}

View File

@@ -40,7 +40,13 @@ module PostApiMethods
# If we're being formatted as the contents of a pool, we'll have the pool_post
# sequence loaded too.
ret[:sequence] = sequence if self.respond_to?("sequence")
if self.respond_to?("pool_sequence") then
ret[:pool_post] = {}
ret[:pool_post][:pool_id] = pool_pool_id
ret[:pool_post][:next_post_id] = pool_next_post_id
ret[:pool_post][:prev_post_id] = pool_prev_post_id
ret[:pool_post][:sequence] = pool_sequence
end
return ret
end

View File

@@ -270,7 +270,7 @@ module PostSqlMethods
# If we're searching in a pool, include the pool_post sequence in API output.
if q.has_key?(:pool)
sql << ", pools_posts.sequence AS sequence"
sql << ", pools_posts.pool_id AS pool_pool_id, pools_posts.sequence AS pool_sequence, pools_posts.next_post_id AS pool_next_post_id, pools_posts.prev_post_id AS pool_prev_post_id"
end
end