Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-09-20 21:11:31 +00:00
parent 813226e2ba
commit cfd505b198
8 changed files with 55 additions and 14 deletions

View File

@ -7,6 +7,7 @@ import {
GlLoadingIcon, GlLoadingIcon,
GlIcon, GlIcon,
GlHoverLoadDirective, GlHoverLoadDirective,
GlSafeHtmlDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { escapeRegExp } from 'lodash'; import { escapeRegExp } from 'lodash';
import filesQuery from 'shared_queries/repository/files.query.graphql'; import filesQuery from 'shared_queries/repository/files.query.graphql';
@ -33,6 +34,7 @@ export default {
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
GlHoverLoad: GlHoverLoadDirective, GlHoverLoad: GlHoverLoadDirective,
SafeHtml: GlSafeHtmlDirective,
}, },
apollo: { apollo: {
commit: { commit: {
@ -178,6 +180,7 @@ export default {
this.$apollo.query({ query, variables }); this.$apollo.query({ query, variables });
}, },
}, },
safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] },
}; };
</script> </script>
@ -228,10 +231,10 @@ export default {
<td class="d-none d-sm-table-cell tree-commit cursor-default"> <td class="d-none d-sm-table-cell tree-commit cursor-default">
<gl-link <gl-link
v-if="commit" v-if="commit"
v-safe-html:[$options.safeHtmlConfig]="commit.titleHtml"
:href="commit.commitPath" :href="commit.commitPath"
:title="commit.message" :title="commit.message"
class="str-truncated-100 tree-commit-link" class="str-truncated-100 tree-commit-link"
v-html="commit.titleHtml /* eslint-disable-line vue/no-v-html */"
/> />
<gl-skeleton-loading v-else :lines="1" class="h-auto" /> <gl-skeleton-loading v-else :lines="1" class="h-auto" />
</td> </td>

View File

@ -76,7 +76,8 @@ required number of seconds.
"email": { "type": "string" }, "email": { "type": "string" },
"created_at": { "type": ["string", "null"], "format": "date-time" }, "created_at": { "type": ["string", "null"], "format": "date-time" },
"current_sign_in_ip": { "type": ["string", "null"] }, "current_sign_in_ip": { "type": ["string", "null"] },
"last_sign_in_ip": { "type": ["string", "null"] } "last_sign_in_ip": { "type": ["string", "null"] },
"sign_in_count": { "type": "integer" }
} }
}, },
"pipeline": { "pipeline": {

View File

@ -279,3 +279,29 @@ reduce the repository size for another import attempt.
its [default branch](../repository/branches/default.md), and its [default branch](../repository/branches/default.md), and
delete the temporary, `smaller-tmp-main` branch, and delete the temporary, `smaller-tmp-main` branch, and
the local, temporary data. the local, temporary data.
### Manually execute export steps
Exports sometimes fail without giving enough information to troubleshoot. In these cases, it can be
helpful to [execute the export process manually within rails](https://gitlab.com/gitlab-com/runbooks/-/blob/master/docs/uncategorized/project-export.md#export-a-project-via-rails-console).
Execute each line individually, rather than pasting the entire block at once, so you can see any
errors each command returns.
```shell
u = User.find_by_username('someuser')
p = Project.find_by_full_path('some/project')
e = Projects::ImportExport::ExportService.new(p,u)
e.send(:version_saver).send(:save)
e.send(:avatar_saver).send(:save)
e.send(:project_tree_saver).send(:save)
e.send(:uploads_saver).send(:save)
e.send(:wiki_repo_saver).send(:save)
e.send(:lfs_saver).send(:save)
e.send(:snippets_repo_saver).send(:save)
e.send(:design_repo_saver).send(:save)
s = Gitlab::ImportExport::Saver.new(exportable: p, shared:p.import_export_shared)
s.send(:compress_and_save)
s.send(:save_upload)
```

View File

@ -3,9 +3,7 @@
# See https://docs.gitlab.com/ee/development/migration_style_guide.html # See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab. # for more information on how to write migrations for GitLab.
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] class <%= migration_class_name %> < Gitlab::Database::Migration[<%= Gitlab::Database::Migration.current_version %>]
include Gitlab::Database::MigrationHelpers
# When using the methods "add_concurrent_index" or "remove_concurrent_index" # When using the methods "add_concurrent_index" or "remove_concurrent_index"
# you must disable the use of transactions # you must disable the use of transactions
# as these methods can not run in an existing transaction. # as these methods can not run in an existing transaction.

View File

@ -91,7 +91,8 @@ module Gitlab
email: current_user.email, email: current_user.email,
created_at: current_user.created_at&.iso8601, created_at: current_user.created_at&.iso8601,
current_sign_in_ip: current_user.current_sign_in_ip, current_sign_in_ip: current_user.current_sign_in_ip,
last_sign_in_ip: current_user.last_sign_in_ip last_sign_in_ip: current_user.last_sign_in_ip,
sign_in_count: current_user.sign_in_count
}, },
pipeline: { pipeline: {
sha: pipeline.sha, sha: pipeline.sha,

View File

@ -312,6 +312,17 @@ RSpec.describe ProjectsController do
expect { get_show }.not_to change { Gitlab::GitalyClient.get_request_count } expect { get_show }.not_to change { Gitlab::GitalyClient.get_request_count }
end end
it "renders files even with invalid license" do
controller.instance_variable_set(:@project, public_project)
expect(public_project.repository).to receive(:license_key).and_return('woozle wuzzle').at_least(:once)
get_show
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('_files')
expect(response.body).to have_content('LICENSE') # would be 'MIT license' if stub not works
end
end end
context "when the url contains .atom" do context "when the url contains .atom" do

View File

@ -34,7 +34,8 @@
"email": { "type": "string" }, "email": { "type": "string" },
"created_at": { "type": ["string", "null"], "format": "date-time" }, "created_at": { "type": ["string", "null"], "format": "date-time" },
"current_sign_in_ip": { "type": ["string", "null"] }, "current_sign_in_ip": { "type": ["string", "null"] },
"last_sign_in_ip": { "type": ["string", "null"] } "last_sign_in_ip": { "type": ["string", "null"] },
"sign_in_count": { "type": "integer" }
} }
}, },
"pipeline": { "pipeline": {

View File

@ -1,25 +1,25 @@
# frozen_string_literal: true # frozen_string_literal: true
class BeforeAllAdapter # rubocop:disable Gitlab/NamespacedClass class BeforeAllAdapter # rubocop:disable Gitlab/NamespacedClass
def self.all_connection_pools def self.all_connection_classes
::ActiveRecord::Base.connection_handler.all_connection_pools @all_connection_classes ||= [ActiveRecord::Base] + ActiveRecord::Base.descendants.select(&:connection_class?) # rubocop: disable Database/MultipleDatabases
end end
def self.begin_transaction def self.begin_transaction
self.all_connection_pools.each do |connection_pool| self.all_connection_classes.each do |connection_class|
connection_pool.connection.begin_transaction(joinable: false) connection_class.connection.begin_transaction(joinable: false)
end end
end end
def self.rollback_transaction def self.rollback_transaction
self.all_connection_pools.each do |connection_pool| self.all_connection_classes.each do |connection_class|
if connection_pool.connection.open_transactions.zero? if connection_class.connection.open_transactions.zero?
warn "!!! before_all transaction has been already rollbacked and " \ warn "!!! before_all transaction has been already rollbacked and " \
"could work incorrectly" "could work incorrectly"
next next
end end
connection_pool.connection.rollback_transaction connection_class.connection.rollback_transaction
end end
end end
end end