From 0b34cac1c5f0115b7ea6ed0e1e08b57ee22671cd Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Thu, 23 Jun 2016 09:36:24 -0500 Subject: [PATCH] Show last push widget in upstream after push to fork --- CHANGELOG | 1 + app/helpers/projects_helper.rb | 6 +++++- app/views/projects/_last_push.html.haml | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1350317ad64..232685bd9a0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,6 +28,7 @@ v 8.10.0 (unreleased) - PipelinesFinder uses git cache data - Throttle the update of `project.pushes_since_gc` to 1 minute. - Check for conflicts with existing Project's wiki path when creating a new project. + - Show last push widget in upstream after push to fork - Don't instantiate a git tree on Projects show default view - Bump Rinku to 2.0.0 - Remove unused front-end variable -> default_issues_tracker diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 88787576dd3..3bbbb26cff2 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -293,7 +293,11 @@ module ProjectsHelper end def last_push_event - if current_user + return unless current_user + + if fork = current_user.fork_of(@project) + current_user.recent_push(fork.id) + else current_user.recent_push(@project.id) end end diff --git a/app/views/projects/_last_push.html.haml b/app/views/projects/_last_push.html.haml index 434d8644b83..3c6b931f41a 100644 --- a/app/views/projects/_last_push.html.haml +++ b/app/views/projects/_last_push.html.haml @@ -7,7 +7,9 @@ %span You pushed to = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do %strong= event.ref_name - branch + - if @project && event.project != @project + %span at + %strong= link_to_project event.project #{time_ago_with_tooltip(event.created_at)} .pull-right