[dw-free] add account type to profile
[commit: http://hg.dwscoalition.org/dw-free/rev/d6700d0144fc]
http://bugs.dwscoalition.org/show_bug.cgi?id=152
Fix situation where cap has no name.
Patch by
juliet.
http://bugs.dwscoalition.org/show_bug.cgi?id=152
Fix situation where cap has no name.
Patch by
--------------------------------------------------------------------------------
diff -r 1451fd84ea3d -r d6700d0144fc cgi-bin/ljcapabilities.pl
--- a/cgi-bin/ljcapabilities.pl Tue Feb 24 08:05:13 2009 +0000
+++ b/cgi-bin/ljcapabilities.pl Tue Feb 24 08:06:54 2009 +0000
@@ -78,7 +78,12 @@ sub name_caps
sub name_caps
{
my $bit = shift;
- return join( ', ', LJ::caps_string( $bit, '_visible_name' ) );
+ my @caps = LJ::caps_string( $bit, '_visible_name' );
+ if ( @caps ) {
+ return join( ', ', @caps );
+ } else {
+ return LJ::name_caps_short( $bit );
+ }
}
# <LJFUNC>
@@ -109,7 +114,7 @@ sub caps_string {
my $class = LJ::class_of_bit($bit);
next unless $class && LJ::caps_in_group($caps, $class);
my $name = $LJ::CAP{$bit}->{$name_value};
- push @classes, $name;
+ push @classes, $name if $name ne "";
}
return @classes;
diff -r 1451fd84ea3d -r d6700d0144fc htdocs/userinfo.bml
--- a/htdocs/userinfo.bml Tue Feb 24 08:05:13 2009 +0000
+++ b/htdocs/userinfo.bml Tue Feb 24 08:06:54 2009 +0000
@@ -369,7 +369,7 @@ body<=
# account type
my $acctype = LJ::name_caps( $u->caps);
- $ret .= "<p>$acctype</p>";
+ $ret .= "<p>$acctype</p>" if $acctype;
# journal creation date
my $jcdate = BML::ml( '.details.createdon2', { createdate => LJ::mysql_time( $u->timecreate ) } );
--------------------------------------------------------------------------------
