Commit ed3bd155 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' of github.com:gitlabhq/gitlabhq

parents 70e3409a 4e5bc1d5
Pipeline #3739 passed with stage
......@@ -10,6 +10,7 @@ v 7.9.0 (unreleased)
- Save web edit in new branch
- Fix ordering of imported but unchanged projects (Marco Wessel)
- Mobile UI improvements: make aside content expandable
- Expose avatar_url in projects API
- Generalize image upload in drag and drop in markdown to all files (Hannes Rosenögger)
- Fix mass-unassignment of issues (Robert Speicher)
- Allow user confirmation to be skipped for new users via API
......
......@@ -617,7 +617,7 @@ GEM
raindrops (~> 0.7)
unicorn-worker-killer (0.4.2)
unicorn (~> 4)
version_sorter (1.1.0)
version_sorter (2.0.0)
virtus (1.0.1)
axiom-types (~> 0.0.5)
coercible (~> 1.0)
......
......@@ -58,10 +58,8 @@ module ApplicationHelper
Project.find_with_namespace(project_id)
end
if project.avatar.present?
image_tag project.avatar.url, options
elsif project.avatar_in_git
image_tag namespace_project_avatar_path(project.namespace, project), options
if project.avatar_url
image_tag project.avatar_url, options
else # generated icon
project_identicon(project, options)
end
......
......@@ -37,6 +37,8 @@ class Project < ActiveRecord::Base
include Gitlab::ShellAdapter
include Gitlab::VisibilityLevel
include Gitlab::ConfigHelper
include Rails.application.routes.url_helpers
extend Gitlab::ConfigHelper
extend Enumerize
......@@ -408,6 +410,14 @@ class Project < ActiveRecord::Base
@avatar_file
end
def avatar_url
if avatar.present?
[gitlab_config.url, avatar.url].join
elsif avatar_in_git
[gitlab_config.url, namespace_project_avatar_path(namespace, self)].join
end
end
# For compatibility with old code
def code
path
......
......@@ -6,7 +6,7 @@
%tr
%th
%th Service
%th Desription
%th Description
%th Last edit
- @services.sort_by(&:title).each do |service|
%tr
......
......@@ -6,7 +6,7 @@
%tr
%th
%th Service
%th Desription
%th Description
%th Last edit
- @services.sort_by(&:title).each do |service|
%tr
......
......@@ -208,7 +208,7 @@ If an error occurs, an error number and a message explaining the reason is retur
## Delete existing issue (**Deprecated**)
The function is deprecated and returns a `405 Method Not Allowed` error if called. An issue gets now closed and is done by calling `PUT /projects/:id/issues/:issue_id` with parameter `closed` set to 1.
The function is deprecated and returns a `405 Method Not Allowed` error if called. An issue gets now closed and is done by calling `PUT /projects/:id/issues/:issue_id` with parameter `state_event` set to `close`.
```
DELETE /projects/:id/issues/:issue_id
......
......@@ -68,7 +68,8 @@ Parameters:
"path": "diaspora",
"updated_at": "2013-09-30T13: 46: 02Z"
},
"archived": false
"archived": false,
"avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png"
},
{
"id": 6,
......@@ -103,7 +104,8 @@ Parameters:
"path": "brightbox",
"updated_at": "2013-09-30T13:46:02Z"
},
"archived": false
"archived": false,
"avatar_url": null
}
]
```
......@@ -195,7 +197,8 @@ Parameters:
"notification_level": 3
}
},
"archived": false
"archived": false,
"avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png"
}
```
......
......@@ -15,24 +15,21 @@ Parameters:
```json
[
{
"name": "v1.0.0",
"commit": {
"author_name": "John Smith",
"author_email": "john@example.com",
"authored_date": "2012-05-28T04:42:42-07:00",
"committed_date": "2012-05-28T04:42:42-07:00",
"committer_name": "Jack Smith",
"committer_email": "jack@example.com",
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"parents": [],
"tree": "38017f2f189336fe4497e9d230c5bb1bf873f08d",
"message": "Initial commit",
"author": {
"name": "John Smith",
"email": "john@example.com"
},
"committer": {
"name": "Jack Smith",
"email": "jack@example.com"
},
"authored_date": "2012-05-28T04:42:42-07:00",
"committed_date": "2012-05-28T04:42:42-07:00"
"parents_ids": [
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
]
},
"protected": null
"name": "v1.0.0",
"message": null
}
]
```
......@@ -53,23 +50,23 @@ Parameters:
- `message` (optional) - Creates annotated tag.
```json
[
{
"name": "v1.0.0",
"message": "Release 1.0.0",
"commit": {
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"parents": [],
"message": "Initial commit",
"authored_date": "2012-05-28T04:42:42-07:00",
"author_name": "John Smith",
"author email": "john@example.com",
"committer_name": "Jack Smith",
"committed_date": "2012-05-28T04:42:42-07:00",
"committer_email": "jack@example.com"
},
}
]
{
"commit": {
"author_name": "John Smith",
"author_email": "john@example.com",
"authored_date": "2012-05-28T04:42:42-07:00",
"committed_date": "2012-05-28T04:42:42-07:00",
"committer_name": "Jack Smith",
"committer_email": "jack@example.com",
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"message": "Initial commit",
"parents_ids": [
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
]
},
"name": "v1.0.0",
"message": null
}
```
The message will be `nil` when creating a lightweight tag otherwise
it will contain the annotation.
......
......@@ -12,7 +12,7 @@ sudo service gitlab stop
# Update /home/git/gitlab/config/database.yml
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
cd mysql-postgresql-converter
mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production -p
python db_converter.py databasename.mysql databasename.psql
......@@ -39,7 +39,7 @@ On non-omnibus installations (distributed using Git) we retrieve the index decla
```
# Clone the database converter on your Postgres-backed GitLab server
cd /tmp
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
cd /home/git/gitlab
......@@ -60,7 +60,7 @@ On omnibus-gitlab we need to get the index declarations from a file called `sche
```
# Clone the database converter on your Postgres-backed GitLab server
cd /tmp
/opt/gitlab/embedded/bin/git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
/opt/gitlab/embedded/bin/git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
cd /tmp/mysql-postgresql-converter
# Download schema.rb.bundled if necessary
......@@ -76,7 +76,7 @@ test -e /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled || sudo /
## Converting a GitLab backup file from MySQL to Postgres
**Note:** Please make sure to have Python 2.7.x (or higher) installed.
GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using the lanyrd database converter we can replace a MySQL database dump inside the tar file with a Postgres database dump. This can be useful if you are moving to another server.
GitLab backup files (`<timestamp>_gitlab_backup.tar`) contain a SQL dump. Using the lanyrd database converter we can replace a MySQL database dump inside the tar file with a Postgres database dump. This can be useful if you are moving to another server.
```
# Stop GitLab
......@@ -98,7 +98,7 @@ cd tmp/backups/postgresql
sudo -u git -H mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production -p
# Clone the database converter
sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
# Convert gitlabhq_production.mysql
sudo -u git -H mkdir db
......
......@@ -11,7 +11,7 @@ RUN apt-get update -q \
# If the Omnibus package version below is outdated please contribute a merge request to update it.
# If you run GitLab Enterprise Edition point it to a location where you have downloaded it.
RUN TMP_FILE=$(mktemp); \
wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.8.0-omnibus-1_amd64.deb \
wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.8.1-omnibus-1_amd64.deb \
&& dpkg -i $TMP_FILE \
&& rm -f $TMP_FILE
......
......@@ -56,6 +56,7 @@ module API
expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :snippets_enabled, :created_at, :last_activity_at
expose :namespace
expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ | project, options | project.forked? }
expose :avatar_url
end
class ProjectMember < UserBasic
......
......@@ -64,8 +64,9 @@ describe ApplicationHelper do
project = create(:project)
project.avatar = File.open(avatar_file_path)
project.save!
avatar_url = "http://localhost/uploads/project/avatar/#{ project.id }/gitlab_logo.png"
expect(project_icon("#{project.namespace.to_param}/#{project.to_param}").to_s).to eq(
"<img alt=\"Gitlab logo\" src=\"/uploads/project/avatar/#{ project.id }/gitlab_logo.png\" />"
"<img alt=\"Gitlab logo\" src=\"#{avatar_url}\" />"
)
end
......@@ -75,8 +76,9 @@ describe ApplicationHelper do
allow_any_instance_of(Project).to receive(:avatar_in_git).and_return(true)
avatar_url = 'http://localhost' + namespace_project_avatar_path(project.namespace, project)
expect(project_icon("#{project.namespace.to_param}/#{project.to_param}").to_s).to match(
image_tag(namespace_project_avatar_path(project.namespace, project)))
image_tag(avatar_url))
end
end
......@@ -192,10 +194,12 @@ describe ApplicationHelper do
it 'sorts tags in a natural order' do
# Stub repository.tag_names to make sure we get some valid testing data
expect(@project.repository).to receive(:tag_names).
and_return(['v1.0.9', 'v1.0.10', 'v2.0', 'v3.1.4.2', 'v1.0.9a'])
and_return(['v1.0.9', 'v1.0.10', 'v2.0', 'v3.1.4.2', 'v2.0rc1¿',
'v1.0.9a', 'v2.0-rc1', 'v2.0rc2'])
expect(options[1][1]).
to eq(['v3.1.4.2', 'v2.0', 'v1.0.10', 'v1.0.9a', 'v1.0.9'])
to eq(['v3.1.4.2', 'v2.0', 'v2.0rc2', 'v2.0rc1¿', 'v2.0-rc1', 'v1.0.10',
'v1.0.9', 'v1.0.9a'])
end
end
......
......@@ -326,4 +326,35 @@ describe Project do
expect(project.avatar_type).to eq(['only images allowed'])
end
end
describe :avatar_url do
subject { project.avatar_url }
let(:project) { create(:project) }
context 'When avatar file is uploaded' do
before do
project.update_columns(avatar: 'uploads/avatar.png')
allow(project.avatar).to receive(:present?) { true }
end
let(:avatar_path) do
"/uploads/project/avatar/#{project.id}/uploads/avatar.png"
end
it { should eq "http://localhost#{avatar_path}" }
end
context 'When avatar file in git' do
before do
allow(project).to receive(:avatar_in_git) { true }
end
let(:avatar_path) do
"/#{project.namespace.name}/#{project.path}/avatar"
end
it { should eq "http://localhost#{avatar_path}" }
end
end
end
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