diff options
author | Byron Jones <glob@mozilla.com> | 2015-06-15 10:28:07 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-06-15 10:28:07 +0200 |
commit | cadc7a6ee5c77b35bd8b48b058e109777a6e8fd0 (patch) | |
tree | 68b56d8fb4fc248ab8a5654e5a2a4323dc6b95df | |
parent | 53a49f84b521ea0682ec46fee0d040d3ed312189 (diff) | |
download | bugzilla-cadc7a6ee5c77b35bd8b48b058e109777a6e8fd0.tar.gz bugzilla-cadc7a6ee5c77b35bd8b48b058e109777a6e8fd0.tar.xz |
Bug 1174637: a double-colon nick is detected as ":"
-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; |