[Rt-commit] rt branch, 4.0/simple-search-owner, created. rt-4.0.6-127-gc502334

Thomas Sibley trs at bestpractical.com
Thu May 31 18:45:06 EDT 2012


The branch, 4.0/simple-search-owner has been created
        at  c50233491d00088359df833b4088dc06379093dc (commit)

- Log -----------------------------------------------------------------
commit eb5339a0cb1aec7ede50b9f9905709a87344ca6c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 31 18:38:32 2012 -0400

    Document the arguments passed to the Handle* methods

diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index a125483..559f3c1 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -225,6 +225,11 @@ sub GuessType {
     return "default";
 }
 
+# $_[0] is $self
+# $_[1] is escaped value without surrounding single quotes
+# $_[2] is a boolean of "was quoted by the user?"
+#       ensure this is false before you do smart matching like $_[1] eq "me"
+# $_[3] is escaped subkey, if any (see HandleCf)
 sub HandleDefault   { return subject   => "Subject LIKE '$_[1]'"; }
 sub HandleSubject   { return subject   => "Subject LIKE '$_[1]'"; }
 sub HandleFulltext  { return content   => "Content LIKE '$_[1]'"; }

commit c50233491d00088359df833b4088dc06379093dc
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 31 18:38:53 2012 -0400

    Make owner:user at example.com work as the in-page simple search documentation claims

diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index 559f3c1..d59377a 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -247,7 +247,14 @@ sub HandleStatus    {
     }
 }
 sub HandleOwner     {
-    return owner  => (!$_[2] and $_[1] eq "me") ? "Owner.id = '__CurrentUser__'" : "Owner = '$_[1]'";
+    if (!$_[2] and $_[1] eq "me") {
+        return owner => "Owner.id = '__CurrentUser__'";
+    }
+    elsif (!$_[2] and $_[1] =~ /\w+@\w+/) {
+        return owner => "Owner.EmailAddress = '$_[1]'";
+    } else {
+        return owner => "Owner = '$_[1]'";
+    }
 }
 sub HandleWatcher     {
     return watcher => (!$_[2] and $_[1] eq "me") ? "Watcher.id = '__CurrentUser__'" : "Watcher = '$_[1]'";

-----------------------------------------------------------------------


More information about the Rt-commit mailing list