Fix: 同じ投稿を返信かつ参照している時、同じ投稿がcontext
に複数含まれる問題 (#210)
* Add: #198 `context`のAPIについて`with_references`対応 * Fix: 同じ投稿を参照かつ返信していると、`context`に同じ投稿が複数含まれる問題
This commit is contained in:
parent
99511ee1b5
commit
77a1cabb97
2 changed files with 26 additions and 5 deletions
|
@ -49,7 +49,9 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
loaded_descendants = cache_collection(descendants_results, Status)
|
||||
loaded_references = cache_collection(references_results, Status)
|
||||
|
||||
unless params[:with_reference]
|
||||
if params[:with_reference]
|
||||
loaded_references.reject! { |status| loaded_ancestors.any? { |ancestor| ancestor.id == status.id } }
|
||||
else
|
||||
loaded_ancestors = (loaded_ancestors + loaded_references).uniq(&:id)
|
||||
loaded_references = []
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue