Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-01-04 03:09:06 +00:00
parent 557957d224
commit 6b8d3993b8
22 changed files with 68 additions and 21 deletions

View File

@ -44,7 +44,7 @@ export const initHeader = () => {
cancelAutoStopPath: dataset.environmentCancelAutoStopPath,
terminalPath: dataset.environmentTerminalPath,
metricsPath: dataset.environmentMetricsPath,
updatePath: dataset.tnvironmentEditPath,
updatePath: dataset.environmentEditPath,
},
});
},

View File

@ -68,7 +68,7 @@ class Admin::ApplicationSettings::AppearancesController < Admin::ApplicationCont
def allowed_appearance_params
%i[
title
short_title
pwa_short_name
description
logo
logo_cache

View File

@ -4,6 +4,10 @@ module AppearancesHelper
include MarkupHelper
include Gitlab::Utils::StrongMemoize
def appearance_short_name
Appearance.current&.pwa_short_name.presence || _('GitLab')
end
def brand_title
current_appearance&.title.presence || default_brand_title
end

View File

@ -6,7 +6,7 @@ class Appearance < ApplicationRecord
include WithUploads
attribute :title, default: ''
attribute :short_title, default: ''
attribute :pwa_short_name, default: ''
attribute :description, default: ''
attribute :new_project_guidelines, default: ''
attribute :profile_image_guidelines, default: ''

View File

@ -1,6 +1,6 @@
{
"name": "<%= Appearance.current&.title.presence || _('GitLab') %>",
"short_name": "<%= Appearance.current&.short_title.presence || _('GitLab') %>",
"short_name": "<%= appearance_short_name %>",
"description": "<%= Appearance.current&.description.presence || _("The complete DevOps platform. One application with endless possibilities. Organizations rely on GitLabs source code management, CI/CD, security, and more to deliver software rapidly.") %>",
"start_url": "<%= explore_projects_path %>",
"scope": "<%= root_path %>",

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class RenameAppearancesShortTitleToPwaShortName < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
rename_column_concurrently :appearances, :short_title, :pwa_short_name
end
def down
undo_rename_column_concurrently :appearances, :short_title, :pwa_short_name
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class CleanupAppearancesShortTitleRename < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
cleanup_concurrent_column_rename :appearances, :short_title, :pwa_short_name
end
def down
undo_cleanup_concurrent_column_rename :appearances, :short_title, :pwa_short_name
end
end

View File

@ -0,0 +1 @@
2e22336f0f4f99dc91198bc0634816309ac49375900eed662ab7a41ddce34984

View File

@ -0,0 +1 @@
18c91662404c12f9bcdda60fbf80a13ec36dcd881e47b31d4f0c7a0f20c1f225

View File

@ -11079,9 +11079,9 @@ CREATE TABLE appearances (
email_header_and_footer_enabled boolean DEFAULT false NOT NULL,
profile_image_guidelines text,
profile_image_guidelines_html text,
short_title text,
pwa_short_name text,
CONSTRAINT appearances_profile_image_guidelines CHECK ((char_length(profile_image_guidelines) <= 4096)),
CONSTRAINT check_fdf3064682 CHECK ((char_length(short_title) <= 255))
CONSTRAINT check_5c3fd63577 CHECK ((char_length(pwa_short_name) <= 255))
);
CREATE SEQUENCE appearances_id_seq

View File

@ -28,7 +28,7 @@ To bring the former **primary** site up to date:
1. SSH into the former **primary** site that has fallen behind.
1. Remove `/etc/gitlab/gitlab-cluster.json` if it exists.
If the site to be readded as a **secondary** site was promoted with the `gitlab-ctl geo promote` command, then it may contain a `/etc/gitlab/gitlab-cluster.json` file. For example during `gitlab-ctl reconfigure`, you may notice output like:
If the site to be re-added as a **secondary** site was promoted with the `gitlab-ctl geo promote` command, then it may contain a `/etc/gitlab/gitlab-cluster.json` file. For example during `gitlab-ctl reconfigure`, you may notice output like:
```plaintext
The 'geo_primary_role' is defined in /etc/gitlab/gitlab-cluster.json as 'true' and overrides the setting in the /etc/gitlab/gitlab.rb

View File

@ -64,7 +64,7 @@ verification methods:
| Blobs | Alert Metric Images _(file system)_ | Geo with API | SHA256 checksum |
| Blobs | Alert Metric Images _(object storage)_ | Geo with API/Managed (*2*) | _Not implemented_ |
| Blobs | Dependency Proxy Images_(file system)_ | Geo with API | SHA256 checksum |
| Blobs | Dependency Proxy Images _(object_storage)_ | Geo with API/managed (*2*) | _Not implemented_ |
| Blobs | Dependency Proxy Images _(object storage)_ | Geo with API/managed (*2*) | _Not implemented_ |
- (*1*): Redis replication can be used as part of HA with Redis sentinel. It's not used between Geo sites.
- (*2*): Object storage replication can be performed by Geo or by your object storage provider/appliance

View File

@ -29,7 +29,7 @@ Example response:
```json
{
"title": "GitLab Test Instance",
"short_title": "GitLab",
"pwa_short_name": "GitLab",
"description": "gitlab-test.example.com",
"logo": "/uploads/-/system/appearance/logo/1/logo.png",
"header_logo": "/uploads/-/system/appearance/header_logo/1/header.png",
@ -55,7 +55,7 @@ PUT /application/appearance
| Attribute | Type | Required | Description |
| --------------------------------- | ------- | -------- | ----------- |
| `title` | string | no | Instance title on the sign in / sign up page
| `short_title` | string | no | Short title for progressive web app
| `pwa_short_name` | string | no | Optional, short name for Progressive Web App
| `description` | string | no | Markdown text shown on the sign in / sign up page
| `logo` | mixed | no | Instance image used on the sign in / sign up page. See [Change logo](#change-logo)
| `header_logo` | mixed | no | Instance image used for the main navigation bar
@ -77,7 +77,7 @@ Example response:
```json
{
"title": "GitLab Test Instance",
"short_title": "GitLab",
"pwa_short_name": "GitLab",
"description": "gitlab-test.example.com",
"logo": "/uploads/-/system/appearance/logo/1/logo.png",
"header_logo": "/uploads/-/system/appearance/header_logo/1/header.png",

View File

@ -155,7 +155,7 @@ To avoid creation, it is worth bearing in mind that:
Use [Factory Doctor](https://test-prof.evilmartians.io/#/profilers/factory_doctor) to find cases where database persistence is not needed in a given test.
Examples of factories optmization [1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106796), [2](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105329).
Examples of factories optimization [1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106796), [2](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105329).
```shell
# run test for path

View File

@ -168,7 +168,7 @@ In the GitLab UI, with corpus management you can:
When you download a corpus, the file is named `artifacts.zip`, regardless of the filename used when
the corpus was initially uploaded. This file contains only the corpus, which is different to the
artifacts files you can download from the CI/CD pipeline.
artifacts files you can download from the CI/CD pipeline. Also, a project member with a Reporter or above privilege can download the corpus using the direct download link.
### View details of the corpus registry

View File

@ -26,7 +26,7 @@ module API
end
params do
optional :title, type: String, desc: 'Instance title on the sign in / sign up page'
optional :short_title, type: String, desc: 'Short title for Progressive Web App'
optional :pwa_short_name, type: String, desc: 'Optional, short name for Progressive Web App'
optional :description, type: String, desc: 'Markdown text shown on the sign in / sign up page'
# TODO: remove rubocop disable - https://gitlab.com/gitlab-org/gitlab/issues/14960
optional :logo, type: File, desc: 'Instance image used on the sign in / sign up page' # rubocop:disable Scalability/FileUploads

View File

@ -4,7 +4,7 @@ module API
module Entities
class Appearance < Grape::Entity
expose :title
expose :short_title
expose :pwa_short_name
expose :description
expose :logo do |appearance, options|

View File

@ -11,7 +11,7 @@ RSpec.describe Admin::ApplicationSettings::AppearancesController do
let(:create_params) do
{
title: 'Foo',
short_title: 'F',
pwa_short_name: 'F',
description: 'Bar',
header_message: header_message,
footer_message: footer_message

View File

@ -10,6 +10,20 @@ RSpec.describe AppearancesHelper do
allow(helper).to receive(:current_user).and_return(user)
end
describe '#appearance_short_name' do
it 'returns the default value' do
create(:appearance)
expect(helper.appearance_short_name).to match('GitLab')
end
it 'returns the customized value' do
create(:appearance, pwa_short_name: 'Short')
expect(helper.appearance_short_name).to match('Short')
end
end
describe '.current_appearance' do
it 'memoizes empty appearance' do
expect(Appearance).to receive(:current).once

View File

@ -14,7 +14,7 @@ RSpec.describe Appearance do
subject(:appearance) { described_class.new }
it { expect(appearance.title).to eq('') }
it { expect(appearance.short_title).to eq('') }
it { expect(appearance.pwa_short_name).to eq('') }
it { expect(appearance.description).to eq('') }
it { expect(appearance.new_project_guidelines).to eq('') }
it { expect(appearance.profile_image_guidelines).to eq('') }

View File

@ -33,7 +33,7 @@ RSpec.describe API::Appearance, 'Appearance', feature_category: :navigation do
expect(json_response['new_project_guidelines']).to eq('')
expect(json_response['profile_image_guidelines']).to eq('')
expect(json_response['title']).to eq('')
expect(json_response['short_title']).to eq('')
expect(json_response['pwa_short_name']).to eq('')
end
end
end
@ -52,7 +52,7 @@ RSpec.describe API::Appearance, 'Appearance', feature_category: :navigation do
it "allows updating the settings" do
put api("/application/appearance", admin), params: {
title: "GitLab Test Instance",
short_title: "GitLab",
pwa_short_name: "GitLab PWA",
description: "gitlab-test.example.com",
new_project_guidelines: "Please read the FAQs for help.",
profile_image_guidelines: "Custom profile image guidelines"
@ -72,7 +72,7 @@ RSpec.describe API::Appearance, 'Appearance', feature_category: :navigation do
expect(json_response['new_project_guidelines']).to eq('Please read the FAQs for help.')
expect(json_response['profile_image_guidelines']).to eq('Custom profile image guidelines')
expect(json_response['title']).to eq('GitLab Test Instance')
expect(json_response['short_title']).to eq('GitLab')
expect(json_response['pwa_short_name']).to eq('GitLab PWA')
end
end

View File

@ -8,12 +8,13 @@ RSpec.describe PwaController, feature_category: :navigation do
get manifest_path(format: :json)
expect(response.body).to include('The complete DevOps platform.')
expect(Gitlab::Json.parse(response.body)).to include({ 'short_name' => 'GitLab' })
expect(response).to have_gitlab_http_status(:success)
end
context 'with customized appearance' do
let_it_be(:appearance) do
create(:appearance, title: 'Long name', short_title: 'Short name', description: 'This is a test')
create(:appearance, title: 'Long name', pwa_short_name: 'Short name', description: 'This is a test')
end
it 'uses custom values', :aggregate_failures do