-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"
- );
- return $m->comp('/Elements/ShowUserConcise',
- User => $User, Address => $Address,
- );
+my $display = RT::User->Format(
+ User => $User,
+ Address => $Address,
+ CurrentUser => $session{CurrentUser},
+ Format => $style,
+);
+
+# RT::User->Format does this itself, but we want to make sure we have a $User
+# if at all possible for the rest of our code below.
+if ($Address and not $User) {
+ $User = RT::User->new( $session{CurrentUser} );
+ $User->LoadByEmail( $Address->address );
+ undef $User unless $User->id;