Commit 52a583c1 authored by Rémy Coutable's avatar Rémy Coutable 🔴

Merge branch 'show_push_widget_in_upstream' into 'master'

Show last push widget in upstream after push to fork

## What does this MR do?

Show the last push widget in the upstream project when you push to a fork. 

## Are there points in the code the reviewer needs to double check?

In the view, I'm checking if `@Project` in the first part of the conditional. I felt it was necessary in case `@Project` wasn't an object in all cases. Will it ever not be there? Is this check necessary?

Should there be tests? I don't see existing ones for this. 

## Why was this MR needed?

I use the fork workflow everywhere and it has annoyed me for some time that the last push widget doesn't show up when viewing the upstream project. I'm almost never viewing the fork in GitLab so I want to be able to easily create a MR in any case. 

## Screenshots (if relevant)

**Widget in upstream repo:**

![Screen_Shot_2016-06-23_at_10.05.29_AM](/uploads/f823642e40cf059c3793db6cf00bba50/Screen_Shot_2016-06-23_at_10.05.29_AM.png)

**Widget in fork**:

![Screen_Shot_2016-06-23_at_10.05.25_AM](/uploads/1a976241186ec42cdc43c80bea0c856b/Screen_Shot_2016-06-23_at_10.05.25_AM.png)

**Widget on dashboard**:

![Screen_Shot_2016-06-23_at_10.06.07_AM](/uploads/084ac35f67735aec8042d9bc904255fe/Screen_Shot_2016-06-23_at_10.06.07_AM.png)


See merge request !4880
parents 9b75da80 0b34cac1
Pipeline #3661487 passed with stages
in 1233 minutes and 10 seconds
......@@ -29,6 +29,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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment