DEV: Refactor `TopicView#filter_posts` for readability. (#14606)

DEV: Refactor TopicView#filter_posts for readability. (#14606)

diff --git a/lib/topic_view.rb b/lib/topic_view.rb
index 1821927..1f4817e 100644
--- a/lib/topic_view.rb
+++ b/lib/topic_view.rb
@@ -286,16 +286,17 @@ class TopicView
   end
 
   def filter_posts(opts = {})
-    return filter_posts_near(opts[:post_number].to_i) if opts[:post_number].present?
-    return filter_posts_by_ids(opts[:post_ids]) if opts[:post_ids].present?
-
-    if opts[:filter_post_number].present?
-      return filter_posts_by_post_number(opts[:filter_post_number], opts[:asc])
+    if opts[:post_number].present?
+      filter_posts_near(opts[:post_number].to_i)
+    elsif opts[:post_ids].present?
+      filter_posts_by_ids(opts[:post_ids])
+    elsif opts[:filter_post_number].present?
+      filter_posts_by_post_number(opts[:filter_post_number], opts[:asc])
+    elsif opts[:best].present?
+      filter_best(opts[:best], opts)
+    else
+      filter_posts_paged(@page)
     end
-
-    return filter_best(opts[:best], opts) if opts[:best].present?
-
-    filter_posts_paged(@page)
   end
 
   def primary_group_names

GitHub sha: 316e4daa195ddbb840edb281a5b79dd221c8f586

This commit appears in #14606 which was approved by CvX. It was merged by tgxworld.