summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/lib/ActivityStream.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-04-14 07:20:00 +0200
committerByron Jones <glob@mozilla.com>2015-04-14 07:20:00 +0200
commite5131c86c22c5577c0e27db04481084caf635dc5 (patch)
tree897a6ef2d1314a1c442e9e8b8ff14a4dd2cf3eb2 /extensions/BugModal/lib/ActivityStream.pm
parent6116f2f7cf32f40c1f943cef3f523ed5955f968d (diff)
downloadbugzilla-e5131c86c22c5577c0e27db04481084caf635dc5.tar.gz
bugzilla-e5131c86c22c5577c0e27db04481084caf635dc5.tar.xz
Bug 1146767: update relative dates without refreshing the page
Diffstat (limited to 'extensions/BugModal/lib/ActivityStream.pm')
-rw-r--r--extensions/BugModal/lib/ActivityStream.pm15
1 files changed, 4 insertions, 11 deletions
diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm
index dae6b8ba2..97edf2ee6 100644
--- a/extensions/BugModal/lib/ActivityStream.pm
+++ b/extensions/BugModal/lib/ActivityStream.pm
@@ -12,9 +12,9 @@ package Bugzilla::Bug;
use strict;
use warnings;
+use Bugzilla::Extension::BugModal::Util qw(date_str_to_time);
use Bugzilla::User;
use Bugzilla::Constants;
-use Time::Local;
# returns an arrayref containing all changes to the bug - comments, field
# changes, and duplicates
@@ -51,7 +51,7 @@ sub activity_stream {
_add_activities_to_stream($self, $stream);
_add_duplicates_to_stream($self, $stream);
- my $base_time = _sql_date_to_time($self->creation_ts);
+ my $base_time = date_str_to_time($self->creation_ts);
foreach my $change_set (@$stream) {
$change_set->{id} = $change_set->{comment}
? 'c' . $change_set->{comment}->count
@@ -101,7 +101,7 @@ sub _add_comments_to_stream {
next if $comment->type == CMT_HAS_DUPE;
next if $comment->is_private && !($user->is_insider || $user->id == $comment->author->id);
next if $comment->body eq '' && ($comment->work_time - 0) != 0 && !$user->is_timetracker;
- _add_comment_to_stream($stream, _sql_date_to_time($comment->creation_ts), $comment->author->id, $comment);
+ _add_comment_to_stream($stream, date_str_to_time($comment->creation_ts), $comment->author->id, $comment);
}
}
@@ -237,7 +237,7 @@ sub _add_activities_to_stream {
}
}
- _add_activity_to_stream($stream, _sql_date_to_time($operation->{when}), $operation->{who}->id, $operation);
+ _add_activity_to_stream($stream, date_str_to_time($operation->{when}), $operation->{who}->id, $operation);
}
# prime the visible-bugs cache
@@ -274,11 +274,4 @@ sub _add_duplicates_to_stream {
}
}
-sub _sql_date_to_time {
- my ($date) = @_;
- $date =~ /^(\d{4})[\.\-](\d{2})[\.\-](\d{2}) (\d{2}):(\d{2}):(\d{2})$/
- or die "internal error: invalid date '$date'";
- return timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
-}
-
1;