summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG4
-rw-r--r--app/assets/images/authbuttons/gitlab_64.png_oldbin2878 -> 0 bytes
-rw-r--r--app/models/project_wiki.rb2
-rw-r--r--app/models/wiki_page.rb3
-rw-r--r--app/views/projects/new.html.haml6
-rw-r--r--doc/update/upgrader.md2
-rw-r--r--features/dashboard/new_project.feature13
-rw-r--r--features/steps/dashboard/new_project.rb27
-rw-r--r--lib/gitlab/bitbucket_import/client.rb4
-rw-r--r--lib/gitlab/github_import/client.rb2
-rw-r--r--lib/gitlab/gitlab_import/client.rb2
-rw-r--r--lib/gitlab/reference_extractor.rb8
-rw-r--r--spec/lib/gitlab/bitbucket_import/client_spec.rb17
-rw-r--r--spec/lib/gitlab/github_import/client_spec.rb16
-rw-r--r--spec/lib/gitlab/gitlab_import/client_spec.rb16
-rw-r--r--spec/lib/gitlab/reference_extractor_spec.rb20
-rw-r--r--spec/models/wiki_page_spec.rb41
17 files changed, 172 insertions, 11 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 517efae9f31..c8b2dd2ba77 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,12 @@
Please view this file on the master branch, on stable branches it's out of date.
v 7.10.0 (unreleased)
+ - Fix "Import projects from" button to show the correct instructions (Stan Hu)
+ - Fix dots in Wiki slugs causing errors (Stan Hu)
+ - Fix OAuth2 issue importing a new project from GitHub and GitLab (Stan Hu)
- Update poltergeist to version 1.6.0 to support PhantomJS 2.0 (Zeger-Jan van de Weg)
- Fix cross references when usernames, milestones, or project names contain underscores (Stan Hu)
+ - Disable reference creation for comments surrounded by code/preformatted blocks (Stan Hu)
- enable line wrapping per default and remove the checkbox to toggle it (Hannes Rosenögger)
- extend the commit calendar to show the actual commits made on a date (Hannes Rosenögger)
- Fix a link in the patch update guide
diff --git a/app/assets/images/authbuttons/gitlab_64.png_old b/app/assets/images/authbuttons/gitlab_64.png_old
deleted file mode 100644
index 8390c81a08b..00000000000
--- a/app/assets/images/authbuttons/gitlab_64.png_old
+++ /dev/null
Binary files differ
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 55438bee245..772c868d9cd 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -104,7 +104,7 @@ class ProjectWiki
def page_title_and_dir(title)
title_array = title.split("/")
title = title_array.pop
- [title.gsub(/\.[^.]*$/, ""), title_array.join("/")]
+ [title, title_array.join("/")]
end
def search_files(query)
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 32981a0e664..e9413c34bae 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -179,7 +179,8 @@ class WikiPage
if valid? && project_wiki.send(method, *args)
page_details = if method == :update_page
- @page.path
+ # Use url_path instead of path to omit format extension
+ @page.url_path
else
title
end
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 173a3080b31..9687c8ad87c 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -74,9 +74,9 @@
= f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
.alert.alert-info.prepend-top-10
%ul
- %li
+ %li
The repository must be accessible over HTTP(S). If it is not publicly accessible, you can add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.
- %li
+ %li
The import will time out after 4 minutes. For big repositories, use a clone/push combination.
%li
To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"}.
@@ -112,6 +112,6 @@
$ ->
$('.how_to_import_link').bind 'click', (e) ->
e.preventDefault()
- import_modal = $(this).parent().find(".modal").show()
+ import_modal = $(this).next(".modal").show()
$('.modal-header .close').bind 'click', ->
$(".modal").hide()
diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md
index d8476fb3457..f62a53d3340 100644
--- a/doc/update/upgrader.md
+++ b/doc/update/upgrader.md
@@ -24,7 +24,7 @@ If you have local changes to your GitLab repository the script will stash them a
## 2. Run GitLab upgrade tool
-Note: GitLab 7.9 adds nodejs as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies)
+Note: GitLab 7.9 adds `nodejs` as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies)
# Starting with GitLab version 7.0 upgrader script has been moved to bin directory
cd /home/git/gitlab
diff --git a/features/dashboard/new_project.feature b/features/dashboard/new_project.feature
new file mode 100644
index 00000000000..431dc4ccfcb
--- /dev/null
+++ b/features/dashboard/new_project.feature
@@ -0,0 +1,13 @@
+@dashboard
+Feature: New Project
+Background:
+ Given I sign in as a user
+ And I own project "Shop"
+ And I visit dashboard page
+
+ @javascript
+ Scenario: I should see New projects page
+ Given I click "New project" link
+ Then I see "New project" page
+ When I click on "Import project from GitHub"
+ Then I see instructions on how to import from GitHub
diff --git a/features/steps/dashboard/new_project.rb b/features/steps/dashboard/new_project.rb
new file mode 100644
index 00000000000..5e588ceb780
--- /dev/null
+++ b/features/steps/dashboard/new_project.rb
@@ -0,0 +1,27 @@
+class Spinach::Features::NewProject < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+
+ step 'I click "New project" link' do
+ click_link "New project"
+ end
+
+ step 'I see "New project" page' do
+ page.should have_content("Project path")
+ end
+
+ step 'I click on "Import project from GitHub"' do
+ first('.how_to_import_link').click
+ end
+
+ step 'I see instructions on how to import from GitHub' do
+ github_modal = first('.modal-body')
+ github_modal.should be_visible
+ github_modal.should have_content "To enable importing projects from GitHub"
+
+ all('.modal-body').each do |element|
+ element.should_not be_visible unless element == github_modal
+ end
+ end
+end
diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb
index 1e4906c9e31..5b1952b9675 100644
--- a/lib/gitlab/bitbucket_import/client.rb
+++ b/lib/gitlab/bitbucket_import/client.rb
@@ -62,7 +62,7 @@ module Gitlab
end
def find_deploy_key(project_identifier, key)
- JSON.parse(api.get("/api/1.0/repositories/#{project_identifier}/deploy-keys").body).find do |deploy_key|
+ JSON.parse(api.get("/api/1.0/repositories/#{project_identifier}/deploy-keys").body).find do |deploy_key|
deploy_key["key"].chomp == key.chomp
end
end
@@ -92,7 +92,7 @@ module Gitlab
end
def bitbucket_options
- OmniAuth::Strategies::Bitbucket.default_options[:client_options].dup
+ OmniAuth::Strategies::Bitbucket.default_options[:client_options].symbolize_keys
end
end
end
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb
index 7fe076b333b..270cbcd9ccd 100644
--- a/lib/gitlab/github_import/client.rb
+++ b/lib/gitlab/github_import/client.rb
@@ -46,7 +46,7 @@ module Gitlab
end
def github_options
- OmniAuth::Strategies::GitHub.default_options[:client_options].dup
+ OmniAuth::Strategies::GitHub.default_options[:client_options].symbolize_keys
end
end
end
diff --git a/lib/gitlab/gitlab_import/client.rb b/lib/gitlab/gitlab_import/client.rb
index 2236439c6ce..f48ede9d067 100644
--- a/lib/gitlab/gitlab_import/client.rb
+++ b/lib/gitlab/gitlab_import/client.rb
@@ -71,7 +71,7 @@ module Gitlab
end
def gitlab_options
- OmniAuth::Strategies::GitLab.default_options[:client_options].dup
+ OmniAuth::Strategies::GitLab.default_options[:client_options].symbolize_keys
end
end
end
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index 5b9772de168..1058d4c43d9 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -11,7 +11,13 @@ module Gitlab
end
def analyze(string, project)
- parse_references(string.dup, project)
+ text = string.dup
+
+ # Remove preformatted/code blocks so that references are not included
+ text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}m) { |match| '' }
+ text.gsub!(%r{^```.*?^```}m) { |match| '' }
+
+ parse_references(text, project)
end
# Given a valid project, resolve the extracted identifiers of the requested type to
diff --git a/spec/lib/gitlab/bitbucket_import/client_spec.rb b/spec/lib/gitlab/bitbucket_import/client_spec.rb
new file mode 100644
index 00000000000..dd450e9967b
--- /dev/null
+++ b/spec/lib/gitlab/bitbucket_import/client_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe Gitlab::BitbucketImport::Client do
+ let(:token) { '123456' }
+ let(:secret) { 'secret' }
+ let(:client) { Gitlab::BitbucketImport::Client.new(token, secret) }
+
+ before do
+ Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "bitbucket")
+ end
+
+ it 'all OAuth client options are symbols' do
+ client.consumer.options.keys.each do |key|
+ expect(key).to be_kind_of(Symbol)
+ end
+ end
+end
diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb
new file mode 100644
index 00000000000..26618120316
--- /dev/null
+++ b/spec/lib/gitlab/github_import/client_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+describe Gitlab::GithubImport::Client do
+ let(:token) { '123456' }
+ let(:client) { Gitlab::GithubImport::Client.new(token) }
+
+ before do
+ Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github")
+ end
+
+ it 'all OAuth2 client options are symbols' do
+ client.client.options.keys.each do |key|
+ expect(key).to be_kind_of(Symbol)
+ end
+ end
+end
diff --git a/spec/lib/gitlab/gitlab_import/client_spec.rb b/spec/lib/gitlab/gitlab_import/client_spec.rb
new file mode 100644
index 00000000000..c511c515474
--- /dev/null
+++ b/spec/lib/gitlab/gitlab_import/client_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+describe Gitlab::GitlabImport::Client do
+ let(:token) { '123456' }
+ let(:client) { Gitlab::GitlabImport::Client.new(token) }
+
+ before do
+ Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "gitlab")
+ end
+
+ it 'all OAuth2 client options are symbols' do
+ client.client.options.keys.each do |key|
+ expect(key).to be_kind_of(Symbol)
+ end
+ end
+end
diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb
index 5ebe44f6fb7..b3f4bb5aeda 100644
--- a/spec/lib/gitlab/reference_extractor_spec.rb
+++ b/spec/lib/gitlab/reference_extractor_spec.rb
@@ -50,6 +50,26 @@ describe Gitlab::ReferenceExtractor do
expect(text).to eq('issue #123 is just the worst, @user')
end
+ it 'extracts no references for <pre>..</pre> blocks' do
+ subject.analyze("<pre>def puts '#1 issue'\nend\n</pre>```", nil)
+ expect(subject.issues).to be_blank
+ end
+
+ it 'extracts no references for <code>..</code> blocks' do
+ subject.analyze("<code>def puts '!1 request'\nend\n</code>```", nil)
+ expect(subject.merge_requests).to be_blank
+ end
+
+ it 'extracts no references for code blocks with language' do
+ subject.analyze("this code:\n```ruby\ndef puts '#1 issue'\nend\n```", nil)
+ expect(subject.issues).to be_blank
+ end
+
+ it 'extracts issue references for invalid code blocks' do
+ subject.analyze('test: ```this one talks about issue #1234```', nil)
+ expect(subject.issues).to eq([{ project: nil, id: '1234' }])
+ end
+
it 'handles all possible kinds of references' do
accessors = Gitlab::Markdown::TYPES.map { |t| "#{t}s".to_sym }
expect(subject).to respond_to(*accessors)
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index f3fd805783f..fceb7668cac 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -78,6 +78,47 @@ describe WikiPage do
end
end
+ describe "dot in the title" do
+ let(:title) { 'Index v1.2.3' }
+
+ before do
+ @wiki_attr = {title: title, content: "Home Page", format: "markdown"}
+ end
+
+ describe "#create" do
+ after do
+ destroy_page(title)
+ end
+
+ context "with valid attributes" do
+ it "saves the wiki page" do
+ subject.create(@wiki_attr)
+ expect(wiki.find_page(title)).not_to be_nil
+ end
+
+ it "returns true" do
+ expect(subject.create(@wiki_attr)).to eq(true)
+ end
+ end
+ end
+
+ describe "#update" do
+ before do
+ create_page(title, "content")
+ @page = wiki.find_page(title)
+ end
+
+ it "updates the content of the page" do
+ @page.update("new content")
+ @page = wiki.find_page(title)
+ end
+
+ it "returns true" do
+ expect(@page.update("more content")).to be_truthy
+ end
+ end
+ end
+
describe "#update" do
before do
create_page("Update", "content")