[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-77-g30c967e

Ruslan Zakirov ruz at bestpractical.com
Wed Jan 6 07:21:41 EST 2010


The branch, 3.8-trunk has been updated
       via  30c967eac820d27ff6eb57069bca32e44dd5193f (commit)
       via  faa5c645a16b30f895a7527cb833b814e85b0e70 (commit)
       via  bc6bccac62745d087f4be85608f6901fde5d45bf (commit)
       via  907a965f3ffc6a248928d42d9ed0c322ff74e69f (commit)
      from  d0d1530b8229d3d01b40f82af1c95ec263dec3f2 (commit)

Summary of changes:
 share/html/Elements/ShowUser        |   24 +++++++++++++-----------
 share/html/Elements/ShowUserConcise |   16 ++++++++++++++--
 2 files changed, 27 insertions(+), 13 deletions(-)

- Log -----------------------------------------------------------------
commit 907a965f3ffc6a248928d42d9ed0c322ff74e69f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Dec 4 00:09:30 2009 +0300

    generic ShowUser shouldn't suffer from User->Load
    
    Verbose format for example can use email address without
    any problems and also address mostly passed into the component
    when there is no ability to load user.
    
    Each format implementation may use Verbose to show email, but
    it's bad for extensibility to fallback to Verbose all the time

diff --git a/share/html/Elements/ShowUser b/share/html/Elements/ShowUser
index 2fbdcbc..31a612b 100644
--- a/share/html/Elements/ShowUser
+++ b/share/html/Elements/ShowUser
@@ -49,18 +49,16 @@
 <%INIT>
 # $User is an RT::User object
 # $Address is Email::Address object
-if ( !$User && $Address ) {
-    $User = RT::User->new( $session{'CurrentUser'} );
-    $User->LoadByEmail( $Address->address );
-    unless ( $User->Id ) {
-        $m->comp( '/Elements/ShowUserVerbose', Address => $Address );
-        return;
-    }
-}
 if ( $style eq 'concise' ) {
-    $m->comp( '/Elements/ShowUserConcise', User => $User );
+    $m->comp( '/Elements/ShowUserConcise',
+        User => $User, Address => $Address,
+    );
+}
+else {
+    return $m->comp( '/Elements/ShowUserVerbose',
+        User => $User, Address => $Address
+    );
 }
-else { $m->comp( '/Elements/ShowUserVerbose', User => $User ); }
 </%INIT>
 <%ARGS>
 $User => undef
diff --git a/share/html/Elements/ShowUserConcise b/share/html/Elements/ShowUserConcise
index 3cdba10..c4cccca 100644
--- a/share/html/Elements/ShowUserConcise
+++ b/share/html/Elements/ShowUserConcise
@@ -46,7 +46,19 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 %# Released under the terms of version 2 of the GNU Public License
-<% $User->RealName || $User->Name %>\
+<% $Address || $User->RealName || $User->Name %>\
 <%ARGS>
-$User
+$User => undef
+$Address => undef
 </%ARGS>
+<%INIT>
+if ( !$User && $Address ) {
+    $User = RT::User->new( $session{'CurrentUser'} );
+    $User->LoadByEmail( $Address->address );
+    if ( $User->Id ) {
+        $Address = '';
+    } else {
+        $Address = $Address->address;
+    }
+}
+</%INIT>

commit bc6bccac62745d087f4be85608f6901fde5d45bf
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Dec 4 00:13:50 2009 +0300

    implement support for pluggable user formats
    
    support only for concise and verbose sucks

diff --git a/share/html/Elements/ShowUser b/share/html/Elements/ShowUser
index 31a612b..28c2a9b 100644
--- a/share/html/Elements/ShowUser
+++ b/share/html/Elements/ShowUser
@@ -49,16 +49,20 @@
 <%INIT>
 # $User is an RT::User object
 # $Address is Email::Address object
-if ( $style eq 'concise' ) {
-    $m->comp( '/Elements/ShowUserConcise',
-        User => $User, Address => $Address,
+
+my $comp = '/Elements/ShowUser'. ucfirst lc $style;
+unless ( $m->comp_exists( $comp ) ) {
+    $RT::Logger->error(
+        'Either system config or user #'
+        . $session{'CurrentUser'}->id
+        . ' picked UsernameFormat '. $style
+        . ', but '. $comp . "doesn't exist";
     );
-}
-else {
-    return $m->comp( '/Elements/ShowUserVerbose',
-        User => $User, Address => $Address
+    return $m->comp('/Elements/ShowUserConcise',
+        User => $User, Address => $Address,
     );
 }
+return $m->comp( $comp, User => $User, Address => $Address );
 </%INIT>
 <%ARGS>
 $User => undef

commit faa5c645a16b30f895a7527cb833b814e85b0e70
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Dec 4 14:55:23 2009 +0300

    typo

diff --git a/share/html/Elements/ShowUser b/share/html/Elements/ShowUser
index 28c2a9b..01de725 100644
--- a/share/html/Elements/ShowUser
+++ b/share/html/Elements/ShowUser
@@ -56,7 +56,7 @@ unless ( $m->comp_exists( $comp ) ) {
         'Either system config or user #'
         . $session{'CurrentUser'}->id
         . ' picked UsernameFormat '. $style
-        . ', but '. $comp . "doesn't exist";
+        . ', but '. $comp . "doesn't exist"
     );
     return $m->comp('/Elements/ShowUserConcise',
         User => $User, Address => $Address,

commit 30c967eac820d27ff6eb57069bca32e44dd5193f
Merge: d0d1530 faa5c64
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jan 6 15:21:17 2010 +0300

    Merge branch 'show_user_refactor' into 3.8-trunk


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


More information about the Rt-commit mailing list