From 30d6f374cc1cd4955a825a606329f736a51aab83 Mon Sep 17 00:00:00 2001 From: Liv Date: Tue, 23 Jul 2013 21:03:32 +0000 Subject: [PATCH] Bug 5041 Include comments search in S2 search module Simplified and corrected fix. Print_search_form method checks if comments are indexed here, if so adds a "with comments" checkbox. Currently comments are indexed if the journal being viewed is paid. --- cgi-bin/LJ/S2.pm | 4 ++++ cgi-bin/LJ/User.pm | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/cgi-bin/LJ/S2.pm b/cgi-bin/LJ/S2.pm index 33e7ad4e8b..a6b872414e 100644 --- a/cgi-bin/LJ/S2.pm +++ b/cgi-bin/LJ/S2.pm @@ -2957,6 +2957,10 @@ sub print_search_form { $search_form .= '
'; $search_form .= LJ::form_auth(); $search_form .= ''; + if ( $ju->allow_comments_indexed() ) { + $search_form .= '
'; + $search_form .= ''; + } $search_form .= ''; $search_form .= '
'; diff --git a/cgi-bin/LJ/User.pm b/cgi-bin/LJ/User.pm index a9cd3f5301..8693c36f13 100644 --- a/cgi-bin/LJ/User.pm +++ b/cgi-bin/LJ/User.pm @@ -1918,6 +1918,17 @@ sub allow_search_by { return 0; } +# whether comments are indexed in this journal +sub allow_comments_indexed { + my ( $u ) = @_; + return 0 unless LJ::isu( $u ); + + # Comments are indexed in paid accounts only + return 1 if $u->is_paid; + + # Otherwise comments aren't indexed + return 0; +} sub caps { my $u = shift;