Commit 369275d6 authored by Stan Hu's avatar Stan Hu

Fix network graph when branch name has single quotes

Closes https://github.com/gitlabhq/gitlabhq/issues/9500
parent 82f0d3e6
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased) v 7.14.0 (unreleased)
- Fix network graph when branch name has single quotes (Stan Hu)
- Upgrade gitlab_git to version 7.2.6 to fix Error 500 when creating network graphs (Stan Hu) - Upgrade gitlab_git to version 7.2.6 to fix Error 500 when creating network graphs (Stan Hu)
- Fix URL used for refreshing notes if relative_url is present (Bartłomiej Święcki) - Fix URL used for refreshing notes if relative_url is present (Bartłomiej Święcki)
- Fix commit data retrieval when branch name has single quotes (Stan Hu) - Fix commit data retrieval when branch name has single quotes (Stan Hu)
......
...@@ -7,6 +7,10 @@ class Projects::NetworkController < Projects::ApplicationController ...@@ -7,6 +7,10 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :authorize_download_code! before_action :authorize_download_code!
def show def show
@url = namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json))
@commit_url = namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s")
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
:javascript :javascript
network_graph = new Network({ network_graph = new Network({
url: '#{namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json))}', url: "#{escape_javascript(@url)}",
commit_url: '#{namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s")}', commit_url: "#{escape_javascript(@commit_url)}",
ref: '#{@ref}', ref: "#{escape_javascript(@ref)}",
commit_id: '#{@commit.id}' commit_id: '#{@commit.id}'
}) })
new ShortcutsNetwork(network_graph.branch_graph) new ShortcutsNetwork(network_graph.branch_graph)
...@@ -10,6 +10,11 @@ Feature: Project Network Graph ...@@ -10,6 +10,11 @@ Feature: Project Network Graph
And page should select "master" in select box And page should select "master" in select box
And page should have "master" on graph And page should have "master" on graph
@javascript
Scenario: I should see project network with 'test' branch
When I visit project network page on branch 'test'
Then page should have 'test' on graph
@javascript @javascript
Scenario: I should switch "branch" and "tag" Scenario: I should switch "branch" and "tag"
When I switch ref to "feature" When I switch ref to "feature"
......
...@@ -11,8 +11,12 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -11,8 +11,12 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
# Stub Graph max_size to speed up test (10 commits vs. 650) # Stub Graph max_size to speed up test (10 commits vs. 650)
Network::Graph.stub(max_count: 10) Network::Graph.stub(max_count: 10)
project = Project.find_by(name: "Shop") @project = Project.find_by(name: "Shop")
visit namespace_project_network_path(project.namespace, project, "master") visit namespace_project_network_path(@project.namespace, @project, "master")
end
step "I visit project network page on branch 'test'" do
visit namespace_project_network_path(@project.namespace, @project, "'test'")
end end
step 'page should select "master" in select box' do step 'page should select "master" in select box' do
...@@ -29,6 +33,12 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -29,6 +33,12 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end end
end end
step "page should have 'test' on graph" do
page.within '.network-graph' do
expect(page).to have_content "'test'"
end
end
When 'I switch ref to "feature"' do When 'I switch ref to "feature"' do
select 'feature', from: 'ref' select 'feature', from: 'ref'
sleep 2 sleep 2
......
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