diff options
-rw-r--r-- | extensions/BugModal/lib/MonkeyPatches.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/extensions/BugModal/lib/MonkeyPatches.pm b/extensions/BugModal/lib/MonkeyPatches.pm index c2e24f5ce..743573f32 100644 --- a/extensions/BugModal/lib/MonkeyPatches.pm +++ b/extensions/BugModal/lib/MonkeyPatches.pm @@ -42,10 +42,19 @@ use warnings; sub moz_nick { my ($self) = @_; - return $1 if $self->name =~ /:(.+?)\b/; - return $self->name if $self->name; - $self->login =~ /^([^\@]+)\@/; - return $1; + if (!exists $self->{moz_nick}) { + if ($self->name =~ /:?:(.+?)\b/) { + $self->{moz_nick} = $1; + } + elsif ($self->name) { + $self->{moz_nick} = $self->name; + } + else { + $self->login =~ /^([^\@]+)\@/; + $self->{moz_nick} = $1; + } + } + return $self->{moz_nick}; } 1; |