Skip to content

Commit bd5d579

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 6553773 commit bd5d579

File tree

13 files changed

+105
-22
lines changed

13 files changed

+105
-22
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Fix display of some overflowing merge request diffs
3+
merge_request: 29267
4+
author:
5+
type: fixed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Expose the updated_at attribute in the todos API
3+
merge_request: 30035
4+
author:
5+
type: changed

doc/api/todos.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ Example Response:
101101
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
102102
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
103103
"state": "pending",
104-
"created_at": "2016-06-17T07:52:35.225Z"
104+
"created_at": "2016-06-17T07:52:35.225Z",
105+
"updated_at": "2016-06-17T07:52:35.225Z"
105106
},
106107
{
107108
"id": 98,
@@ -174,7 +175,8 @@ Example Response:
174175
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
175176
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
176177
"state": "pending",
177-
"created_at": "2016-06-17T07:49:24.624Z"
178+
"created_at": "2016-06-17T07:49:24.624Z",
179+
"updated_at": "2016-06-17T07:49:24.624Z"
178180
}
179181
]
180182
```
@@ -272,7 +274,8 @@ Example Response:
272274
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
273275
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
274276
"state": "done",
275-
"created_at": "2016-06-17T07:52:35.225Z"
277+
"created_at": "2016-06-17T07:52:35.225Z",
278+
"updated_at": "2016-06-17T07:52:35.225Z"
276279
}
277280
```
278281

doc/development/documentation/styleguide.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ that apply to all GitLab content, not just documentation.
1919

2020
The documentation of GitLab products and features is the SSOT for all information related to implementation, usage, and troubleshooting. It evolves continually, in keeping with new products and features, and with improvements for clarity, accuracy, and completeness.
2121

22-
This policy prevents information silos, ensuring that it remains easy to find information about GitLab products.
22+
This policy prevents information silos, making it easier to find information about GitLab products.
2323

2424
It also informs decisions about the kinds of content we include in our documentation.
2525

@@ -61,7 +61,7 @@ Instead, link to the SSOT and explain why it is important to consume the informa
6161

6262
### Organize by topic, not by type
6363

64-
Beyond top-level audience-type folders (for example, `administration`), we organize content by topic, not by type, so that it can be located as easily as possible within the single-source-of-truth (SSOT) section for the subject matter.
64+
Beyond top-level audience-type folders (for example, `administration`), we organize content by topic, not by type, so it can be located as easily as possible within the single-source-of-truth (SSOT) section for the subject matter.
6565

6666
For example, do not create groupings of similar media types. For example:
6767

@@ -76,7 +76,7 @@ and cross-link between any related content.
7676

7777
### Docs-first methodology
7878

79-
We employ a **docs-first methodology** to help ensure that the docs remain a complete and trusted resource, and to make communicating about the use of GitLab more efficient.
79+
We employ a **docs-first methodology** to help ensure the docs remain a complete and trusted resource, and to make communicating about the use of GitLab more efficient.
8080

8181
- If the answer to a question exists in documentation, share the link to the docs instead of rephrasing the information.
8282
- When you encounter new information not available in GitLab’s documentation (for example, when working on a support case or testing a feature), your first step should be to create a merge request (MR) to add this information to the docs. You can then share the MR in order to communicate this information.
@@ -129,13 +129,13 @@ correctly, but is not the current standard for GitLab documentation).
129129
A rule that could cause confusion is `MD044/proper-names`, as it might not be immediately
130130
clear what caused markdownlint to fail, or how to correct the failure. This rule
131131
checks a list of known words, listed in the `.markdownlint.json` file in each project,
132-
to verify that proper capitalization and backticks are used. Words in backticks will
132+
to verify proper use of capitalization and backticks. Words in backticks will
133133
be ignored by markdownlint.
134134

135135
In general, product names should follow the exact capitalization of the official names
136136
of the products, protocols, and so on.
137137

138-
Some examples that will fail if incorrect capitalization is used:
138+
Some examples fail if incorrect capitalization is used:
139139

140140
- MinIO (needs capital `IO`)
141141
- NGINX (needs all capitals)
@@ -252,6 +252,8 @@ GitLab documentation should be clear and easy to understand.
252252
- Avoid uncommon words.
253253
- Don't write in the first person singular.
254254
- Instead of "I" or "me," use "we," "you," "us," or "one."
255+
- When possible, stay user focused by writing in the second person ("you" or the imperative).
256+
- Don't overuse "that". In many cases, you can remove "that" from a sentence and improve readability.
255257

