Fix a bug where thread owners Avatar was used if post owner

did not have one.  This is due to behavior in HTML::Template
with global_vars=1.  If a loop variable is undef, then the global
will be used instead.  Using empty string '' is a better solution.
'' and undef are both false, so template conditionals will not
be changed.
This commit is contained in:
Colin Kuskie 2006-12-16 07:20:01 +00:00
parent 32346771c6
commit 36873f8479
2 changed files with 4 additions and 3 deletions

View file

@ -7,6 +7,7 @@
test collateral directory. The method is called getTestCollateralPath.
Existing tests using that directory have been modified to use the new
method instead of finding the path manually.
- fix: Avatar in Thread & Posts of CS
7.3.1
- Fixed a problem with IE and resizable text areas that caused IE to crash

View file

@ -317,14 +317,14 @@ Returns a URL to the owner's avatar.
sub getAvatarUrl {
my $self = shift;
my $avatarUrl;
my $parent = $self->getThread->getParent;
return undef unless $parent;
return $avatarUrl unless $parent->getValue("avatarsEnabled");
return '' unless $parent and $parent->getValue("avatarsEnabled");
my $user = WebGUI::User->new($self->session, $self->get('ownerUserId'));
#Get avatar field, storage Id.
my $storageId = $user->profileField("avatar");
return '' unless $storageId;
my $avatar = WebGUI::Storage::Image->get($self->session,$storageId);
my $avatarUrl = '';
if ($avatar) {
#Get url from storage object.
foreach my $imageName (@{$avatar->getFiles}) {