Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
50135e6e04
commit
d193734fb9
|
@ -107,10 +107,15 @@ $tabs-holder-z-index: 250;
|
|||
border-radius: $border-radius-default;
|
||||
}
|
||||
|
||||
.mr-widget-section:not(:first-child),
|
||||
.mr-widget-footer {
|
||||
border-top: solid 1px $border-color;
|
||||
}
|
||||
|
||||
.mr-widget-alert-container + .mr-widget-section {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.mr-fast-forward-message {
|
||||
padding-left: $gl-padding-50;
|
||||
padding-bottom: $gl-padding;
|
||||
|
|
|
@ -25,7 +25,7 @@ class Projects::TemplatesController < Projects::ApplicationController
|
|||
|
||||
def names
|
||||
respond_to do |format|
|
||||
format.json { render json: TemplateFinder.all_template_names_hash_or_array(project, params[:template_type].to_s) }
|
||||
format.json { render json: TemplateFinder.all_template_names(project, params[:template_type].to_s.pluralize) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -21,27 +21,11 @@ class TemplateFinder
|
|||
end
|
||||
end
|
||||
|
||||
# This is temporary and will be removed once we introduce group level inherited templates and
|
||||
# remove the inherited_issuable_templates FF
|
||||
def all_template_names_hash_or_array(project, issuable_type)
|
||||
if project.inherited_issuable_templates_enabled?
|
||||
all_template_names(project, issuable_type.pluralize)
|
||||
else
|
||||
all_template_names_array(project, issuable_type.pluralize)
|
||||
end
|
||||
end
|
||||
|
||||
def all_template_names(project, type)
|
||||
return {} if !VENDORED_TEMPLATES.key?(type.to_s) && type.to_s != 'licenses'
|
||||
|
||||
build(type, project).template_names
|
||||
end
|
||||
|
||||
# This is for issues and merge requests description templates only.
|
||||
# This will be removed once we introduce group level inherited templates and remove the inherited_issuable_templates FF
|
||||
def all_template_names_array(project, type)
|
||||
all_template_names(project, type).values.flatten.select { |tmpl| tmpl[:project_id] == project.id }.compact.uniq
|
||||
end
|
||||
end
|
||||
|
||||
attr_reader :type, :project, :params
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
module GitpodHelper
|
||||
def gitpod_enable_description
|
||||
s_('Enable %{linkStart}Gitpod%{linkEnd} integration to launch a development environment in your browser directly from GitLab.')
|
||||
s_('Users can launch a development environment from a GitLab browser tab when the %{linkStart}Gitpod%{linkEnd} integration is enabled.')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,17 +29,12 @@ module IssuablesDescriptionTemplatesHelper
|
|||
def issuable_templates(project, issuable_type)
|
||||
@template_types ||= {}
|
||||
@template_types[project.id] ||= {}
|
||||
@template_types[project.id][issuable_type] ||= TemplateFinder.all_template_names_hash_or_array(project, issuable_type)
|
||||
@template_types[project.id][issuable_type] ||= TemplateFinder.all_template_names(project, issuable_type.pluralize)
|
||||
end
|
||||
|
||||
def issuable_templates_names(issuable)
|
||||
all_templates = issuable_templates(ref_project, issuable.to_ability_name)
|
||||
|
||||
if ref_project.inherited_issuable_templates_enabled?
|
||||
all_templates.values.flatten.map { |tpl| tpl[:name] if tpl[:project_id] == ref_project.id }.compact.uniq
|
||||
else
|
||||
all_templates.map { |template| template[:name] }
|
||||
end
|
||||
all_templates.values.flatten.map { |tpl| tpl[:name] if tpl[:project_id] == ref_project.id }.compact.uniq
|
||||
end
|
||||
|
||||
def selected_template(issuable)
|
||||
|
|
|
@ -2592,10 +2592,6 @@ class Project < ApplicationRecord
|
|||
Projects::GitGarbageCollectWorker
|
||||
end
|
||||
|
||||
def inherited_issuable_templates_enabled?
|
||||
Feature.enabled?(:inherited_issuable_templates, self, default_enabled: :yaml)
|
||||
end
|
||||
|
||||
def activity_path
|
||||
Gitlab::Routing.url_helpers.activity_project_path(self)
|
||||
end
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
= f.label :gitpod_enabled, s_('Gitpod|Enable Gitpod integration'), class: 'form-check-label'
|
||||
.form-group
|
||||
= f.label :gitpod_url, s_('Gitpod|Gitpod URL'), class: 'label-bold'
|
||||
= f.text_field :gitpod_url, class: 'form-control gl-form-input', placeholder: s_('Gitpod|e.g. https://gitpod.example.com')
|
||||
= f.text_field :gitpod_url, class: 'form-control gl-form-input', placeholder: s_('Gitpod|https://gitpod.example.com')
|
||||
.form-text.text-muted
|
||||
= s_('Gitpod|Add the URL to your Gitpod instance configured to read your GitLab projects.')
|
||||
= s_('Gitpod|The URL to your Gitpod instance configured to read your GitLab projects, such as https://gitpod.example.com.')
|
||||
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('integration/gitpod', anchor: 'enable-gitpod-in-your-user-settings') }
|
||||
= s_('Gitpod|To use the integration, each user must also enable Gitpod on their GitLab account. %{link_start}How do I enable it?%{link_end} ').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
|
||||
= f.submit s_('Save changes'), class: 'gl-button btn btn-confirm'
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: inherited_issuable_templates
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52360
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/321247
|
||||
milestone: '13.9'
|
||||
type: development
|
||||
group: group::project management
|
||||
default_enabled: true
|
|
@ -246,6 +246,7 @@ required:
|
|||
sets the database to read-write. The instructions vary depending on where your database is hosted:
|
||||
- [Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html#USER_ReadRepl.Promote)
|
||||
- [Azure PostgreSQL](https://docs.microsoft.com/en-us/azure/postgresql/howto-read-replicas-portal#stop-replication)
|
||||
- [Google Cloud SQL](https://cloud.google.com/sql/docs/mysql/replication/manage-replicas#promote-replica)
|
||||
- For other external PostgreSQL databases, save the following script in your
|
||||
secondary node, for example `/tmp/geo_promote.sh`, and modify the connection
|
||||
parameters to match your environment. Then, execute it to promote the replica:
|
||||
|
|
|
@ -106,11 +106,7 @@ instance or the project's parent groups.
|
|||
### Set instance-level description templates **(PREMIUM SELF)**
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52360) in GitLab 13.9.
|
||||
> - [Deployed behind a feature flag](../feature_flags.md), disabled by default.
|
||||
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56737) in GitLab 13.11.
|
||||
> - Enabled by default on GitLab.com.
|
||||
> - Recommended for production use.
|
||||
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-issue-and-merge-request-description-templates-at-group-and-instance-level). **(PREMIUM SELF)**
|
||||
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/321247) in GitLab 14.0.
|
||||
|
||||
You can set a description template at the **instance level** for issues
|
||||
and merge requests.
|
||||
|
@ -132,11 +128,7 @@ Learn more about [instance template repository](../admin_area/settings/instance_
|
|||
### Set group-level description templates **(PREMIUM)**
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52360) in GitLab 13.9.
|
||||
> - [Deployed behind a feature flag](../feature_flags.md), disabled by default.
|
||||
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56737) in GitLab 13.11.
|
||||
> - Enabled by default on GitLab.com.
|
||||
> - Recommended for production use.
|
||||
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-issue-and-merge-request-description-templates-at-group-and-instance-level). **(PREMIUM SELF)**
|
||||
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/321247) in GitLab 14.0.
|
||||
|
||||
With **group-level** description templates, you can store your templates in a single repository and
|
||||
configure the group file templates setting to point to that repository.
|
||||
|
@ -231,28 +223,3 @@ it's very hard to read otherwise.)
|
|||
/cc @project-manager
|
||||
/assign @qa-tester
|
||||
```
|
||||
|
||||
## Enable or disable issue and merge request description templates at group and instance level **(PREMIUM SELF)**
|
||||
|
||||
Setting issue and merge request description templates at group and instance levels
|
||||
is under development but ready for production use. It is deployed behind a
|
||||
feature flag that is **enabled by default**.
|
||||
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
|
||||
can disable it.
|
||||
|
||||
To disable it:
|
||||
|
||||
```ruby
|
||||
Feature.disable(:inherited_issuable_templates)
|
||||
```
|
||||
|
||||
To enable it:
|
||||
|
||||
```ruby
|
||||
Feature.enable(:inherited_issuable_templates)
|
||||
```
|
||||
|
||||
The feature flag affects these features:
|
||||
|
||||
- Setting a templates project as issue and merge request description templates source at group level.
|
||||
- Setting a templates project as issue and merge request description templates source at instance level.
|
||||
|
|
|
@ -26,7 +26,7 @@ module API
|
|||
use :pagination
|
||||
end
|
||||
get ':id/templates/:type' do
|
||||
templates = TemplateFinder.all_template_names_array(user_project, params[:type])
|
||||
templates = TemplateFinder.all_template_names(user_project, params[:type]).values.flatten
|
||||
|
||||
present paginate(::Kaminari.paginate_array(templates)), with: Entities::TemplatesList
|
||||
end
|
||||
|
|
|
@ -12109,9 +12109,6 @@ msgstr ""
|
|||
msgid "Enable"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable %{linkStart}Gitpod%{linkEnd} integration to launch a development environment in your browser directly from GitLab."
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable Auto DevOps"
|
||||
msgstr ""
|
||||
|
||||
|
@ -15337,16 +15334,19 @@ msgstr ""
|
|||
msgid "Gitpod"
|
||||
msgstr ""
|
||||
|
||||
msgid "Gitpod|Add the URL to your Gitpod instance configured to read your GitLab projects."
|
||||
msgstr ""
|
||||
|
||||
msgid "Gitpod|Enable Gitpod integration"
|
||||
msgstr ""
|
||||
|
||||
msgid "Gitpod|Gitpod URL"
|
||||
msgstr ""
|
||||
|
||||
msgid "Gitpod|e.g. https://gitpod.example.com"
|
||||
msgid "Gitpod|The URL to your Gitpod instance configured to read your GitLab projects, such as https://gitpod.example.com."
|
||||
msgstr ""
|
||||
|
||||
msgid "Gitpod|To use the integration, each user must also enable Gitpod on their GitLab account. %{link_start}How do I enable it?%{link_end} "
|
||||
msgstr ""
|
||||
|
||||
msgid "Gitpod|https://gitpod.example.com"
|
||||
msgstr ""
|
||||
|
||||
msgid "Given access %{time_ago}"
|
||||
|
@ -35787,6 +35787,9 @@ msgstr ""
|
|||
msgid "Users"
|
||||
msgstr ""
|
||||
|
||||
msgid "Users can launch a development environment from a GitLab browser tab when the %{linkStart}Gitpod%{linkEnd} integration is enabled."
|
||||
msgstr ""
|
||||
|
||||
msgid "Users in License"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -160,28 +160,12 @@ RSpec.describe Projects::TemplatesController do
|
|||
end
|
||||
|
||||
shared_examples 'template names request' do
|
||||
context 'when feature flag enabled' do
|
||||
it 'returns the template names', :aggregate_failures do
|
||||
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
|
||||
it 'returns the template names', :aggregate_failures do
|
||||
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['Project Templates'].size).to eq(2)
|
||||
expect(json_response['Project Templates'].map { |x| x.slice('name') }).to match(expected_template_names)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag disabled' do
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: false)
|
||||
end
|
||||
|
||||
it 'returns the template names', :aggregate_failures do
|
||||
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response.size).to eq(2)
|
||||
expect(json_response.map { |x| x.slice('name') }).to match(expected_template_names)
|
||||
end
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['Project Templates'].size).to eq(2)
|
||||
expect(json_response['Project Templates'].map { |x| x.slice('name') }).to match(expected_template_names)
|
||||
end
|
||||
|
||||
it 'fails for user with no access' do
|
||||
|
|
|
@ -89,25 +89,10 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache do
|
|||
before do
|
||||
stub_licensed_features(custom_file_templates_for_namespace: false, custom_file_templates: false)
|
||||
group.update_columns(file_template_project_id: group_template_repo.id)
|
||||
visit edit_project_path(project)
|
||||
end
|
||||
|
||||
context 'when inherited_issuable_templates enabled' do
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: true)
|
||||
visit edit_project_path(project)
|
||||
end
|
||||
|
||||
it_behaves_like 'issue description templates from current project only'
|
||||
end
|
||||
|
||||
context 'when inherited_issuable_templates disabled' do
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: false)
|
||||
visit edit_project_path(project)
|
||||
end
|
||||
|
||||
it_behaves_like 'issue description templates from current project only'
|
||||
end
|
||||
it_behaves_like 'issue description templates from current project only'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,24 +13,8 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do
|
|||
let_it_be(:group_member) { create(:group_member, :developer, group: parent_group, user: user) }
|
||||
let_it_be(:project_member) { create(:project_member, :developer, user: user, project: project) }
|
||||
|
||||
context 'when feature flag disabled' do
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: false)
|
||||
end
|
||||
|
||||
it 'returns empty array when template type does not exist' do
|
||||
expect(helper.issuable_templates(project, 'non-existent-template-type')).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag enabled' do
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: true)
|
||||
end
|
||||
|
||||
it 'returns empty hash when template type does not exist' do
|
||||
expect(helper.issuable_templates(build(:project), 'non-existent-template-type')).to eq({})
|
||||
end
|
||||
it 'returns empty hash when template type does not exist' do
|
||||
expect(helper.issuable_templates(build(:project), 'non-existent-template-type')).to eq({})
|
||||
end
|
||||
|
||||
context 'with cached issuable templates' do
|
||||
|
@ -81,16 +65,18 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do
|
|||
allow(helper).to receive(:issuable_templates).and_return(templates)
|
||||
end
|
||||
|
||||
context 'when feature flag disabled' do
|
||||
context 'with matching project templates' do
|
||||
let(:templates) do
|
||||
[
|
||||
{ name: "another_issue_template", id: "another_issue_template", project_id: project.id },
|
||||
{ name: "custom_issue_template", id: "custom_issue_template", project_id: project.id }
|
||||
]
|
||||
end
|
||||
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: false)
|
||||
{
|
||||
"" => [
|
||||
{ name: "another_issue_template", id: "another_issue_template", project_id: project.id },
|
||||
{ name: "custom_issue_template", id: "custom_issue_template", project_id: project.id }
|
||||
],
|
||||
"Instance" => [
|
||||
{ name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id },
|
||||
{ name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id }
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
it 'returns project templates only' do
|
||||
|
@ -98,47 +84,22 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when feature flag enabled' do
|
||||
before do
|
||||
stub_feature_flags(inherited_issuable_templates: true)
|
||||
context 'without matching project templates' do
|
||||
let(:templates) do
|
||||
{
|
||||
"Project Templates" => [
|
||||
{ name: "another_issue_template", id: "another_issue_template", project_id: non_existing_record_id },
|
||||
{ name: "custom_issue_template", id: "custom_issue_template", project_id: non_existing_record_id }
|
||||
],
|
||||
"Instance" => [
|
||||
{ name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id },
|
||||
{ name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id }
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
context 'with matching project templates' do
|
||||
let(:templates) do
|
||||
{
|
||||
"" => [
|
||||
{ name: "another_issue_template", id: "another_issue_template", project_id: project.id },
|
||||
{ name: "custom_issue_template", id: "custom_issue_template", project_id: project.id }
|
||||
],
|
||||
"Instance" => [
|
||||
{ name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id },
|
||||
{ name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id }
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
it 'returns project templates only' do
|
||||
expect(helper.issuable_templates_names(Issue.new)).to eq(%w[another_issue_template custom_issue_template])
|
||||
end
|
||||
end
|
||||
|
||||
context 'without matching project templates' do
|
||||
let(:templates) do
|
||||
{
|
||||
"Project Templates" => [
|
||||
{ name: "another_issue_template", id: "another_issue_template", project_id: non_existing_record_id },
|
||||
{ name: "custom_issue_template", id: "custom_issue_template", project_id: non_existing_record_id }
|
||||
],
|
||||
"Instance" => [
|
||||
{ name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id },
|
||||
{ name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id }
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
it 'returns empty array' do
|
||||
expect(helper.issuable_templates_names(Issue.new)).to eq([])
|
||||
end
|
||||
it 'returns empty array' do
|
||||
expect(helper.issuable_templates_names(Issue.new)).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue