posts/show: refactor parent/child notices.

* Convert notices from helpers to partials.
* Eliminate PostSets::PostRelationship class in favor of post_sets/posts template.
* Eliminate COUNT(*) queries when calculating the number of child posts.
* Eliminate redundant parent load and parent exists queries.
This commit is contained in:
evazion
2020-01-12 17:08:59 -06:00
parent ed5caba71c
commit 40711e1d4f
7 changed files with 36 additions and 74 deletions

View File

@@ -1239,10 +1239,6 @@ class Post < ApplicationRecord
end
end
def parent_exists?
Post.exists?(parent_id)
end
def has_visible_children?
return true if has_active_children?
return true if has_children? && CurrentUser.user.show_deleted_children?