Commit f1fc5900 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents f4c96792 35eaf35c
mutation toggleLock($projectPath: ID!, $filePath: String!, $lock: Boolean!) {
projectSetLocked(input: { projectPath: $projectPath, filePath: $filePath, lock: $lock }) {
project {
pathLocks {
nodes {
path
}
}
}
errors
}
}
......@@ -1013,6 +1013,8 @@ class User < ApplicationRecord
# Returns a relation of groups the user has access to, including their parent
# and child groups (recursively).
def all_expanded_groups
return groups if groups.empty?
Gitlab::ObjectHierarchy.new(groups).all_objects
end
......
......@@ -7,6 +7,7 @@ class Ci::PipelineEntity < Grape::Entity
delegate :name, :failure_reason, to: :presented_pipeline
expose :id
expose :iid
expose :user, using: UserEntity
expose :active?, as: :active
......
......@@ -52,6 +52,7 @@ Example of response
[
{
"id": 47,
"iid": 12,
"project_id": 1,
"status": "pending",
"ref": "new-pipeline",
......@@ -62,6 +63,7 @@ Example of response
},
{
"id": 48,
"iid": 13,
"project_id": 1,
"status": "pending",
"ref": "new-pipeline",
......@@ -93,6 +95,7 @@ Example of response
```json
{
"id": 46,
"iid": 11,
"project_id": 1,
"status": "success",
"ref": "main",
......@@ -281,6 +284,7 @@ Example of response
```json
{
"id": 61,
"iid": 21,
"project_id": 1,
"sha": "384c444e840a515b23f21915ee5766b87068a70d",
"ref": "main",
......@@ -328,6 +332,7 @@ Response:
```json
{
"id": 46,
"iid": 11,
"project_id": 1,
"status": "pending",
"ref": "main",
......@@ -375,6 +380,7 @@ Response:
```json
{
"id": 46,
"iid": 11,
"project_id": 1,
"status": "canceled",
"ref": "main",
......
......@@ -56,7 +56,7 @@ class Feature
# use `default_enabled: true` to default the flag to being `enabled`
# 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 `definition_yaml`
# check: https://gitlab.com/gitlab-org/gitlab/-/issues/30228
def enabled?(key, thing = nil, type: :development, default_enabled: false)
if check_feature_flags_definition?
......
......@@ -2,10 +2,14 @@
module Gitlab
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
# cached markdown needs to be updated. As a result, this line should
# not be changed.
# cached markdown needs to be updated. As a result, avoid changing
# 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
CACHE_COMMONMARK_VERSION = 28
CACHE_COMMONMARK_VERSION_START = 10
......
......@@ -39,6 +39,7 @@ module Gitlab
def save_markdown(updates)
return unless persisted? && Gitlab::Database.read_write?
return if cached_markdown_version < cached_markdown_version_in_database
update_columns(updates)
end
......
......@@ -216,4 +216,16 @@ RSpec.describe Gitlab::MarkdownCache::ActiveRecord::Extension do
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
......@@ -4039,6 +4039,14 @@ RSpec.describe User do
]
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
describe '#refresh_authorized_projects', :clean_gitlab_redis_shared_state do
......@@ -4300,6 +4308,14 @@ RSpec.describe User do
expect(user.two_factor_grace_period).to be 48
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
describe '#source_groups_of_two_factor_authentication_requirement' do
......
......@@ -18,7 +18,7 @@ RSpec.describe Ci::PipelineEntity do
let(:pipeline) { create(:ci_empty_pipeline) }
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 :updated_at, :created_at
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment