Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f1fc5900
Commit
f1fc5900
authored
Aug 03, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
f4c96792
35eaf35c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
59 additions
and
5 deletions
+59
-5
app/assets/javascripts/repository/mutations/lock_path.mutation.graphql
...vascripts/repository/mutations/lock_path.mutation.graphql
+12
-0
app/models/user.rb
app/models/user.rb
+2
-0
app/serializers/ci/pipeline_entity.rb
app/serializers/ci/pipeline_entity.rb
+1
-0
doc/api/pipelines.md
doc/api/pipelines.md
+6
-0
lib/feature.rb
lib/feature.rb
+1
-1
lib/gitlab/markdown_cache.rb
lib/gitlab/markdown_cache.rb
+7
-3
lib/gitlab/markdown_cache/active_record/extension.rb
lib/gitlab/markdown_cache/active_record/extension.rb
+1
-0
spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb
...lib/gitlab/markdown_cache/active_record/extension_spec.rb
+12
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+16
-0
spec/serializers/ci/pipeline_entity_spec.rb
spec/serializers/ci/pipeline_entity_spec.rb
+1
-1
No files found.
app/assets/javascripts/repository/mutations/lock_path.mutation.graphql
0 → 100644
View file @
f1fc5900
mutation
toggleLock
(
$projectPath
:
ID
!,
$filePath
:
String
!,
$lock
:
Boolean
!)
{
projectSetLocked
(
input
:
{
projectPath
:
$projectPath
,
filePath
:
$filePath
,
lock
:
$lock
})
{
project
{
pathLocks
{
nodes
{
path
}
}
}
errors
}
}
app/models/user.rb
View file @
f1fc5900
...
@@ -1013,6 +1013,8 @@ class User < ApplicationRecord
...
@@ -1013,6 +1013,8 @@ class User < ApplicationRecord
# Returns a relation of groups the user has access to, including their parent
# Returns a relation of groups the user has access to, including their parent
# and child groups (recursively).
# and child groups (recursively).
def
all_expanded_groups
def
all_expanded_groups
return
groups
if
groups
.
empty?
Gitlab
::
ObjectHierarchy
.
new
(
groups
).
all_objects
Gitlab
::
ObjectHierarchy
.
new
(
groups
).
all_objects
end
end
...
...
app/serializers/ci/pipeline_entity.rb
View file @
f1fc5900
...
@@ -7,6 +7,7 @@ class Ci::PipelineEntity < Grape::Entity
...
@@ -7,6 +7,7 @@ class Ci::PipelineEntity < Grape::Entity
delegate
:name
,
:failure_reason
,
to: :presented_pipeline
delegate
:name
,
:failure_reason
,
to: :presented_pipeline
expose
:id
expose
:id
expose
:iid
expose
:user
,
using:
UserEntity
expose
:user
,
using:
UserEntity
expose
:active?
,
as: :active
expose
:active?
,
as: :active
...
...
doc/api/pipelines.md
View file @
f1fc5900
...
@@ -52,6 +52,7 @@ Example of response
...
@@ -52,6 +52,7 @@ Example of response
[
[
{
{
"id"
:
47
,
"id"
:
47
,
"iid"
:
12
,
"project_id"
:
1
,
"project_id"
:
1
,
"status"
:
"pending"
,
"status"
:
"pending"
,
"ref"
:
"new-pipeline"
,
"ref"
:
"new-pipeline"
,
...
@@ -62,6 +63,7 @@ Example of response
...
@@ -62,6 +63,7 @@ Example of response
},
},
{
{
"id"
:
48
,
"id"
:
48
,
"iid"
:
13
,
"project_id"
:
1
,
"project_id"
:
1
,
"status"
:
"pending"
,
"status"
:
"pending"
,
"ref"
:
"new-pipeline"
,
"ref"
:
"new-pipeline"
,
...
@@ -93,6 +95,7 @@ Example of response
...
@@ -93,6 +95,7 @@ Example of response
```
json
```
json
{
{
"id"
:
46
,
"id"
:
46
,
"iid"
:
11
,
"project_id"
:
1
,
"project_id"
:
1
,
"status"
:
"success"
,
"status"
:
"success"
,
"ref"
:
"main"
,
"ref"
:
"main"
,
...
@@ -281,6 +284,7 @@ Example of response
...
@@ -281,6 +284,7 @@ Example of response
```
json
```
json
{
{
"id"
:
61
,
"id"
:
61
,
"iid"
:
21
,
"project_id"
:
1
,
"project_id"
:
1
,
"sha"
:
"384c444e840a515b23f21915ee5766b87068a70d"
,
"sha"
:
"384c444e840a515b23f21915ee5766b87068a70d"
,
"ref"
:
"main"
,
"ref"
:
"main"
,
...
@@ -328,6 +332,7 @@ Response:
...
@@ -328,6 +332,7 @@ Response:
```
json
```
json
{
{
"id"
:
46
,
"id"
:
46
,
"iid"
:
11
,
"project_id"
:
1
,
"project_id"
:
1
,
"status"
:
"pending"
,
"status"
:
"pending"
,
"ref"
:
"main"
,
"ref"
:
"main"
,
...
@@ -375,6 +380,7 @@ Response:
...
@@ -375,6 +380,7 @@ Response:
```
json
```
json
{
{
"id"
:
46
,
"id"
:
46
,
"iid"
:
11
,
"project_id"
:
1
,
"project_id"
:
1
,
"status"
:
"canceled"
,
"status"
:
"canceled"
,
"ref"
:
"main"
,
"ref"
:
"main"
,
...
...
lib/feature.rb
View file @
f1fc5900
...
@@ -56,7 +56,7 @@ class Feature
...
@@ -56,7 +56,7 @@ class Feature
# use `default_enabled: true` to default the flag to being `enabled`
# use `default_enabled: true` to default the flag to being `enabled`
# unless set explicitly. The default is `disabled`
# unless set explicitly. The default is `disabled`
# TODO: remove the `default_enabled:` and read it from the `defintion_yaml`
# TODO: remove the `default_enabled:` and read it from the `defin
i
tion_yaml`
# check: https://gitlab.com/gitlab-org/gitlab/-/issues/30228
# check: https://gitlab.com/gitlab-org/gitlab/-/issues/30228
def
enabled?
(
key
,
thing
=
nil
,
type: :development
,
default_enabled:
false
)
def
enabled?
(
key
,
thing
=
nil
,
type: :development
,
default_enabled:
false
)
if
check_feature_flags_definition?
if
check_feature_flags_definition?
...
...
lib/gitlab/markdown_cache.rb
View file @
f1fc5900
...
@@ -2,10 +2,14 @@
...
@@ -2,10 +2,14 @@
module
Gitlab
module
Gitlab
module
MarkdownCache
module
MarkdownCache
# Increment this number every time the renderer changes its output.
# Increment this number to invalidate cached HTML from Markdown documents.
# Even when reverting an MR, we should increment this because we only
# persist the cache when the new version is higher.
#
# Changing this value puts strain on the database, as every row with
# Changing this value puts strain on the database, as every row with
# cached markdown needs to be updated. As a result, this line should
# cached markdown needs to be updated. As a result, avoid changing
# not be changed.
# this if the change to the renderer output is a new feature or a
# minor bug fix.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/330313
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/330313
CACHE_COMMONMARK_VERSION
=
28
CACHE_COMMONMARK_VERSION
=
28
CACHE_COMMONMARK_VERSION_START
=
10
CACHE_COMMONMARK_VERSION_START
=
10
...
...
lib/gitlab/markdown_cache/active_record/extension.rb
View file @
f1fc5900
...
@@ -39,6 +39,7 @@ module Gitlab
...
@@ -39,6 +39,7 @@ module Gitlab
def
save_markdown
(
updates
)
def
save_markdown
(
updates
)
return
unless
persisted?
&&
Gitlab
::
Database
.
read_write?
return
unless
persisted?
&&
Gitlab
::
Database
.
read_write?
return
if
cached_markdown_version
<
cached_markdown_version_in_database
update_columns
(
updates
)
update_columns
(
updates
)
end
end
...
...
spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb
View file @
f1fc5900
...
@@ -216,4 +216,16 @@ RSpec.describe Gitlab::MarkdownCache::ActiveRecord::Extension do
...
@@ -216,4 +216,16 @@ RSpec.describe Gitlab::MarkdownCache::ActiveRecord::Extension do
end
end
end
end
end
end
context
'when persisted cache is newer than current version'
do
before
do
thing
.
update_column
(
:cached_markdown_version
,
thing
.
cached_markdown_version
+
1
)
end
it
'does not save the generated HTML'
do
expect
(
thing
).
not_to
receive
(
:update_columns
)
thing
.
refresh_markdown_cache!
end
end
end
end
spec/models/user_spec.rb
View file @
f1fc5900
...
@@ -4039,6 +4039,14 @@ RSpec.describe User do
...
@@ -4039,6 +4039,14 @@ RSpec.describe User do
]
]
end
end
end
end
context
'when the user is not saved'
do
let
(
:user
)
{
build
(
:user
)
}
it
'returns empty when there are no groups or ancestor groups for the user'
do
is_expected
.
to
eq
([])
end
end
end
end
describe
'#refresh_authorized_projects'
,
:clean_gitlab_redis_shared_state
do
describe
'#refresh_authorized_projects'
,
:clean_gitlab_redis_shared_state
do
...
@@ -4300,6 +4308,14 @@ RSpec.describe User do
...
@@ -4300,6 +4308,14 @@ RSpec.describe User do
expect
(
user
.
two_factor_grace_period
).
to
be
48
expect
(
user
.
two_factor_grace_period
).
to
be
48
end
end
end
end
context
'when the user is not saved'
do
let
(
:user
)
{
build
(
:user
)
}
it
'does not raise an ActiveRecord::StatementInvalid statement exception'
do
expect
{
user
.
update_two_factor_requirement
}.
not_to
raise_error
end
end
end
end
describe
'#source_groups_of_two_factor_authentication_requirement'
do
describe
'#source_groups_of_two_factor_authentication_requirement'
do
...
...
spec/serializers/ci/pipeline_entity_spec.rb
View file @
f1fc5900
...
@@ -18,7 +18,7 @@ RSpec.describe Ci::PipelineEntity do
...
@@ -18,7 +18,7 @@ RSpec.describe Ci::PipelineEntity do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
it
'contains required fields'
do
it
'contains required fields'
do
expect
(
subject
).
to
include
:id
,
:user
,
:path
,
:coverage
,
:source
expect
(
subject
).
to
include
:id
,
:
iid
,
:
user
,
:path
,
:coverage
,
:source
expect
(
subject
).
to
include
:ref
,
:commit
expect
(
subject
).
to
include
:ref
,
:commit
expect
(
subject
).
to
include
:updated_at
,
:created_at
expect
(
subject
).
to
include
:updated_at
,
:created_at
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment