summaryrefslogtreecommitdiffstats
path: root/extensions/UserProfile/Extension.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/UserProfile/Extension.pm')
-rw-r--r--extensions/UserProfile/Extension.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/extensions/UserProfile/Extension.pm b/extensions/UserProfile/Extension.pm
index 189e91f65..99f235896 100644
--- a/extensions/UserProfile/Extension.pm
+++ b/extensions/UserProfile/Extension.pm
@@ -13,9 +13,11 @@ use warnings;
use base qw(Bugzilla::Extension);
use Bugzilla::Constants;
+use Bugzilla::Extension::UserProfile::TimeAgo qw(time_ago);
use Bugzilla::Extension::UserProfile::Util;
use Bugzilla::Install::Filesystem;
use Bugzilla::User;
+use Bugzilla::Util qw(datetime_from);
use Scalar::Util qw(blessed);
our $VERSION = '1';
@@ -261,6 +263,14 @@ sub webservice_user_get {
}
}
+sub template_before_create {
+ my ($self, $args) = @_;
+ $args->{config}->{FILTERS}->{timeago} = sub {
+ my ($time_str) = @_;
+ return time_ago(datetime_from($time_str, 'UTC'));
+ };
+}
+
sub page_before_template {
my ($self, $args) = @_;
my ($vars, $page) = @$args{qw(vars page_id)};