Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
ab7ca19e68
commit
1bb63ff080
24 changed files with 147 additions and 157 deletions
|
@ -1,7 +1,4 @@
|
|||
import Vue from 'vue';
|
||||
|
||||
import { sanitize } from '~/lib/dompurify';
|
||||
|
||||
import UsersCache from './lib/utils/users_cache';
|
||||
import UserPopover from './vue_shared/components/user_popover/user_popover.vue';
|
||||
|
||||
|
@ -41,7 +38,6 @@ const populateUserInfo = (user) => {
|
|||
name: userData.name,
|
||||
location: userData.location,
|
||||
bio: userData.bio,
|
||||
bioHtml: sanitize(userData.bio_html),
|
||||
workInformation: userData.work_information,
|
||||
websiteUrl: userData.website_url,
|
||||
pronouns: userData.pronouns,
|
||||
|
|
|
@ -82,11 +82,7 @@ export default {
|
|||
<div class="gl-text-gray-500">
|
||||
<div v-if="user.bio" class="gl-display-flex gl-mb-2">
|
||||
<gl-icon name="profile" class="gl-text-gray-400 gl-flex-shrink-0" />
|
||||
<span
|
||||
ref="bio"
|
||||
class="gl-ml-2 gl-overflow-hidden"
|
||||
v-html="user.bioHtml /* eslint-disable-line vue/no-v-html */"
|
||||
></span>
|
||||
<span ref="bio" class="gl-ml-2 gl-overflow-hidden">{{ user.bio }}</span>
|
||||
</div>
|
||||
<div v-if="user.workInformation" class="gl-display-flex gl-mb-2">
|
||||
<gl-icon name="work" class="gl-text-gray-400 gl-flex-shrink-0" />
|
||||
|
|
|
@ -42,7 +42,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
|
|||
allow_tree_conflicts: display_merge_conflicts_in_diff?
|
||||
}
|
||||
|
||||
if diff_options_hash[:paths].blank? && Feature.enabled?(:diffs_batch_render_cached, project, default_enabled: :yaml)
|
||||
if diff_options_hash[:paths].blank?
|
||||
# NOTE: Any variables that would affect the resulting json needs to be added to the cache_context to avoid stale cache issues.
|
||||
cache_context = [
|
||||
current_user&.cache_key,
|
||||
|
|
|
@ -314,7 +314,7 @@ class User < ApplicationRecord
|
|||
delegate :path, to: :namespace, allow_nil: true, prefix: true
|
||||
delegate :job_title, :job_title=, to: :user_detail, allow_nil: true
|
||||
delegate :other_role, :other_role=, to: :user_detail, allow_nil: true
|
||||
delegate :bio, :bio=, :bio_html, to: :user_detail, allow_nil: true
|
||||
delegate :bio, :bio=, to: :user_detail, allow_nil: true
|
||||
delegate :webauthn_xid, :webauthn_xid=, to: :user_detail, allow_nil: true
|
||||
delegate :pronouns, :pronouns=, to: :user_detail, allow_nil: true
|
||||
delegate :pronunciation, :pronunciation=, to: :user_detail, allow_nil: true
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
class UserDetail < ApplicationRecord
|
||||
extend ::Gitlab::Utils::Override
|
||||
include CacheMarkdownField
|
||||
include IgnorableColumns
|
||||
ignore_columns %i[bio_html cached_markdown_version], remove_with: '13.6', remove_after: '2021-10-22'
|
||||
|
||||
belongs_to :user
|
||||
|
||||
|
@ -13,20 +14,6 @@ class UserDetail < ApplicationRecord
|
|||
|
||||
before_save :prevent_nil_bio
|
||||
|
||||
cache_markdown_field :bio
|
||||
|
||||
def bio_html
|
||||
read_attribute(:bio_html) || bio
|
||||
end
|
||||
|
||||
# For backward compatibility.
|
||||
# Older migrations (and their tests) reference the `User.migration_bot` where the `bio` attribute is set.
|
||||
# Here we disable writing the markdown cache when the `bio_html` column does not exist.
|
||||
override :invalidated_markdown_cache?
|
||||
def invalidated_markdown_cache?
|
||||
self.class.column_names.include?('bio_html') && super
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def prevent_nil_bio
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
- @hide_breadcrumbs = true
|
||||
- @no_container = true
|
||||
- page_title user_display_name(@user)
|
||||
- page_description @user.bio_html
|
||||
- page_description @user.bio
|
||||
- header_title @user.name, user_path(@user)
|
||||
- page_itemtype 'http://schema.org/Person'
|
||||
- link_classes = "flex-grow-1 mx-1 "
|
||||
|
@ -127,7 +127,7 @@
|
|||
- if @user.bio.present?
|
||||
.gl-text-gray-900
|
||||
.profile-user-bio
|
||||
= markdown(@user.bio_html)
|
||||
= @user.bio
|
||||
|
||||
|
||||
- unless profile_tabs.empty?
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: diffs_batch_render_cached
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/1509
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334762
|
||||
milestone: '14.1'
|
||||
type: development
|
||||
group: group::code review
|
||||
default_enabled: false
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: group_level_protected_environments
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61575
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/331085
|
||||
milestone: '14.0'
|
||||
type: development
|
||||
group: group::release
|
||||
default_enabled: false
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"type": "object",
|
||||
"required": ["key_path", "description", "value_type", "status", "product_group", "time_frame", "data_source", "distribution", "tier", "data_category"],
|
||||
"required": ["key_path", "description", "value_type", "status", "product_group", "time_frame", "data_source", "distribution", "tier", "data_category", "milestone"],
|
||||
"properties": {
|
||||
"key_path": {
|
||||
"type": "string"
|
||||
|
@ -33,7 +33,7 @@
|
|||
"enum": ["active", "data_available", "implemented", "deprecated", "removed", "broken"]
|
||||
},
|
||||
"milestone": {
|
||||
"type": ["string", "null"],
|
||||
"type": ["string"],
|
||||
"pattern": "^<?[0-9]+\\.[0-9]+$"
|
||||
},
|
||||
"milestone_removed": {
|
||||
|
|
|
@ -7,11 +7,9 @@ type: concepts, howto
|
|||
|
||||
# Group-level protected environments API **(PREMIUM)**
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215888) in [GitLab Premium](https://about.gitlab.com/pricing/) 14.0.
|
||||
> - [Deployed behind a feature flag](../user/feature_flags.md), disabled by default.
|
||||
> - Disabled on GitLab.com.
|
||||
> - Not recommended for production use.
|
||||
> - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](../ci/environments/protected_environments.md#enable-or-disable-group-level-protected-environments). **(FREE SELF)**
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215888) in [GitLab Premium](https://about.gitlab.com/pricing/) 14.0. [Deployed behind the `group_level_protected_environments` flag](../administration/feature_flags.md), disabled by default.
|
||||
> - [Feature flag `group_level_protected_environments`](https://gitlab.com/gitlab-org/gitlab/-/issues/331085) removed in GitLab 14.3.
|
||||
> - [Generally Available](https://gitlab.com/gitlab-org/gitlab/-/issues/331085) on [GitLab Premium](https://about.gitlab.com/pricing/) and on GitLab.com in 14.3.
|
||||
|
||||
This in-development feature might not be available for your use. There can be
|
||||
[risks when enabling features still in development](../administration/feature_flags.md#risks-when-enabling-features-still-in-development).
|
||||
|
|
|
@ -124,7 +124,6 @@ GET /users
|
|||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"is_admin": false,
|
||||
"bio": "",
|
||||
"bio_html": "",
|
||||
"location": null,
|
||||
"skype": "",
|
||||
"linkedin": "",
|
||||
|
@ -164,7 +163,6 @@ GET /users
|
|||
"created_at": "2012-05-23T08:01:01Z",
|
||||
"is_admin": false,
|
||||
"bio": "",
|
||||
"bio_html": "",
|
||||
"location": null,
|
||||
"skype": "",
|
||||
"linkedin": "",
|
||||
|
@ -283,7 +281,6 @@ Parameters:
|
|||
"web_url": "http://localhost:3000/john_smith",
|
||||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"bio": "",
|
||||
"bio_html": "",
|
||||
"bot": false,
|
||||
"location": null,
|
||||
"public_email": "john@example.com",
|
||||
|
@ -322,7 +319,6 @@ Example Responses:
|
|||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"is_admin": false,
|
||||
"bio": "",
|
||||
"bio_html": "",
|
||||
"location": null,
|
||||
"public_email": "john@example.com",
|
||||
"skype": "",
|
||||
|
@ -551,7 +547,6 @@ GET /user
|
|||
"web_url": "http://localhost:3000/john_smith",
|
||||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"bio": "",
|
||||
"bio_html": "",
|
||||
"location": null,
|
||||
"public_email": "john@example.com",
|
||||
"skype": "",
|
||||
|
@ -601,7 +596,6 @@ GET /user
|
|||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"is_admin": false,
|
||||
"bio": "",
|
||||
"bio_html": "",
|
||||
"location": null,
|
||||
"public_email": "john@example.com",
|
||||
"skype": "",
|
||||
|
|
|
@ -157,11 +157,9 @@ For more information, see [Deployment safety](deployment_safety.md).
|
|||
|
||||
## Group-level protected environments
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215888) in [GitLab Premium](https://about.gitlab.com/pricing/) 14.0.
|
||||
> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
|
||||
> - Disabled on GitLab.com.
|
||||
> - Not recommended for production use.
|
||||
> - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-group-level-protected-environments). **(FREE SELF)**
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215888) in [GitLab Premium](https://about.gitlab.com/pricing/) 14.0. [Deployed behind the `group_level_protected_environments` flag](../../administration/feature_flags.md), disabled by default.
|
||||
> - [Feature flag `group_level_protected_environments`](https://gitlab.com/gitlab-org/gitlab/-/issues/331085) removed in GitLab 14.3.
|
||||
> - [Generally Available](https://gitlab.com/gitlab-org/gitlab/-/issues/331085) on [GitLab Premium](https://about.gitlab.com/pricing/) and on GitLab.com in 14.3.
|
||||
|
||||
This in-development feature might not be available for your use. There can be
|
||||
[risks when enabling features still in development](../../administration/feature_flags.md#risks-when-enabling-features-still-in-development).
|
||||
|
@ -259,25 +257,6 @@ NOTE:
|
|||
Configuration [via the UI](https://gitlab.com/gitlab-org/gitlab/-/issues/325249)
|
||||
is scheduled for a later release.
|
||||
|
||||
### Enable or disable Group-level protected environments **(FREE SELF)**
|
||||
|
||||
Group-level protected environments is under development and not ready for production use. It is
|
||||
deployed behind a feature flag that is **disabled by default**.
|
||||
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
|
||||
can enable it.
|
||||
|
||||
To enable it:
|
||||
|
||||
```ruby
|
||||
Feature.enable(:group_level_protected_environments)
|
||||
```
|
||||
|
||||
To disable it:
|
||||
|
||||
```ruby
|
||||
Feature.disable(:group_level_protected_environments)
|
||||
```
|
||||
|
||||
<!-- ## Troubleshooting
|
||||
|
||||
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
|
||||
|
|
|
@ -157,3 +157,8 @@ feature, but with a `false` value instead:
|
|||
curl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" \
|
||||
"https://gitlab.example.com/api/v4/projects/PROJECT_ID/error_tracking/settings?active=false&integrated=false"
|
||||
```
|
||||
|
||||
#### Limitations
|
||||
|
||||
The Integrated Error Tracking feature was built and tested with Sentry SDK for Ruby. Other languages and frameworks
|
||||
are not tested and might not work. Check [the compatibility issue](https://gitlab.com/gitlab-org/gitlab/-/issues/340178) for more information.
|
||||
|
|
|
@ -4,8 +4,10 @@ module API
|
|||
module Entities
|
||||
class User < UserBasic
|
||||
include UsersHelper
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
|
||||
expose :created_at, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) }
|
||||
expose :bio, :bio_html, :location, :public_email, :skype, :linkedin, :twitter, :website_url, :organization, :job_title, :pronouns
|
||||
expose :bio, :location, :public_email, :skype, :linkedin, :twitter, :website_url, :organization, :job_title, :pronouns
|
||||
expose :bot?, as: :bot
|
||||
expose :work_information do |user|
|
||||
work_information(user)
|
||||
|
@ -16,6 +18,12 @@ module API
|
|||
expose :following, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) } do |user|
|
||||
user.followees.size
|
||||
end
|
||||
|
||||
# This is only for multi version compatibility reasons, as we removed user.bio_html
|
||||
# to be removed in 14.4
|
||||
expose :bio_html do |user|
|
||||
strip_tags(user.bio)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -968,42 +968,7 @@ module Gitlab
|
|||
# columns - The name, or array of names, of the column(s) that we want to convert to bigint.
|
||||
# primary_key - The name of the primary key column (most often :id)
|
||||
def initialize_conversion_of_integer_to_bigint(table, columns, primary_key: :id)
|
||||
unless table_exists?(table)
|
||||
raise "Table #{table} does not exist"
|
||||
end
|
||||
|
||||
unless column_exists?(table, primary_key)
|
||||
raise "Column #{primary_key} does not exist on #{table}"
|
||||
end
|
||||
|
||||
columns = Array.wrap(columns)
|
||||
columns.each do |column|
|
||||
next if column_exists?(table, column)
|
||||
|
||||
raise ArgumentError, "Column #{column} does not exist on #{table}"
|
||||
end
|
||||
|
||||
check_trigger_permissions!(table)
|
||||
|
||||
conversions = columns.to_h { |column| [column, convert_to_bigint_column(column)] }
|
||||
|
||||
with_lock_retries do
|
||||
conversions.each do |(source_column, temporary_name)|
|
||||
column = column_for(table, source_column)
|
||||
|
||||
if (column.name.to_s == primary_key.to_s) || !column.null
|
||||
# If the column to be converted is either a PK or is defined as NOT NULL,
|
||||
# set it to `NOT NULL DEFAULT 0` and we'll copy paste the correct values bellow
|
||||
# That way, we skip the expensive validation step required to add
|
||||
# a NOT NULL constraint at the end of the process
|
||||
add_column(table, temporary_name, :bigint, default: column.default || 0, null: false)
|
||||
else
|
||||
add_column(table, temporary_name, :bigint, default: column.default)
|
||||
end
|
||||
end
|
||||
|
||||
install_rename_triggers(table, conversions.keys, conversions.values)
|
||||
end
|
||||
create_temporary_columns_and_triggers(table, columns, primary_key: primary_key, data_type: :bigint)
|
||||
end
|
||||
|
||||
# Reverts `initialize_conversion_of_integer_to_bigint`
|
||||
|
@ -1020,6 +985,16 @@ module Gitlab
|
|||
temporary_columns.each { |column| remove_column(table, column) }
|
||||
end
|
||||
|
||||
# Reverts `cleanup_conversion_of_integer_to_bigint`
|
||||
#
|
||||
# table - The name of the database table containing the columns
|
||||
# columns - The name, or array of names, of the column(s) that we have converted to bigint.
|
||||
# primary_key - The name of the primary key column (most often :id)
|
||||
|
||||
def restore_conversion_of_integer_to_bigint(table, columns, primary_key: :id)
|
||||
create_temporary_columns_and_triggers(table, columns, primary_key: primary_key, data_type: :int)
|
||||
end
|
||||
|
||||
# Backfills the new columns used in an integer-to-bigint conversion using background migrations.
|
||||
#
|
||||
# - This helper should be called from a post-deployment migration.
|
||||
|
@ -1649,6 +1624,45 @@ into similar problems in the future (e.g. when new tables are created).
|
|||
|
||||
private
|
||||
|
||||
def create_temporary_columns_and_triggers(table, columns, primary_key: :id, data_type: :bigint)
|
||||
unless table_exists?(table)
|
||||
raise "Table #{table} does not exist"
|
||||
end
|
||||
|
||||
unless column_exists?(table, primary_key)
|
||||
raise "Column #{primary_key} does not exist on #{table}"
|
||||
end
|
||||
|
||||
columns = Array.wrap(columns)
|
||||
columns.each do |column|
|
||||
next if column_exists?(table, column)
|
||||
|
||||
raise ArgumentError, "Column #{column} does not exist on #{table}"
|
||||
end
|
||||
|
||||
check_trigger_permissions!(table)
|
||||
|
||||
conversions = columns.to_h { |column| [column, convert_to_bigint_column(column)] }
|
||||
|
||||
with_lock_retries do
|
||||
conversions.each do |(source_column, temporary_name)|
|
||||
column = column_for(table, source_column)
|
||||
|
||||
if (column.name.to_s == primary_key.to_s) || !column.null
|
||||
# If the column to be converted is either a PK or is defined as NOT NULL,
|
||||
# set it to `NOT NULL DEFAULT 0` and we'll copy paste the correct values bellow
|
||||
# That way, we skip the expensive validation step required to add
|
||||
# a NOT NULL constraint at the end of the process
|
||||
add_column(table, temporary_name, data_type, default: column.default || 0, null: false)
|
||||
else
|
||||
add_column(table, temporary_name, data_type, default: column.default)
|
||||
end
|
||||
end
|
||||
|
||||
install_rename_triggers(table, conversions.keys, conversions.values)
|
||||
end
|
||||
end
|
||||
|
||||
def validate_check_constraint_name!(constraint_name)
|
||||
if constraint_name.to_s.length > MAX_IDENTIFIER_NAME_LENGTH
|
||||
raise "The maximum allowed constraint name is #{MAX_IDENTIFIER_NAME_LENGTH} characters"
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
"@gitlab/favicon-overlay": "2.0.0",
|
||||
"@gitlab/svgs": "1.211.0",
|
||||
"@gitlab/tributejs": "1.0.0",
|
||||
"@gitlab/ui": "32.5.0",
|
||||
"@gitlab/ui": "32.7.1",
|
||||
"@gitlab/visual-review-tools": "1.6.1",
|
||||
"@rails/actioncable": "6.1.3-2",
|
||||
"@rails/ujs": "6.1.3-2",
|
||||
|
|
|
@ -45,7 +45,6 @@ RSpec.describe 'User edit profile' do
|
|||
twitter: 'testtwitter',
|
||||
website_url: 'testurl',
|
||||
bio: 'I <3 GitLab :tada:',
|
||||
bio_html: '<p data-sourcepos="1:1-1:18" dir="auto">I <3 GitLab <gl-emoji title="party popper" data-name="tada" data-unicode-version="6.0">🎉</gl-emoji></p>',
|
||||
job_title: 'Frontend Engineer',
|
||||
organization: 'GitLab'
|
||||
)
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'spec_helper'
|
|||
RSpec.describe 'User page' do
|
||||
include ExternalAuthorizationServiceHelpers
|
||||
|
||||
let_it_be(:user) { create(:user, bio: '**Lorem** _ipsum_ dolor sit [amet](https://example.com)') }
|
||||
let_it_be(:user) { create(:user, bio: '<b>Lorem</b> <i>ipsum</i> dolor sit <a href="https://example.com">amet</a>') }
|
||||
|
||||
subject(:visit_profile) { visit(user_path(user)) }
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ describe('User Popover Component', () => {
|
|||
const bio = 'My super interesting bio';
|
||||
|
||||
it('should show only bio if work information is not available', () => {
|
||||
const user = { ...DEFAULT_PROPS.user, bio, bioHtml: bio };
|
||||
const user = { ...DEFAULT_PROPS.user, bio };
|
||||
|
||||
createWrapper({ user });
|
||||
|
||||
|
@ -117,7 +117,6 @@ describe('User Popover Component', () => {
|
|||
const user = {
|
||||
...DEFAULT_PROPS.user,
|
||||
bio,
|
||||
bioHtml: bio,
|
||||
workInformation: 'Frontend Engineer at GitLab',
|
||||
};
|
||||
|
||||
|
@ -127,16 +126,15 @@ describe('User Popover Component', () => {
|
|||
expect(findWorkInformation().text()).toBe('Frontend Engineer at GitLab');
|
||||
});
|
||||
|
||||
it('should not encode special characters in bio', () => {
|
||||
it('should encode special characters in bio', () => {
|
||||
const user = {
|
||||
...DEFAULT_PROPS.user,
|
||||
bio: 'I like CSS',
|
||||
bioHtml: 'I like <b>CSS</b>',
|
||||
bio: 'I like <b>CSS</b>',
|
||||
};
|
||||
|
||||
createWrapper({ user });
|
||||
|
||||
expect(findBio().html()).toContain('I like <b>CSS</b>');
|
||||
expect(findBio().html()).toContain('I like <b>CSS</b>');
|
||||
});
|
||||
|
||||
it('shows icon for bio', () => {
|
||||
|
|
|
@ -1886,6 +1886,61 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#restore_conversion_of_integer_to_bigint' do
|
||||
let(:table) { :test_table }
|
||||
let(:column) { :id }
|
||||
let(:tmp_column) { model.convert_to_bigint_column(column) }
|
||||
|
||||
before do
|
||||
model.create_table table, id: false do |t|
|
||||
t.bigint :id, primary_key: true
|
||||
t.bigint :build_id, null: false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the target table does not exist' do
|
||||
it 'raises an error' do
|
||||
expect { model.restore_conversion_of_integer_to_bigint(:this_table_is_not_real, column) }
|
||||
.to raise_error('Table this_table_is_not_real does not exist')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the column to migrate does not exist' do
|
||||
it 'raises an error' do
|
||||
expect { model.restore_conversion_of_integer_to_bigint(table, :this_column_is_not_real) }
|
||||
.to raise_error(ArgumentError, "Column this_column_is_not_real does not exist on #{table}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a single column is given' do
|
||||
let(:column_to_convert) { 'id' }
|
||||
let(:temporary_column) { model.convert_to_bigint_column(column_to_convert) }
|
||||
|
||||
it 'creates the correct columns and installs the trigger' do
|
||||
expect(model).to receive(:add_column).with(table, temporary_column, :int, default: 0, null: false)
|
||||
|
||||
expect(model).to receive(:install_rename_triggers).with(table, [column_to_convert], [temporary_column])
|
||||
|
||||
model.restore_conversion_of_integer_to_bigint(table, column_to_convert)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when multiple columns are given' do
|
||||
let(:columns_to_convert) { %i[id build_id] }
|
||||
let(:temporary_columns) { columns_to_convert.map { |column| model.convert_to_bigint_column(column) } }
|
||||
|
||||
it 'creates the correct columns and installs the trigger' do
|
||||
expect(model).to receive(:add_column).with(table, temporary_columns[0], :int, default: 0, null: false)
|
||||
expect(model).to receive(:add_column).with(table, temporary_columns[1], :int, default: 0, null: false)
|
||||
|
||||
expect(model).to receive(:install_rename_triggers).with(table, columns_to_convert, temporary_columns)
|
||||
|
||||
model.restore_conversion_of_integer_to_bigint(table, columns_to_convert)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#revert_initialize_conversion_of_integer_to_bigint' do
|
||||
let(:table) { :test_table }
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
|
|||
product_category: 'collection',
|
||||
product_stage: 'growth',
|
||||
status: 'active',
|
||||
milestone: '14.1',
|
||||
default_generation: 'generation_1',
|
||||
key_path: 'uuid',
|
||||
product_group: 'group::product analytics',
|
||||
|
@ -64,6 +65,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
|
|||
:value_type | nil
|
||||
:value_type | 'test'
|
||||
:status | nil
|
||||
:milestone | nil
|
||||
:data_category | nil
|
||||
:key_path | nil
|
||||
:product_group | nil
|
||||
|
@ -190,6 +192,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
|
|||
product_category: 'collection',
|
||||
product_stage: 'growth',
|
||||
status: 'active',
|
||||
milestone: '14.1',
|
||||
default_generation: 'generation_1',
|
||||
key_path: 'counter.category.event',
|
||||
product_group: 'group::product analytics',
|
||||
|
|
|
@ -25,29 +25,4 @@ RSpec.describe UserDetail do
|
|||
it { is_expected.to validate_length_of(:bio).is_at_most(255) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#bio_html' do
|
||||
let(:user) { create(:user, bio: 'some **bio**') }
|
||||
|
||||
subject { user.user_detail.bio_html }
|
||||
|
||||
it 'falls back to #bio when the html representation is missing' do
|
||||
user.user_detail.update!(bio_html: nil)
|
||||
|
||||
expect(subject).to eq(user.user_detail.bio)
|
||||
end
|
||||
|
||||
it 'stores rendered html' do
|
||||
expect(subject).to include('some <strong>bio</strong>')
|
||||
end
|
||||
|
||||
it 'does not try to set the value when the column is not there' do
|
||||
without_bio_html_column = UserDetail.column_names - ['bio_html']
|
||||
|
||||
expect(described_class).to receive(:column_names).at_least(:once).and_return(without_bio_html_column)
|
||||
expect(user.user_detail).not_to receive(:bio_html=)
|
||||
|
||||
subject
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -82,7 +82,6 @@ RSpec.describe User do
|
|||
|
||||
it { is_expected.to delegate_method(:bio).to(:user_detail).allow_nil }
|
||||
it { is_expected.to delegate_method(:bio=).to(:user_detail).with_arguments(:args).allow_nil }
|
||||
it { is_expected.to delegate_method(:bio_html).to(:user_detail).allow_nil }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
|
|
|
@ -974,10 +974,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8"
|
||||
integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw==
|
||||
|
||||
"@gitlab/ui@32.5.0":
|
||||
version "32.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.5.0.tgz#c8d5e4bff1bc69c03831a3d5f086f8aaead703a4"
|
||||
integrity sha512-uCctMjhRg5AD5eTXI1mdoZTgZ2jUaNlDXknm1drSaYjxwyHDPtRZ24wcBK/mT3Sj03naXifhTkVdjUz8RZmDCw==
|
||||
"@gitlab/ui@32.7.1":
|
||||
version "32.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.7.1.tgz#24813d6365eb1e169b36b0b5c2b927f8ce19d62b"
|
||||
integrity sha512-SYoI6wXDhQCzf4BE6g349Z/XgMHbvUJb5+uugLFN8310Gj46Ii6gKrUCQ8iungD8VbYad+ah6muOpI9Ec/k6fw==
|
||||
dependencies:
|
||||
"@babel/standalone" "^7.0.0"
|
||||
bootstrap-vue "2.18.1"
|
||||
|
|
Loading…
Reference in a new issue