Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-07-07 08:22:35 +0300
committerRémy Coutable <remy@rymai.me>2016-07-07 08:22:35 +0300
commit52a583c120686329d931e99035756996264a26c3 (patch)
tree868f4d06a46f6f9ee88301b32fd900455a5e4972 /app
parent9b75da80259c7a3bb410d601fea1e9c45c427a33 (diff)
parent0b34cac1c5f0115b7ea6ed0e1e08b57ee22671cd (diff)
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
Diffstat (limited to 'app')
-rw-r--r--app/helpers/projects_helper.rb6
-rw-r--r--app/views/projects/_last_push.html.haml4
2 files changed, 8 insertions, 2 deletions
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