256258
### Point of view
257259

doc/user/project/merge_requests/accessibility_testing.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ Pa11y against the webpages defined in `a11y_urls`, and builds an HTML report for
4646

4747
The report for each URL is saved as an artifact that can be [viewed directly in your browser](../../../ci/pipelines/job_artifacts.md#browsing-artifacts).
4848

49-
A single `accessibility.json` artifact is created and saved along with the individual HTML reports.
49+
A single `gl-accessibility.json` artifact is created and saved along with the individual HTML reports.
5050
It includes report data for all URLs scanned.
5151

52+
NOTE: **Note:**
53+
For GitLab 12.10 and earlier, the [artifact generated is named `accessibility.json`](https://gitlab.com/gitlab-org/ci-cd/accessibility/-/merge_requests/9).
54+
5255
NOTE: **Note:**
5356
For GitLab versions earlier than 12.9, you can use `include:remote` and use a
5457
link to the [current template in `master`](https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/Verify/Accessibility.gitlab-ci.yml)

lib/api/entities/todo.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Todo < Grape::Entity
2222
expose :body
2323
expose :state
2424
expose :created_at
25+
expose :updated_at
2526

2627
def todo_target_class(target_type)
2728
# false as second argument prevents looking up in module hierarchy

lib/declarative_policy.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,17 @@ def class_for_class(subject_class)
7272
end
7373

7474
def compute_class_for_class(subject_class)
75+
if subject_class.respond_to?(:declarative_policy_class)
76+
return subject_class.declarative_policy_class.constantize
77+
end
78+
7579
subject_class.ancestors.each do |klass|
76-
next unless klass.name
80+
name = klass.name
81+
82+
next unless name
7783

7884
begin
79-
klass_name =
80-
if subject_class.respond_to?(:declarative_policy_class)
81-
subject_class.declarative_policy_class
82-
else
83-
"#{klass.name}Policy"
84-
end
85-
86-
policy_class = klass_name.constantize
85+
policy_class = "#{name}Policy".constantize
8786

8887
# NOTE: the < operator here tests whether policy_class
8988
# inherits from Base. We can't use #is_a? because that

lib/gitlab/blob_helper.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This has been extracted from https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb
44
module Gitlab
55
module BlobHelper
6+
include Gitlab::Utils::StrongMemoize
7+
68
def extname
79
File.extname(name.to_s)
810
end
@@ -120,8 +122,18 @@ def content_type
120122
end
121123

122124
def encoded_newlines_re
123-
@encoded_newlines_re ||=
124-
Regexp.union(["\r\n", "\r", "\n"].map { |nl| nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data.encoding) })
125+
strong_memoize(:encoded_newlines_re) do
126+
newlines = ["\r\n", "\r", "\n"]
127+
data_encoding = data&.encoding
128+
129+
if ruby_encoding && data_encoding
130+
newlines.map! do |nl|
131+
nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data_encoding)
132+
end
133+
end
134+
135+
Regexp.union(newlines)
136+
end
125137
end
126138

127139
def ruby_encoding

qa/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ GEM
9393
rspec-support (3.7.0)
9494
rspec_junit_formatter (0.4.1)
9595
rspec-core (>= 2, < 4, != 2.12.0)
96-
ruby-debug-ide (0.7.0)
96+
ruby-debug-ide (0.7.2)
9797
rake (>= 0.8.1)
9898
rubyzip (1.3.0)
9999
selenium-webdriver (3.142.6)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe DeclarativePolicy do
6+
describe '.class_for' do
7+
it 'uses declarative_policy_class if present' do
8+
instance = Gitlab::ErrorTracking::ErrorEvent.new
9+
10+
expect(described_class.class_for(instance)).to eq(ErrorTracking::BasePolicy)
11+
end
12+
13+
it 'infers policy class from name' do
14+
instance = PersonalSnippet.new
15+
16+
expect(described_class.class_for(instance)).to eq(PersonalSnippetPolicy)
17+
end
18+
19+
it 'raises error if not found' do
20+
instance = Object.new
21+
22+
expect { described_class.class_for(instance) }.to raise_error('no policy for Object')
23+
end
24+
25+
context 'when found policy class does not inherit base' do
26+
class Foo; end
27+
class FooPolicy; end
28+
29+
it 'raises error if inferred class does not inherit Base' do
30+
instance = Foo.new
31+
32+
expect { described_class.class_for(instance) }.to raise_error('no policy for Foo')
33+
end
34+
end
35+
end
36+
end

0 commit comments

Comments
 (0)