Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-06-25 00:08:03 +00:00
parent e09931576b
commit af770ba828
23 changed files with 365 additions and 307 deletions

View File

@ -244,7 +244,7 @@ export default {
</template>
</gl-sprintf>
</template>
<div class="mt-2">
<div class="gl-mt-3">
<gl-search-box-by-type
ref="searchInput"
:placeholder="__(`Search by commit title or SHA`)"

View File

@ -78,6 +78,10 @@ class Import::BitbucketController < Import::BaseController
bitbucket_repos.reject { |repo| repo.valid? }
end
def provider_url
nil
end
override :provider_name
def provider_name
:bitbucket

View File

@ -322,7 +322,7 @@ module Ci
def expire_in=(value)
self.expire_at =
if value
::Gitlab::Ci::Build::Artifacts::ExpireInParser.new(value).seconds_from_now
::Gitlab::Ci::Build::DurationParser.new(value).seconds_from_now
end
end

View File

@ -468,7 +468,7 @@ class ContainerRepository < ApplicationRecord
def size
strong_memoize(:size) do
next unless Gitlab.com?
next if self.created_at.before?(MIGRATION_PHASE_1_STARTED_AT)
next if self.created_at.before?(MIGRATION_PHASE_1_STARTED_AT) && self.migration_state != 'import_done'
next unless gitlab_api_client.supports_gitlab_api?
gitlab_api_client.repository_details(self.path, sizing: :self)['size_bytes']

View File

@ -11,7 +11,7 @@ class SearchService
def initialize(current_user, params = {})
@current_user = current_user
@params = Gitlab::Search::Params.new(params, detect_abuse: prevent_abusive_searches?)
@params = Gitlab::Search::Params.new(params, detect_abuse: true)
end
# rubocop: disable CodeReuse/ActiveRecord
@ -93,10 +93,6 @@ class SearchService
private
def prevent_abusive_searches?
Feature.enabled?(:prevent_abusive_searches, current_user)
end
def page
[1, params[:page].to_i].max
end

View File

@ -1,8 +0,0 @@
---
name: prevent_abusive_searches
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74953
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/346263
milestone: '14.6'
type: development
group: group::global search
default_enabled: false

View File

@ -84,15 +84,8 @@ its performance:
## Global Search validation
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/346263) in GitLab 14.6 [with a flag](../../administration/feature_flags.md) named `prevent_abusive_searches`. Disabled by default.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available,
ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `prevent_abusive_searches`.
The feature is not ready for production use.
To prevent abusive searches, such as searches that may result in a Distributed Denial of Service (DDoS), Global Search ignores, logs, and
doesn't return any results for searches considered abusive according to the following criteria, if `prevent_abusive_searches` feature flag is enabled:
doesn't return any results for searches considered abusive according to the following criteria:
- Searches with less than 2 characters.
- Searches with any term greater than 100 characters. URL search terms have a maximum of 200 characters.
@ -101,8 +94,7 @@ doesn't return any results for searches considered abusive according to the foll
- Searches with a `repository_ref` or `project_ref` parameter that has special characters not allowed by [Git refname](https://git-scm.com/docs/git-check-ref-format).
- Searches with a `scope` that is unknown.
Regardless of the status of the `prevent_abusive_searches` feature flag, searches that don't
comply with the criteria described below aren't logged as abusive but are flagged with an error:
Searches that don't comply with the criteria described below aren't logged as abusive but are flagged with an error:
- Searches with more than 4096 characters.
- Searches with more than 64 terms.

View File

@ -833,82 +833,82 @@
05_02__container_blocks__list_items__048:
spec_txt_example_position: 278
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__049:
05_04__container_blocks__lists__001:
spec_txt_example_position: 281
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__050:
05_04__container_blocks__lists__002:
spec_txt_example_position: 282
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__051:
05_04__container_blocks__lists__003:
spec_txt_example_position: 283
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__052:
05_04__container_blocks__lists__004:
spec_txt_example_position: 284
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__053:
05_04__container_blocks__lists__005:
spec_txt_example_position: 285
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__054:
05_04__container_blocks__lists__006:
spec_txt_example_position: 286
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__055:
05_04__container_blocks__lists__007:
spec_txt_example_position: 287
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__056:
05_04__container_blocks__lists__008:
spec_txt_example_position: 288
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__057:
05_04__container_blocks__lists__009:
spec_txt_example_position: 289
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__058:
05_04__container_blocks__lists__010:
spec_txt_example_position: 290
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__059:
05_04__container_blocks__lists__011:
spec_txt_example_position: 291
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__060:
05_04__container_blocks__lists__012:
spec_txt_example_position: 292
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__061:
05_04__container_blocks__lists__013:
spec_txt_example_position: 293
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__062:
05_04__container_blocks__lists__014:
spec_txt_example_position: 294
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__063:
05_04__container_blocks__lists__015:
spec_txt_example_position: 295
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__064:
05_04__container_blocks__lists__016:
spec_txt_example_position: 296
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__065:
05_04__container_blocks__lists__017:
spec_txt_example_position: 297
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__066:
05_04__container_blocks__lists__018:
spec_txt_example_position: 298
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__067:
05_04__container_blocks__lists__019:
spec_txt_example_position: 299
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__068:
05_04__container_blocks__lists__020:
spec_txt_example_position: 300
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__069:
05_04__container_blocks__lists__021:
spec_txt_example_position: 301
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__070:
05_04__container_blocks__lists__022:
spec_txt_example_position: 302
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__071:
05_04__container_blocks__lists__023:
spec_txt_example_position: 303
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__072:
05_04__container_blocks__lists__024:
spec_txt_example_position: 304
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__073:
05_04__container_blocks__lists__025:
spec_txt_example_position: 305
source_specification: commonmark
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__074:
05_04__container_blocks__lists__026:
spec_txt_example_position: 306
source_specification: commonmark
06_01__inlines__001:

View File

@ -4031,21 +4031,8 @@
wysiwyg: |-
<ul bullet="*"><li><p></p><h1>Foo</h1></li><li><p></p><h2>Bar</h2><p>
baz</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__049:
05_04__container_blocks__lists__001:
canonical: |
<ul>
<li><input disabled="" type="checkbox"> foo</li>
<li><input checked="" disabled="" type="checkbox"> bar</li>
</ul>
<ul>
<li><input checked="" disabled="" type="checkbox"> foo
<ul>
<li><input disabled="" type="checkbox"> bar</li>
<li><input checked="" disabled="" type="checkbox"> baz</li>
</ul>
</li>
<li><input disabled="" type="checkbox"> bim</li>
</ul>
<ul>
<li>foo</li>
<li>bar</li>
@ -4054,32 +4041,16 @@
<li>baz</li>
</ul>
static: |-
<ul data-sourcepos="1:1-8:5" class="task-list" dir="auto">
<li data-sourcepos="1:1-1:9" class="task-list-item">
<task-button></task-button><input type="checkbox" class="task-list-item-checkbox" disabled> foo</li>
<li data-sourcepos="2:1-2:9" class="task-list-item">
<task-button></task-button><input type="checkbox" class="task-list-item-checkbox" checked disabled> bar</li>
<li data-sourcepos="3:1-5:11" class="task-list-item">
<task-button></task-button><input type="checkbox" class="task-list-item-checkbox" checked disabled> foo
<ul data-sourcepos="4:3-5:11" class="task-list">
<li data-sourcepos="4:3-4:11" class="task-list-item">
<task-button></task-button><input type="checkbox" class="task-list-item-checkbox" disabled> bar</li>
<li data-sourcepos="5:3-5:11" class="task-list-item">
<task-button></task-button><input type="checkbox" class="task-list-item-checkbox" checked disabled> baz</li>
<ul data-sourcepos="1:1-2:5" dir="auto">
<li data-sourcepos="1:1-1:5">foo</li>
<li data-sourcepos="2:1-2:5">bar</li>
</ul>
</li>
<li data-sourcepos="6:1-6:9" class="task-list-item">
<task-button></task-button><input type="checkbox" class="task-list-item-checkbox" disabled> bim</li>
<li data-sourcepos="7:1-7:5">foo</li>
<li data-sourcepos="8:1-8:5">bar</li>
</ul>
<ul data-sourcepos="9:1-9:5" dir="auto">
<li data-sourcepos="9:1-9:5">baz</li>
<ul data-sourcepos="3:1-3:5" dir="auto">
<li data-sourcepos="3:1-3:5">baz</li>
</ul>
wysiwyg: |-
Error - check implementation:
Cannot read properties of undefined (reading 'start')
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__050:
<ul bullet="*"><li><p>foo</p></li><li><p>bar</p></li></ul>
05_04__container_blocks__lists__002:
canonical: |
<ol>
<li>foo</li>
@ -4098,7 +4069,7 @@
</ol>
wysiwyg: |-
<ol parens="false"><li><p>foo</p></li><li><p>bar</p></li></ol>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__051:
05_04__container_blocks__lists__003:
canonical: |
<p>Foo</p>
<ul>
@ -4113,7 +4084,7 @@
</ul>
wysiwyg: |-
<p>Foo</p>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__052:
05_04__container_blocks__lists__004:
canonical: |
<p>The number of windows in my house is
14. The number of doors is 6.</p>
@ -4123,7 +4094,7 @@
wysiwyg: |-
<p>The number of windows in my house is
14. The number of doors is 6.</p>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__053:
05_04__container_blocks__lists__005:
canonical: |
<p>The number of windows in my house is</p>
<ol>
@ -4136,7 +4107,7 @@
</ol>
wysiwyg: |-
<p>The number of windows in my house is</p>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__054:
05_04__container_blocks__lists__006:
canonical: |
<ul>
<li>
@ -4163,7 +4134,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>foo</p></li><li><p>bar</p></li><li><p>baz</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__055:
05_04__container_blocks__lists__007:
canonical: |
<ul>
<li>foo
@ -4196,7 +4167,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>foo</p><ul bullet="*"><li><p>bar</p><ul bullet="*"><li><p>baz</p><p>bim</p></li></ul></li></ul></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__056:
05_04__container_blocks__lists__008:
canonical: |
<ul>
<li>foo</li>
@ -4220,7 +4191,7 @@
wysiwyg: |-
Error - check implementation:
Cannot destructure property 'className' of 'hastNode.properties' as it is undefined.
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__057:
05_04__container_blocks__lists__009:
canonical: |
<ul>
<li>
@ -4252,7 +4223,7 @@
wysiwyg: |-
Error - check implementation:
Cannot destructure property 'className' of 'hastNode.properties' as it is undefined.
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__058:
05_04__container_blocks__lists__010:
canonical: |
<ul>
<li>a</li>
@ -4275,7 +4246,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li><li><p>b</p></li><li><p>c</p></li><li><p>d</p></li><li><p>e</p></li><li><p>f</p></li><li><p>g</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__059:
05_04__container_blocks__lists__011:
canonical: |
<ol>
<li>
@ -4302,7 +4273,7 @@
</ol>
wysiwyg: |-
<ol parens="false"><li><p>a</p></li><li><p>b</p></li><li><p>c</p></li></ol>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__060:
05_04__container_blocks__lists__012:
canonical: |
<ul>
<li>a</li>
@ -4322,7 +4293,7 @@
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li><li><p>b</p></li><li><p>c</p></li><li><p>d
- e</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__061:
05_04__container_blocks__lists__013:
canonical: |
<ol>
<li>
@ -4349,7 +4320,7 @@
</div>
wysiwyg: |-
<ol parens="false"><li><p>a</p></li><li><p>b</p></li></ol>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__062:
05_04__container_blocks__lists__014:
canonical: |
<ul>
<li>
@ -4376,7 +4347,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li><li><p>b</p></li><li><p>c</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__063:
05_04__container_blocks__lists__015:
canonical: |
<ul>
<li>
@ -4400,7 +4371,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li><li><p></p></li><li><p>c</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__064:
05_04__container_blocks__lists__016:
canonical: |
<ul>
<li>
@ -4429,7 +4400,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li><li><p>b</p><p>c</p></li><li><p>d</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__065:
05_04__container_blocks__lists__017:
canonical: |
<ul>
<li>
@ -4456,7 +4427,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li><li><p>b</p></li><li><p>d</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__066:
05_04__container_blocks__lists__018:
canonical: |
<ul>
<li>a</li>
@ -4485,7 +4456,7 @@
<ul bullet="*"><li><p>a</p></li><li><p></p><pre class="content-editor-code-block undefined code highlight"><code>b
</code></pre></li><li><p>c</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__067:
05_04__container_blocks__lists__019:
canonical: |
<ul>
<li>a
@ -4512,7 +4483,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p><ul bullet="*"><li><p>b</p><p>c</p></li></ul></li><li><p>d</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__068:
05_04__container_blocks__lists__020:
canonical: |
<ul>
<li>a
@ -4533,7 +4504,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p><blockquote multiline="false"><p>b</p></blockquote></li><li><p>c</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__069:
05_04__container_blocks__lists__021:
canonical: |
<ul>
<li>a
@ -4560,7 +4531,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p><blockquote multiline="false"><p>b</p></blockquote><pre class="content-editor-code-block undefined code highlight"><code>c</code></pre></li><li><p>d</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__070:
05_04__container_blocks__lists__022:
canonical: |
<ul>
<li>a</li>
@ -4571,7 +4542,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__071:
05_04__container_blocks__lists__023:
canonical: |
<ul>
<li>a
@ -4590,7 +4561,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>a</p><ul bullet="*"><li><p>b</p></li></ul></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__072:
05_04__container_blocks__lists__024:
canonical: |
<ol>
<li>
@ -4611,7 +4582,7 @@
</ol>
wysiwyg: |-
<ol parens="false"><li><p></p><pre class="content-editor-code-block undefined code highlight"><code>foo</code></pre><p>bar</p></li></ol>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__073:
05_04__container_blocks__lists__025:
canonical: |
<ul>
<li>
@ -4634,7 +4605,7 @@
</ul>
wysiwyg: |-
<ul bullet="*"><li><p>foo</p><ul bullet="*"><li><p>bar</p></li></ul><p>baz</p></li></ul>
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__074:
05_04__container_blocks__lists__026:
canonical: |
<ul>
<li>
@ -7463,11 +7434,11 @@
07_01__gitlab_specific_markdown__footnotes__001:
canonical: ""
static: |-
<p data-sourcepos="1:1-1:27" dir="auto">footnote reference tag <sup class="footnote-ref"><a href="#fn-1-5616" id="fnref-1-5616" data-footnote-ref>1</a></sup></p>
<p data-sourcepos="1:1-1:27" dir="auto">footnote reference tag <sup class="footnote-ref"><a href="#fn-1-4281" id="fnref-1-4281" data-footnote-ref>1</a></sup></p>
<section data-footnotes class="footnotes">
<ol>
<li id="fn-1-5616">
<p data-sourcepos="3:7-3:19">footnote text <a href="#fnref-1-5616" data-footnote-backref aria-label="Back to content" class="footnote-backref"><gl-emoji title="leftwards arrow with hook" data-name="leftwards_arrow_with_hook" data-unicode-version="1.1">↩</gl-emoji></a></p>
<li id="fn-1-4281">
<p data-sourcepos="3:7-3:19">footnote text <a href="#fnref-1-4281" data-footnote-backref aria-label="Back to content" class="footnote-backref"><gl-emoji title="leftwards arrow with hook" data-name="leftwards_arrow_with_hook" data-unicode-version="1.1">↩</gl-emoji></a></p>
</li>
</ol>
</section>

View File

@ -1112,45 +1112,39 @@
- Bar
---
baz
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__049: |
- [ ] foo
- [x] bar
- [x] foo
- [ ] bar
- [x] baz
- [ ] bim
05_04__container_blocks__lists__001: |
- foo
- bar
+ baz
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__050: |
05_04__container_blocks__lists__002: |
1. foo
2. bar
3) baz
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__051: |
05_04__container_blocks__lists__003: |
Foo
- bar
- baz
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__052: |
05_04__container_blocks__lists__004: |
The number of windows in my house is
14. The number of doors is 6.
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__053: |
05_04__container_blocks__lists__005: |
The number of windows in my house is
1. The number of doors is 6.
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__054: |
05_04__container_blocks__lists__006: |
- foo
- bar
- baz
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__055: |
05_04__container_blocks__lists__007: |
- foo
- bar
- baz
bim
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__056: |
05_04__container_blocks__lists__008: |
- foo
- bar
@ -1158,7 +1152,7 @@
- baz
- bim
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__057: |
05_04__container_blocks__lists__009: |
- foo
notcode
@ -1168,7 +1162,7 @@
<!-- -->
code
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__058: |
05_04__container_blocks__lists__010: |
- a
- b
- c
@ -1176,47 +1170,47 @@
- e
- f
- g
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__059: |
05_04__container_blocks__lists__011: |
1. a
2. b
3. c
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__060: |
05_04__container_blocks__lists__012: |
- a
- b
- c
- d
- e
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__061: |
05_04__container_blocks__lists__013: |
1. a
2. b
3. c
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__062: |
05_04__container_blocks__lists__014: |
- a
- b
- c
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__063: |
05_04__container_blocks__lists__015: |
* a
*
* c
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__064: |
05_04__container_blocks__lists__016: |
- a
- b
c
- d
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__065: |
05_04__container_blocks__lists__017: |
- a
- b
[ref]: /url
- d
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__066: |
05_04__container_blocks__lists__018: |
- a
- ```
b
@ -1224,41 +1218,41 @@
```
- c
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__067: |
05_04__container_blocks__lists__019: |
- a
- b
c
- d
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__068: |
05_04__container_blocks__lists__020: |
* a
> b
>
* c
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__069: |
05_04__container_blocks__lists__021: |
- a
> b
```
c
```
- d
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__070: |
05_04__container_blocks__lists__022: |
- a
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__071: |
05_04__container_blocks__lists__023: |
- a
- b
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__072: |
05_04__container_blocks__lists__024: |
1. ```
foo
```
bar
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__073: |
05_04__container_blocks__lists__025: |
* foo
* bar
baz
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__074: |
05_04__container_blocks__lists__026: |
- a
- b
- c

