Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-10-22 09:06:14 +00:00
parent fbeeb1478c
commit 76923eae4b
9 changed files with 114 additions and 7 deletions

View File

@ -44,6 +44,9 @@ module Metrics
# Inherits the primary logic from the parent class and
# maintains the service's API while including ReactiveCache
def calculate_reactive_cache(*)
# This is called with explicit parentheses to prevent
# the params passed to #calculate_reactive_cache from
# being passed to #get_dashboard (which accepts none)
::Metrics::Dashboard::BaseService
.instance_method(:get_dashboard)
.bind(self)

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class RenameDesignManagementVersionUserToAuthor < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
rename_column_concurrently :design_management_versions, :user_id, :author_id
end
def down
undo_rename_column_concurrently :design_management_versions, :user_id, :author_id
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddAuthorIndexToDesignManagementVersions < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :design_management_versions, :author_id, where: 'author_id IS NOT NULL'
end
def down
remove_concurrent_index :design_management_versions, :author_id
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class CleanupDesignManagementVersionUserToAuthorRename < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
cleanup_concurrent_column_rename :design_management_versions, :user_id, :author_id
end
def down
undo_cleanup_concurrent_column_rename :design_management_versions, :user_id, :author_id
end
end

View File

@ -1301,11 +1301,11 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do
create_table "design_management_versions", force: :cascade do |t|
t.binary "sha", null: false
t.bigint "issue_id"
t.integer "user_id"
t.datetime_with_timezone "created_at"
t.integer "author_id"
t.index ["author_id"], name: "index_design_management_versions_on_author_id", where: "(author_id IS NOT NULL)"
t.index ["issue_id"], name: "index_design_management_versions_on_issue_id"
t.index ["sha", "issue_id"], name: "index_design_management_versions_on_sha_and_issue_id", unique: true
t.index ["user_id"], name: "index_design_management_versions_on_user_id", where: "(user_id IS NOT NULL)"
end
create_table "draft_notes", force: :cascade do |t|
@ -4135,7 +4135,7 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do
add_foreign_key "design_management_designs_versions", "design_management_designs", column: "design_id", name: "fk_03c671965c", on_delete: :cascade
add_foreign_key "design_management_designs_versions", "design_management_versions", column: "version_id", name: "fk_f4d25ba00c", on_delete: :cascade
add_foreign_key "design_management_versions", "issues", on_delete: :cascade
add_foreign_key "design_management_versions", "users", name: "fk_ee16b939e5", on_delete: :nullify
add_foreign_key "design_management_versions", "users", column: "author_id", name: "fk_c1440b4896", on_delete: :nullify
add_foreign_key "draft_notes", "merge_requests", on_delete: :cascade
add_foreign_key "draft_notes", "users", column: "author_id", on_delete: :cascade
add_foreign_key "elasticsearch_indexed_namespaces", "namespaces", on_delete: :cascade

View File

@ -19,12 +19,25 @@ module Gitlab
user_email: "john@example.com",
user_avatar: "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
project_id: 15,
project: {
id: 15,
name: "gitlab",
description: "",
web_url: "http://test.example.com/gitlab/gitlab",
avatar_url: "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
git_ssh_url: "git@test.example.com:gitlab/gitlab.git",
git_http_url: "http://test.example.com/gitlab/gitlab.git",
namespace: "gitlab",
visibility_level: 0,
path_with_namespace: "gitlab/gitlab",
default_branch: "master"
},
commits: [
{
id: "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
message: "Add simple search to projects in public area",
timestamp: "2013-05-13T18:18:08+00:00",
url: "https://test.example.com/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428",
url: "https://test.example.com/gitlab/gitlab/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428",
author: {
name: "Test User",
email: "test@example.com"
@ -45,7 +58,20 @@ module Gitlab
# user_name: String,
# user_username: String,
# user_email: String
# project_id: String,
# project_id: Fixnum,
# project: {
# id: Fixnum,
# name: String,
# description: String,
# web_url: String,
# avatar_url: String,
# git_ssh_url: String,
# git_http_url: String,
# namespace: String,
# visibility_level: Fixnum,
# path_with_namespace: String,
# default_branch: String
# }
# repository: {
# name: String,
# url: String,

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
cd "$(dirname "$0")/.."
echo "=> Linting documents at path $(pwd) as $(whoami)..."
# Use long options (e.g. --header instead of -H) for curl examples in documentation.
echo '=> Checking for cURL short options...'
@ -25,7 +26,7 @@ fi
# Make sure no files in doc/ are executable
EXEC_PERM_COUNT=$(find doc/ -type f -perm 755 | wc -l)
echo '=> Checking for executable permissions...'
echo "=> Checking $(pwd)/doc for executable permissions..."
if [ "${EXEC_PERM_COUNT}" -ne 0 ]
then
echo '✖ ERROR: Executable permissions should not be used in documentation! Use `chmod 644` to the files in question:' >&2

View File

@ -57,6 +57,32 @@ describe Gitlab::DataBuilder::Push do
include_examples 'deprecated repository hook data'
end
describe '.sample_data' do
let(:data) { described_class.sample_data }
it { expect(data).to be_a(Hash) }
it { expect(data[:before]).to eq('95790bf891e76fee5e1747ab589903a6a1f80f22') }
it { expect(data[:after]).to eq('da1560886d4f094c3e6c9ef40349f7d38b5d27d7') }
it { expect(data[:ref]).to eq('refs/heads/master') }
it { expect(data[:project_id]).to eq(15) }
it { expect(data[:commits].size).to eq(1) }
it { expect(data[:total_commits_count]).to eq(1) }
it 'contains project data' do
expect(data[:project]).to be_a(Hash)
expect(data[:project][:id]).to eq(15)
expect(data[:project][:name]).to eq('gitlab')
expect(data[:project][:description]).to eq('')
expect(data[:project][:web_url]).to eq('http://test.example.com/gitlab/gitlab')
expect(data[:project][:avatar_url]).to eq('https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80')
expect(data[:project][:git_http_url]).to eq('http://test.example.com/gitlab/gitlab.git')
expect(data[:project][:git_ssh_url]).to eq('git@test.example.com:gitlab/gitlab.git')
expect(data[:project][:namespace]).to eq('gitlab')
expect(data[:project][:visibility_level]).to eq(0)
expect(data[:project][:path_with_namespace]).to eq('gitlab/gitlab')
expect(data[:project][:default_branch]).to eq('master')
end
end
describe '.build' do
let(:data) do
described_class.build(

View File

@ -752,4 +752,4 @@ DesignManagement::Version:
- created_at
- sha
- issue_id
- user_id
- author_id