diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-07 05:22:35 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-07 05:22:35 +0000 |
commit | 52a583c120686329d931e99035756996264a26c3 (patch) | |
tree | 868f4d06a46f6f9ee88301b32fd900455a5e4972 | |
parent | 9b75da80259c7a3bb410d601fea1e9c45c427a33 (diff) | |
parent | 0b34cac1c5f0115b7ea6ed0e1e08b57ee22671cd (diff) | |
download | gitlab-ce-52a583c120686329d931e99035756996264a26c3.tar.gz |
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
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 6 | ||||
-rw-r--r-- | app/views/projects/_last_push.html.haml | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG index ae094620bf6..de5f1e8cda7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 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 |