summaryrefslogtreecommitdiffstats
path: root/extensions/Gravatar
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-11-05 09:59:35 +0100
committerByron Jones <bjones@mozilla.com>2013-11-05 09:59:35 +0100
commit14ec8f2591a4299e6beeaf1c030f847eea6d87ff (patch)
tree8348afd0eb164f3c36b5a00b8b0a05fba0f518b0 /extensions/Gravatar
parenta4c4cbada652d6106aa87d2a08d29fce580449e9 (diff)
downloadbugzilla-14ec8f2591a4299e6beeaf1c030f847eea6d87ff.tar.gz
bugzilla-14ec8f2591a4299e6beeaf1c030f847eea6d87ff.tar.xz
Bug 934903: icons for people who have opted out of gravator are 404'ing
Diffstat (limited to 'extensions/Gravatar')
-rw-r--r--extensions/Gravatar/Extension.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/extensions/Gravatar/Extension.pm b/extensions/Gravatar/Extension.pm
index 52bbd3d08..488970d89 100644
--- a/extensions/Gravatar/Extension.pm
+++ b/extensions/Gravatar/Extension.pm
@@ -15,19 +15,20 @@ use base qw(Bugzilla::Extension);
use Bugzilla::User::Setting;
use Digest::MD5 qw(md5_hex);
+use constant DEFAULT_URL => 'extensions/Gravatar/web/default.jpg';
+
BEGIN {
*Bugzilla::User::gravatar = \&_user_gravatar;
}
sub _user_gravatar {
my ($self, $size) = @_;
+ if ($self->setting('show_my_gravatar') eq 'Off') {
+ return DEFAULT_URL;
+ }
if (!$self->{gravatar}) {
- if ($self->setting('show_my_gravatar') eq 'On') {
- (my $email = $self->email) =~ s/\+(.*?)\@/@/;
- $self->{gravatar} = 'https://secure.gravatar.com/avatar/' . md5_hex(lc($email)) . '?d=mm';
- } else {
- $self->{gravatar} = 'extensions/Gravatar/web/default.jpg';
- }
+ (my $email = $self->email) =~ s/\+(.*?)\@/@/;
+ $self->{gravatar} = 'https://secure.gravatar.com/avatar/' . md5_hex(lc($email)) . '?d=mm';
}
$size ||= 64;
return $self->{gravatar} . "&amp;size=$size";