From 178f4e1e16b41f8e5992f484fdd6465090c55a08 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Tue, 3 Oct 2017 19:41:37 +0200 Subject: [PATCH] Show fork information on the project panel --- app/views/projects/_home_panel.html.haml | 14 +++-- locale/gitlab.pot | 78 +++++++++++++++++++++++- spec/features/projects_spec.rb | 49 +++++++++++++++ 3 files changed, 135 insertions(+), 6 deletions(-) diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 873b3045ea9..619b632918e 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -1,4 +1,6 @@ - empty_repo = @project.empty_repo? +- fork_network = @project.fork_network +- forked_from_project = @project.forked_from_project || fork_network&.root_project .project-home-panel.text-center{ class: ("empty-project" if empty_repo) } .limit-container-width{ class: container_class } .avatar-container.s70.project-avatar @@ -12,11 +14,15 @@ - if @project.description.present? = markdown_field(@project, :description) - - if forked_from_project = @project.forked_from_project + - if @project.forked? %p - #{ s_('ForkedFromProjectPath|Forked from') } - = link_to project_path(forked_from_project) do - = forked_from_project.namespace.try(:name) + - if forked_from_project + #{ s_('ForkedFromProjectPath|Forked from') } + = link_to project_path(forked_from_project) do + = forked_from_project.full_name + - else + - deleted_message = s_('ForkedFromProjectPath|Forked from %{project_name} (deleted)') + = deleted_message % { project_name: fork_network.deleted_root_project_name } .project-repo-buttons .count-buttons diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 7569af9d175..c73e582e608 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-04 23:47+0100\n" -"PO-Revision-Date: 2017-10-04 23:47+0100\n" +"POT-Creation-Date: 2017-10-06 18:33+0200\n" +"PO-Revision-Date: 2017-10-06 18:33+0200\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -23,6 +23,11 @@ msgid_plural "%d commits" msgstr[0] "" msgstr[1] "" +msgid "%d layer" +msgid_plural "%d layers" +msgstr[0] "" +msgstr[1] "" + msgid "%s additional commit has been omitted to prevent performance issues." msgid_plural "%s additional commits have been omitted to prevent performance issues." msgstr[0] "" @@ -59,6 +64,9 @@ msgstr[1] "" msgid "1st contribution!" msgstr "" +msgid "2FA enabled" +msgstr "" + msgid "A collection of graphs regarding Continuous Integration" msgstr "" @@ -528,6 +536,51 @@ msgstr "" msgid "Compare" msgstr "" +msgid "Container Registry" +msgstr "" + +msgid "ContainerRegistry|Created" +msgstr "" + +msgid "ContainerRegistry|First log in to GitLab’s Container Registry using your GitLab username and password. If you have %{link_2fa} you need to use a %{link_token}:" +msgstr "" + +msgid "ContainerRegistry|GitLab supports up to 3 levels of image names. The following examples of images are valid for your project:" +msgstr "" + +msgid "ContainerRegistry|How to use the Container Registry" +msgstr "" + +msgid "ContainerRegistry|Learn more about" +msgstr "" + +msgid "ContainerRegistry|No tags in Container Registry for this container image." +msgstr "" + +msgid "ContainerRegistry|Once you log in, you’re free to create and upload a container image using the common %{build} and %{push} commands" +msgstr "" + +msgid "ContainerRegistry|Remove repository" +msgstr "" + +msgid "ContainerRegistry|Remove tag" +msgstr "" + +msgid "ContainerRegistry|Size" +msgstr "" + +msgid "ContainerRegistry|Tag" +msgstr "" + +msgid "ContainerRegistry|Tag ID" +msgstr "" + +msgid "ContainerRegistry|Use different image names" +msgstr "" + +msgid "ContainerRegistry|With the Docker Container Registry integrated into GitLab, every project can have its own space to store its Docker images." +msgstr "" + msgid "Contribution guide" msgstr "" @@ -739,6 +792,9 @@ msgstr[1] "" msgid "ForkedFromProjectPath|Forked from" msgstr "" +msgid "ForkedFromProjectPath|Forked from %{project_name} (deleted)" +msgstr "" + msgid "Format" msgstr "" @@ -949,6 +1005,9 @@ msgstr "" msgid "New tag" msgstr "" +msgid "No container images stored for this project. Add one by following the instructions above." +msgstr "" + msgid "No repository" msgstr "" @@ -1024,6 +1083,9 @@ msgstr "" msgid "OpenedNDaysAgo|Opened" msgstr "" +msgid "Opens in a new window" +msgstr "" + msgid "Options" msgstr "" @@ -1350,6 +1412,15 @@ msgstr[1] "" msgid "Snippets" msgstr "" +msgid "Something went wrong on our end." +msgstr "" + +msgid "Something went wrong while fetching the projects." +msgstr "" + +msgid "Something went wrong while fetching the registry list." +msgstr "" + msgid "SortOptions|Access level, ascending" msgstr "" @@ -1905,3 +1976,6 @@ msgid "parent" msgid_plural "parents" msgstr[0] "" msgstr[1] "" + +msgid "personal access token" +msgstr "" diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index b957575a244..4b2c54d54b5 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -77,6 +77,55 @@ feature 'Project' do end end + describe 'showing information about source of a project fork' do + let(:user) { create(:user) } + let(:base_project) { create(:project, :public, :repository) } + let(:forked_project) { fork_project(base_project, user, repository: true) } + + before do + sign_in user + end + + it 'shows a link to the source project when it is available' do + visit project_path(forked_project) + + expect(page).to have_content('Forked from') + expect(page).to have_link(base_project.full_name) + end + + it 'does not contain fork network information for the root project' do + forked_project + + visit project_path(base_project) + + expect(page).not_to have_content('In fork network of') + expect(page).not_to have_content('Forked from') + end + + it 'shows the name of the deleted project when the source was deleted' do + forked_project + Projects::DestroyService.new(base_project, base_project.owner).execute + + visit project_path(forked_project) + + expect(page).to have_content("Forked from #{base_project.full_name} (deleted)") + end + + context 'a fork of a fork' do + let(:fork_of_fork) { fork_project(forked_project, user, repository: true) } + + it 'links to the base project if the source project is removed' do + fork_of_fork + Projects::DestroyService.new(forked_project, user).execute + + visit project_path(fork_of_fork) + + expect(page).to have_content("Forked from") + expect(page).to have_link(base_project.full_name) + end + end + end + describe 'removal', js: true do let(:user) { create(:user, username: 'test', name: 'test') } let(:project) { create(:project, namespace: user.namespace, name: 'project1') }