fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-07-06 08:49 am

[dw-free] Interest search returns incorrect results

[commit: http://hg.dwscoalition.org/dw-free/rev/58567582f1c7]

http://bugs.dwscoalition.org/show_bug.cgi?id=2112

Make allowed string length consistent. Rename constant because the max
length applies to all site-wide keywords, not just interests.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Constants.pm
  • cgi-bin/LJ/User.pm
  • cgi-bin/ljlib.pl
--------------------------------------------------------------------------------
diff -r 3d6b9b44d272 -r 58567582f1c7 cgi-bin/LJ/Constants.pm
--- a/cgi-bin/LJ/Constants.pm	Tue Jul 06 02:34:20 2010 +0800
+++ b/cgi-bin/LJ/Constants.pm	Tue Jul 06 16:55:25 2010 +0800
@@ -50,8 +50,8 @@ use constant CMAX_BIO     => 65535;
 use constant CMAX_BIO     => 65535;
 use constant BMAX_EVENT   => 450000;
 use constant CMAX_EVENT   => 300000;
-use constant BMAX_INTEREST => 100;
-use constant CMAX_INTEREST => 50;
+use constant BMAX_SITEKEYWORD => 100;
+use constant CMAX_SITEKEYWORD => 50;
 use constant BMAX_UPIC_COMMENT => 255;
 use constant CMAX_UPIC_COMMENT => 120;
 use constant BMAX_UPIC_DESCRIPTION => 255;
diff -r 3d6b9b44d272 -r 58567582f1c7 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Tue Jul 06 02:34:20 2010 +0800
+++ b/cgi-bin/LJ/User.pm	Tue Jul 06 16:55:25 2010 +0800
@@ -7978,8 +7978,8 @@ sub validate_interest_list {
             $int = LJ::ehtml($int);
             $error_string .= '.invalid';
         } else {
-            $error_string .= '.bytes' if $bytes > LJ::BMAX_INTEREST;
-            $error_string .= '.chars' if $chars > LJ::CMAX_INTEREST;
+            $error_string .= '.bytes' if $bytes > LJ::BMAX_SITEKEYWORD;
+            $error_string .= '.chars' if $chars > LJ::CMAX_SITEKEYWORD;
         }
 
         if ($error_string) {
@@ -7987,9 +7987,9 @@ sub validate_interest_list {
             push @$interrors, [ $error_string,
                                 { int => $int,
                                   bytes => $bytes,
-                                  bytes_max => LJ::BMAX_INTEREST,
+                                  bytes_max => LJ::BMAX_SITEKEYWORD,
                                   chars => $chars,
-                                  chars_max => LJ::CMAX_INTEREST
+                                  chars_max => LJ::CMAX_SITEKEYWORD
                                 }
                               ];
             next;
diff -r 3d6b9b44d272 -r 58567582f1c7 cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl	Tue Jul 06 02:34:20 2010 +0800
+++ b/cgi-bin/ljlib.pl	Tue Jul 06 16:55:25 2010 +0800
@@ -1552,7 +1552,7 @@ sub get_sitekeyword_id {
 
     # setup the keyword for use
     return 0 unless $kw =~ /\S/;
-    $kw = LJ::text_trim( LJ::trim( $kw ), LJ::BMAX_KEYWORD, LJ::CMAX_KEYWORD );
+    $kw = LJ::text_trim( LJ::trim( $kw ), LJ::BMAX_SITEKEYWORD, LJ::CMAX_SITEKEYWORD );
 
     # get the keyword and insert it if necessary
     my $dbr = LJ::get_db_reader();
--------------------------------------------------------------------------------