From ff93833fdfcf61d0277d7d91aadb9b97af9cba10 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 30 Mar 2022 02:16:28 +0100 Subject: [PATCH] UX: Use committed date for GitHub oneboxes (#16318) Our copy says 'committed {date}`, but we were previously using the commit's authored date --- lib/onebox/engine/github_commit_onebox.rb | 2 +- spec/lib/onebox/engine/github_commit_onebox_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/onebox/engine/github_commit_onebox.rb b/lib/onebox/engine/github_commit_onebox.rb index d584eb165ec..d1820faa4bb 100644 --- a/lib/onebox/engine/github_commit_onebox.rb +++ b/lib/onebox/engine/github_commit_onebox.rb @@ -35,7 +35,7 @@ module Onebox result['title'] = lines.first result['body'], result['excerpt'] = compute_body(lines[1..lines.length].join("\n")) - committed_at = Time.parse(result['commit']['author']['date']) + committed_at = Time.parse(result['commit']['committer']['date']) result['committed_at'] = committed_at.strftime("%I:%M%p - %d %b %y %Z") result['committed_at_date'] = committed_at.strftime("%F") result['committed_at_time'] = committed_at.strftime("%T") diff --git a/spec/lib/onebox/engine/github_commit_onebox_spec.rb b/spec/lib/onebox/engine/github_commit_onebox_spec.rb index 6abf6499271..1ca89e47af2 100644 --- a/spec/lib/onebox/engine/github_commit_onebox_spec.rb +++ b/spec/lib/onebox/engine/github_commit_onebox_spec.rb @@ -38,7 +38,7 @@ describe Onebox::Engine::GithubCommitOnebox do end it "includes commit time and date" do - expect(html).to include("02:03AM - 02 Aug 13") + expect(html).to include("02:16AM - 02 Aug 13 UTC") end it "includes number of files changed" do @@ -94,7 +94,7 @@ describe Onebox::Engine::GithubCommitOnebox do end it "includes commit time and date" do - expect(html).to include("02:03AM - 02 Aug 13") + expect(html).to include("02:16AM - 02 Aug 13 UTC") end it "includes number of files changed" do