From 57584dc4744fea59833ef355f7513690d246c70f Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 4 Oct 2011 18:25:23 -0400 Subject: more porting work --- extensions/TagNewUsers/Extension.pm | 16 ++++++++++++++++ .../template/en/default/hook/bug/comments-user.html.tmpl | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'extensions/TagNewUsers') diff --git a/extensions/TagNewUsers/Extension.pm b/extensions/TagNewUsers/Extension.pm index 382a3c3d1..d71c4ea20 100644 --- a/extensions/TagNewUsers/Extension.pm +++ b/extensions/TagNewUsers/Extension.pm @@ -26,6 +26,7 @@ use Bugzilla::Field; use Bugzilla::User; use Bugzilla::Install::Util qw(indicate_progress); use Date::Parse; +use Scalar::Util qw(blessed); # users younger than PROFILE_AGE days will be tagged as new use constant PROFILE_AGE => 60; @@ -223,4 +224,19 @@ sub _user_is_new { || ($user->{creation_age} <= PROFILE_AGE); } +sub webservice_user_get { + my ($self, $args) = @_; + my ($webservice, $params, $users) = @$args{qw(webservice params users)}; + + foreach my $user (@$users) { + # Most of the time the hash values are XMLRPC::Data objects + my $email = blessed $user->{'email'} ? $user->{'email'}->value : $user->{'email'}; + if ($email) { + my $user_obj = Bugzilla::User->new({ name => $email }); + $user->{'is_new'} + = $webservice->type('boolean', $self->_user_is_new($user_obj) ? 1 : 0); + } + } +} + __PACKAGE__->NAME; diff --git a/extensions/TagNewUsers/template/en/default/hook/bug/comments-user.html.tmpl b/extensions/TagNewUsers/template/en/default/hook/bug/comments-user.html.tmpl index 316d381bb..274d26435 100644 --- a/extensions/TagNewUsers/template/en/default/hook/bug/comments-user.html.tmpl +++ b/extensions/TagNewUsers/template/en/default/hook/bug/comments-user.html.tmpl @@ -23,11 +23,11 @@ 365 %]more than a year ago[% -ELSE %][% comment.author.creation_age FILTER html %] day[% "s" IF comment.author.creation_age != 1 %] ago[% END %]." +ELSE %][% comment.author.creation_age %] day[% "s" IF comment.author.creation_age != 1 %] ago[% END %]." > (New to [% terms.Bugzilla %]) -- cgit v1.2.3-24-g4f1b