plugin.rb
def unfiltered_posts
      result = super
      
      if SiteSetting.private_replies_enabled && @topic.custom_fields.keys.include?('private_replies') && @topic.custom_fields['private_replies']
        if !@user || !DiscoursePrivateReplies.can_see_all_posts?(@user, @topic)
          userids = DiscoursePrivateReplies.can_see_post_if_author_among(@user, @topic)
          result = result.where('(posts.post_number = 1 OR posts.user_id IN (?))', userids)
        end
      end
      result
    end
# hide posts at the lowest level
hide posts at the lowest level
hide posts at the lowest level
def unfiltered_posts
      result = super
      if SiteSetting.private_replies_enabled && @topic.custom_fields.keys.include?('private_replies') && @topic.custom_fields['private_replies']
        if !@user || !DiscoursePrivateReplies.can_see_all_posts?(@user, @topic)
          userids = DiscoursePrivateReplies.can_see_post_if_author_among(@user, @topic)
          result = result.where('(posts.post_number = 1 OR posts.user_id IN (?))', userids)
        end
      end
      result
    end
def unfiltered_posts result = super if SiteSetting . private_replies_enabled && @topic . custom_fields . keys . include? ( 'private_replies' ) && @topic . custom_fields [ 'private_replies' ] if ! @user || ! DiscoursePrivateReplies . can_see_all_posts? ( @user , @topic ) userids = DiscoursePrivateReplies . can_see_post_if_author_among ( @user , @topic ) result = result . where ( '(posts.post_number = 1 OR posts.user_id IN (?))' , userids ) end end result end
hide posts at the lowest level
hide posts at the lowest level