Fix pagination errors

This commit is contained in:
chiu 2026-06-02 11:03:46 +00:00
parent df8633e35c
commit 786954e35b
1 changed files with 3 additions and 1 deletions

View File

@ -374,10 +374,11 @@ class SiteFeedAnnc
pipeline_to_get_data << {"$sort"=>sort_maps}
end
if max_len > 0
if max_len > 0 && tags.blank? && hashtags.blank?
pipeline_to_get_data << {"$limit"=> max_len}
end
pipeline_to_get_count = pipeline.clone
pipeline_to_get_count << {"$group" => {
_id: nil,
@ -412,6 +413,7 @@ class SiteFeedAnnc
if (tags.present? && tags != "all") || (hashtags.present? && hashtags != "all")
feeds = feeds.uniq { |f| f['id'] }
feeds_count = feeds.size
feeds = feeds.first(max_len) if max_len > 0
end
return feeds, feeds_count