View File

@ -7997,10 +7997,71 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__049: |-
Error - check implementation:
Cannot read properties of undefined (reading 'start')
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__050: |-
05_04__container_blocks__lists__001: |-
{
"type": "doc",
"content": [
{
"type": "bulletList",
"attrs": {
"bullet": "*"
},
"content": [
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "foo"
}
]
}
]
},
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "bar"
}
]
}
]
}
]
},
{
"type": "bulletList",
"attrs": {
"bullet": "*"
},
"content": [
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "baz"
}
]
}
]
}
]
}
]
}
05_04__container_blocks__lists__002: |-
{
"type": "doc",
"content": [
@ -8066,7 +8127,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__051: |-
05_04__container_blocks__lists__003: |-
{
"type": "doc",
"content": [
@ -8117,7 +8178,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__052: |-
05_04__container_blocks__lists__004: |-
{
"type": "doc",
"content": [
@ -8132,7 +8193,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__053: |-
05_04__container_blocks__lists__005: |-
{
"type": "doc",
"content": [
@ -8170,7 +8231,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__054: |-
05_04__container_blocks__lists__006: |-
{
"type": "doc",
"content": [
@ -8226,7 +8287,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__055: |-
05_04__container_blocks__lists__007: |-
{
"type": "doc",
"content": [
@ -8307,13 +8368,13 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__056: |-
05_04__container_blocks__lists__008: |-
Error - check implementation:
Cannot destructure property 'className' of 'hastNode.properties' as it is undefined.
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__057: |-
05_04__container_blocks__lists__009: |-
Error - check implementation:
Cannot destructure property 'className' of 'hastNode.properties' as it is undefined.
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__058: |-
05_04__container_blocks__lists__010: |-
{
"type": "doc",
"content": [
@ -8425,7 +8486,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__059: |-
05_04__container_blocks__lists__011: |-
{
"type": "doc",
"content": [
@ -8482,7 +8543,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__060: |-
05_04__container_blocks__lists__012: |-
{
"type": "doc",
"content": [
@ -8552,7 +8613,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__061: |-
05_04__container_blocks__lists__013: |-
{
"type": "doc",
"content": [
@ -8608,7 +8669,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__062: |-
05_04__container_blocks__lists__014: |-
{
"type": "doc",
"content": [
@ -8664,7 +8725,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__063: |-
05_04__container_blocks__lists__015: |-
{
"type": "doc",
"content": [
@ -8714,7 +8775,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__064: |-
05_04__container_blocks__lists__016: |-
{
"type": "doc",
"content": [
@ -8779,7 +8840,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__065: |-
05_04__container_blocks__lists__017: |-
{
"type": "doc",
"content": [
@ -8835,7 +8896,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__066: |-
05_04__container_blocks__lists__018: |-
{
"type": "doc",
"content": [
@ -8898,7 +8959,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__067: |-
05_04__container_blocks__lists__019: |-
{
"type": "doc",
"content": [
@ -8971,7 +9032,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__068: |-
05_04__container_blocks__lists__020: |-
{
"type": "doc",
"content": [
@ -9030,7 +9091,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__069: |-
05_04__container_blocks__lists__021: |-
{
"type": "doc",
"content": [
@ -9102,7 +9163,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__070: |-
05_04__container_blocks__lists__022: |-
{
"type": "doc",
"content": [
@ -9130,7 +9191,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__071: |-
05_04__container_blocks__lists__023: |-
{
"type": "doc",
"content": [
@ -9180,7 +9241,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__072: |-
05_04__container_blocks__lists__024: |-
{
"type": "doc",
"content": [
@ -9225,7 +9286,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__073: |-
05_04__container_blocks__lists__025: |-
{
"type": "doc",
"content": [
@ -9284,7 +9345,7 @@
}
]
}
05_02__container_blocks__list_items__motivation__task_list_items_extension__lists__074: |-
05_04__container_blocks__lists__026: |-
{
"type": "doc",
"content": [

View File

@ -1,59 +0,0 @@
# frozen_string_literal: true
module Gitlab
module Ci
module Build
module Artifacts
class ExpireInParser
def self.validate_duration(value)
new(value).validate_duration
end
def initialize(value)
@value = value
end
def validate_duration
return true if never?
cached_parse
end
def seconds_from_now
parse&.seconds&.from_now
end
private
attr_reader :value
def cached_parse
return validation_cache[value] if validation_cache.key?(value)
validation_cache[value] = safe_parse
end
def safe_parse
parse
rescue ChronicDuration::DurationParseError
false
end
def parse
return if never?
ChronicDuration.parse(value)
end
def validation_cache
Gitlab::SafeRequestStore[:ci_expire_in_parser_cache] ||= {}
end
def never?
value.to_s.casecmp('never') == 0
end
end
end
end
end
end

View File

@ -0,0 +1,57 @@
# frozen_string_literal: true
module Gitlab
module Ci
module Build
class DurationParser
def self.validate_duration(value)
new(value).validate_duration
end
def initialize(value)
@value = value
end
def validate_duration
return true if never?
cached_parse
end
def seconds_from_now
parse&.seconds&.from_now
end
private
attr_reader :value
def cached_parse
return validation_cache[value] if validation_cache.key?(value)
validation_cache[value] = safe_parse
end
def safe_parse
parse
rescue ChronicDuration::DurationParseError
false
end
def parse
return if never?
ChronicDuration.parse(value)
end
def validation_cache
Gitlab::SafeRequestStore[:ci_expire_in_parser_cache] ||= {}
end
def never?
value.to_s.casecmp('never') == 0
end
end
end
end
end

View File

@ -42,7 +42,7 @@ module Gitlab
inclusion: { in: %w[on_success on_failure always],
message: 'should be on_success, on_failure ' \
'or always' }
validates :expire_in, duration: { parser: ::Gitlab::Ci::Build::Artifacts::ExpireInParser }
validates :expire_in, duration: { parser: ::Gitlab::Ci::Build::DurationParser }
end
end

View File

@ -13,7 +13,11 @@
# 1. Capture all nested headers, not just the most recent.
# 2. Raise an exception if an unexpected state is encountered.
#
# Comments indicate where changes or additions were made.
# Comments indicate where changes, deletions, or additions were made.
#
# See more detailed documentation of rules regarding the handling of headers
# in the comments at the top of `Glfm::UpdateExampleSnapshots#add_example_names`,
# in `scripts/lib/glfm/update_example_snapshots.rb`
module Glfm
module ParseExamples
REGULAR_TEXT = 0
@ -37,6 +41,7 @@ module Glfm
h1_regex = /\A# / # new logic compared to original Python code
h2_regex = /\A## / # new logic compared to original Python code
h3_regex = /\A### / # new logic compared to original Python code
header_regex = /\A#+ / # Added beginning of line anchor to original Python code
spec_txt_lines.each do |line|
@ -51,22 +56,29 @@ module Glfm
state = REGULAR_TEXT
example_number += 1
end_line = line_number
unless extensions.include?('disabled')
tests <<
{
markdown: markdown_lines.join.tr('→', "\t"),
html: html_lines.join.tr('→', "\t"),
example: example_number,
start_line: start_line,
end_line: end_line,
section: headertext,
extensions: extensions,
headers: headers.dup # new logic compared to original Python code
}
start_line = 0
markdown_lines = []
html_lines = []
end
# NOTE: The original implementation completely excludes disabled examples, but we need
# to include them in order to correctly count the header numbering, so we set a flag
# instead. This will need to be accounted for when we run conformance testing.
# unless extensions.include?('disabled') # commented logic compared to original Python code
tests <<
{
markdown: markdown_lines.join.tr('→', "\t"),
html: html_lines.join.tr('→', "\t"),
example: example_number,
start_line: start_line,
end_line: end_line,
section: headertext,
extensions: extensions,
headers: headers.dup, # new logic compared to original Python code
disabled: extensions.include?('disabled') # new logic compared to original Python code
}
# end # commented logic compared to original Python code
start_line = 0
markdown_lines = []
html_lines = []
elsif stripped_line == "."
# Else if the example divider line...
state = HTML_OUTPUT
@ -80,16 +92,27 @@ module Glfm
html_lines.append(line)
elsif state == REGULAR_TEXT && line =~ header_regex
# Else if we are in regular text and it is a header line
# NOTE: This assumes examples are only nested up to 2 levels deep (H2)
# NOTE: This assumes examples are within the section under
# Heading level 2 with Heading levels above 2 ignored
# Extract the header text from the line
headertext = line.gsub(header_regex, '').strip
# reset the headers array if we found a new H1
headers = [] if line =~ h1_regex # new logic compared to original Python code
# The 'headers' array is new logic compared to the original Python code
# pop the last entry from the headers array if we found a new H2
headers.pop if headers.length == 2 && line =~ h2_regex # new logic compared to original Python code
# reset the headers array if we found a new H1
headers = [] if line =~ h1_regex
if headers.length == 2 && line =~ h2_regex
# pop the last entry from the headers array if we are in an H2 and found a new H2
headers.pop
elsif headers.length == 3 && line =~ h3_regex
# pop the last entry from the headers array if we are in an H3 and found a new H3
headers.pop
elsif headers.length == 3 && line =~ h2_regex
# pop the last two entries from the headers array if we are in an H3 and found a new H2
headers.pop(2)
end
# push the new header text to the headers array
headers << headertext # New logic compared to original Python code

View File

@ -40,18 +40,27 @@ module Glfm
add_example_names(all_examples)
reject_disabled_examples(all_examples)
write_snapshot_example_files(all_examples, skip_static_and_wysiwyg: skip_static_and_wysiwyg)
end
private
def add_example_names(all_examples)
# NOTE: This method assumes:
# NOTE: This method and the parse_examples method assume:
# 1. Section 2 is the first section which contains examples
# 2. Examples are always nested exactly than 2 levels deep in an H2
# 3. We assume that the Appendix doesn't ever contain any examples, so it doesn't show up
# 2. Examples are always nested exactly 2 levels deep in an H2
# 3. There may exist H3 headings with no examples (e.g. "Motivation" in the GLFM spec.txt)
# 4. The Appendix doesn't ever contain any examples, so it doesn't show up
# in the H1 header count. So, even though due to the concatenation it appears before the
# GitLab examples sections, it doesn't result in their header counts being off by +1.
# 5. If an example contains the 'disabled' string extension, it is skipped (and will thus
# result in a skip in the `spec_txt_example_position`). This behavior is taken from the
# GFM `spec_test.py` script (but it's NOT in the original CommonMark `spec_test.py`).
# 6. If a section contains ONLY disabled examples, the section numbering will still be
# incremented to match the rendered HTML specification section numbering.
# 7. Every H2 must contain at least one example, but it is allowed that they are all disabled.
h1_count = 1 # examples start in H1 section 2; section 1 is the overview with no examples.
h2_count = 0
@ -86,6 +95,10 @@ module Glfm
end
end
def reject_disabled_examples(all_examples)
all_examples.reject! { |example| example[:disabled] }
end
def write_snapshot_example_files(all_examples, skip_static_and_wysiwyg:)
output("Reading #{GLFM_EXAMPLE_STATUS_YML_PATH}...")
glfm_examples_statuses = YAML.safe_load(File.open(GLFM_EXAMPLE_STATUS_YML_PATH))

View File

@ -97,7 +97,6 @@ RSpec.describe Import::BitbucketController do
before do
@repo = double(name: 'vim', slug: 'vim', owner: 'asd', full_name: 'asd/vim', clone_url: 'http://test.host/demo/url.git', 'valid?' => true)
@invalid_repo = double(name: 'mercurialrepo', slug: 'mercurialrepo', owner: 'asd', full_name: 'asd/mercurialrepo', clone_url: 'http://test.host/demo/mercurialrepo.git', 'valid?' => false)
allow(controller).to receive(:provider_url).and_return('http://demobitbucket.org')
end
context "when token does not exists" do
@ -124,10 +123,6 @@ RSpec.describe Import::BitbucketController do
end
it_behaves_like 'import controller status' do
before do
allow(controller).to receive(:provider_url).and_return('http://demobitbucket.org')
end
let(:repo) { @repo }
let(:repo_id) { @repo.full_name }
let(:import_source) { @repo.full_name }

View File

@ -439,18 +439,6 @@ RSpec.describe SearchController do
make_abusive_request
expect(response).to have_gitlab_http_status(:ok)
end
context 'when the feature flag is disabled' do
before do
stub_feature_flags(prevent_abusive_searches: false)
end
it 'returns a regular search result' do
expect(Gitlab::EmptySearchResults).not_to receive(:new)
make_abusive_request
expect(response).to have_gitlab_http_status(:ok)
end
end
end
end

View File

@ -25,7 +25,7 @@ exports[`AddContextCommitsModal renders modal with 2 tabs 1`] = `
>
<div
class="mt-2"
class="gl-mt-3"
>
<gl-search-box-by-type-stub
clearbuttontitle="Clear"

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Ci::Build::Artifacts::ExpireInParser do
RSpec.describe Gitlab::Ci::Build::DurationParser do
describe '.validate_duration', :request_store do
subject { described_class.validate_duration(value) }

View File

@ -689,10 +689,29 @@ RSpec.describe ContainerRepository, :aggregate_failures do
it { is_expected.to eq(nil) }
end
context 'with an old repository' do
context 'supports gitlab api on .com with an old repository' do
let(:on_com) { true }
let(:created_at) { described_class::MIGRATION_PHASE_1_STARTED_AT - 3.months }
it { is_expected.to eq(nil) }
before do
allow(repository.gitlab_api_client).to receive(:supports_gitlab_api?).and_return(true)
allow(repository.gitlab_api_client).to receive(:repository_details).with(repository.path, sizing: :self).and_return(response)
expect(repository).to receive(:migration_state).and_return(migration_state)
end
context 'with migration_state import_done' do
let(:response) { { 'size_bytes' => 12345 } }
let(:migration_state) { 'import_done' }
it { is_expected.to eq(12345) }
end
context 'with migration_state not import_done' do
let(:response) { { 'size_bytes' => 12345 } }
let(:migration_state) { 'default' }
it { is_expected.to eq(nil) }
end
end
end

View File

@ -79,6 +79,31 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do
<div class="extension">
### Motivation
This is a third-level heading with no examples, as exists in the actual GHFM
specification. It exists to drive a fix for a bug where this caused the
indexing and ordering to in examples_index.yml to be incorrect.
### Another H3
This is a second consecutive third-level heading. It exists to drive full code coverage
for this scenario, although it doesn't (yet) exist in the actual spec.txt.
## An H2 with all disabled examples
In the GHFM specification, the 'Task list items (extension)' contains only "disabled"
examples, which are ignored by the GitHub fork of `spec_test.py`, and thus not part of the
Markdown conformance tests, but are part of the HTML-rendered version of the specification.
We also exclude them from our GLFM specification for consistency, but we may add
GitLab-specific examples for the behavior instead.
```````````````````````````````` example disabled
this example is disabled during conformance testing
.
<p>this example is disabled during conformance testing</p>
````````````````````````````````
## Strikethrough (extension)
GFM enables the `strikethrough` extension.
@ -202,7 +227,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do
"existing": "This entry is existing, but not skipped, so it will be overwritten."
}
# 02_01__inlines__strong__002: is omitted from the existing file and skipped, to test that scenario.
02_02__inlines__strikethrough_extension__001: |-
02_03__inlines__strikethrough_extension__001: |-
{
"type": "doc",
"content": [
@ -314,21 +339,21 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do
02_01__inlines__strong__002:
spec_txt_example_position: 2
source_specification: github
02_02__inlines__strikethrough_extension__001:
spec_txt_example_position: 3
02_03__inlines__strikethrough_extension__001:
spec_txt_example_position: 4
source_specification: github
03_01__first_gitlab_specific_section_with_examples__strong_but_with_two_asterisks__001:
spec_txt_example_position: 4
source_specification: gitlab
04_01__second_gitlab_specific_section_with_examples__strong_but_with_html__001:
spec_txt_example_position: 5
source_specification: gitlab
05_01__third_gitlab_specific_section_with_skipped_examples__strong_but_skipped__001:
04_01__second_gitlab_specific_section_with_examples__strong_but_with_html__001:
spec_txt_example_position: 6
source_specification: gitlab
05_02__third_gitlab_specific_section_with_skipped_examples__strong_but_manually_modified_and_skipped__001:
05_01__third_gitlab_specific_section_with_skipped_examples__strong_but_skipped__001:
spec_txt_example_position: 7
source_specification: gitlab
05_02__third_gitlab_specific_section_with_skipped_examples__strong_but_manually_modified_and_skipped__001:
spec_txt_example_position: 8
source_specification: gitlab
ES_EXAMPLES_INDEX_YML_CONTENTS
end
@ -349,7 +374,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do
__bold__
02_01__inlines__strong__002: |
__bold with more text__
02_02__inlines__strikethrough_extension__001: |
02_03__inlines__strikethrough_extension__001: |
~~Hi~~ Hello, world!
03_01__first_gitlab_specific_section_with_examples__strong_but_with_two_asterisks__001: |
**bold**
@ -413,7 +438,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do
<p data-sourcepos="1:1-1:23" dir="auto"><strong>bold with more text</strong></p>
wysiwyg: |-
<p><strong>bold with more text</strong></p>
02_02__inlines__strikethrough_extension__001:
02_03__inlines__strikethrough_extension__001:
canonical: |
<p><del>Hi</del> Hello, world!</p>
static: |-
@ -468,7 +493,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do
}
]
}
02_02__inlines__strikethrough_extension__001: |-
02_03__inlines__strikethrough_extension__001: |-
{
"type": "doc",
"content": [

View File

@ -599,25 +599,13 @@ RSpec.describe SearchService do
let(:search_service) { double(:search_service) }
before do
stub_feature_flags(prevent_abusive_searches: should_detect_abuse)
expect(Gitlab::Search::Params).to receive(:new)
.with(raw_params, detect_abuse: should_detect_abuse).and_call_original
.with(raw_params, detect_abuse: true).and_call_original
allow(subject).to receive(:search_service).and_return search_service
end
context 'when abusive search but prevent_abusive_searches FF is disabled' do
let(:should_detect_abuse) { false }
let(:scope) { '1;drop%20table' }
it 'executes search even if params are abusive' do
expect(search_service).to receive(:execute)
subject.search_results
end
end
context 'a search is abusive' do
let(:should_detect_abuse) { true }
let(:scope) { '1;drop%20table' }
it 'does NOT execute search service' do
@ -627,7 +615,6 @@ RSpec.describe SearchService do
end
context 'a search is NOT abusive' do
let(:should_detect_abuse) { true }
let(:scope) { 'issues' }
it 'executes search service' do