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
8cce1cda
Commit
8cce1cda
authored
Jul 07, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
e3d7e482
e8b67da0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
80 additions
and
19 deletions
+80
-19
app/assets/javascripts/sortable/sortable_config.js
app/assets/javascripts/sortable/sortable_config.js
+1
-0
app/models/wiki.rb
app/models/wiki.rb
+13
-13
app/services/wiki_pages/create_service.rb
app/services/wiki_pages/create_service.rb
+3
-2
app/services/wiki_pages/update_service.rb
app/services/wiki_pages/update_service.rb
+1
-1
db/post_migrate/20210706120847_remove_framework_column_from_compliance_management_frameworks.rb
...framework_column_from_compliance_management_frameworks.rb
+7
-0
db/schema_migrations/20210706120847
db/schema_migrations/20210706120847
+1
-0
db/structure.sql
db/structure.sql
+0
-1
ee/app/services/ee/audit_event_service.rb
ee/app/services/ee/audit_event_service.rb
+1
-1
ee/spec/lib/ee/gitlab/search_results_spec.rb
ee/spec/lib/ee/gitlab/search_results_spec.rb
+1
-1
ee/spec/services/audit_event_service_spec.rb
ee/spec/services/audit_event_service_spec.rb
+10
-0
spec/services/wiki_pages/create_service_spec.rb
spec/services/wiki_pages/create_service_spec.rb
+20
-0
spec/services/wiki_pages/update_service_spec.rb
spec/services/wiki_pages/update_service_spec.rb
+22
-0
No files found.
app/assets/javascripts/sortable/sortable_config.js
View file @
8cce1cda
...
...
@@ -4,4 +4,5 @@ export default {
fallbackClass
:
'
is-dragging
'
,
fallbackOnBody
:
true
,
ghostClass
:
'
is-ghost
'
,
fallbackTolerance
:
1
,
};
app/models/wiki.rb
View file @
8cce1cda
...
...
@@ -278,6 +278,19 @@ class Wiki
@repository
=
nil
end
def
capture_git_error
(
action
,
&
block
)
yield
block
rescue
Gitlab
::
Git
::
Index
::
IndexError
,
Gitlab
::
Git
::
CommitError
,
Gitlab
::
Git
::
PreReceiveError
,
Gitlab
::
Git
::
CommandError
,
ArgumentError
=>
error
Gitlab
::
ErrorTracking
.
log_exception
(
error
,
action:
action
,
wiki_id:
id
)
false
end
private
def
multi_commit_options
(
action
,
message
=
nil
,
title
=
nil
)
...
...
@@ -311,19 +324,6 @@ class Wiki
"
#{
user
.
username
}
#{
action
}
page:
#{
title
}
"
end
def
capture_git_error
(
action
,
&
block
)
yield
block
rescue
Gitlab
::
Git
::
Index
::
IndexError
,
Gitlab
::
Git
::
CommitError
,
Gitlab
::
Git
::
PreReceiveError
,
Gitlab
::
Git
::
CommandError
,
ArgumentError
=>
error
Gitlab
::
ErrorTracking
.
log_exception
(
error
,
action:
action
,
wiki_id:
id
)
false
end
def
change_head_to_default_branch
repository
.
raw_repository
.
write_ref
(
'HEAD'
,
"refs/heads/
#{
default_branch
}
"
)
end
...
...
app/services/wiki_pages/create_service.rb
View file @
8cce1cda
...
...
@@ -6,11 +6,12 @@ module WikiPages
wiki
=
Wiki
.
for_container
(
container
,
current_user
)
page
=
WikiPage
.
new
(
wiki
)
if
page
.
create
(
@params
)
execute_hooks
(
page
)
wiki
.
capture_git_error
(
event_action
)
do
page
.
create
(
@params
)
end
if
page
.
persisted?
execute_hooks
(
page
)
ServiceResponse
.
success
(
payload:
{
page:
page
})
else
ServiceResponse
.
error
(
message:
_
(
'Could not create wiki page'
),
payload:
{
page:
page
})
...
...
app/services/wiki_pages/update_service.rb
View file @
8cce1cda
...
...
@@ -8,7 +8,7 @@ module WikiPages
# this class is not thread safe!
@old_slug
=
page
.
slug
if
page
.
update
(
@params
)
if
page
.
wiki
.
capture_git_error
(
event_action
)
{
page
.
update
(
@params
)
}
execute_hooks
(
page
)
ServiceResponse
.
success
(
payload:
{
page:
page
})
else
...
...
db/post_migrate/20210706120847_remove_framework_column_from_compliance_management_frameworks.rb
0 → 100644
View file @
8cce1cda
# frozen_string_literal: true
class
RemoveFrameworkColumnFromComplianceManagementFrameworks
<
ActiveRecord
::
Migration
[
6.1
]
def
change
remove_column
:project_compliance_framework_settings
,
:framework
,
:smallint
end
end
db/schema_migrations/20210706120847
0 → 100644
View file @
8cce1cda
0fffffc44c32a936760424541e183b1a41938750d4e10da9dd76c2a09094a07b
\ No newline at end of file
db/structure.sql
View file @
8cce1cda
...
...
@@ -16697,7 +16697,6 @@ ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id;
CREATE TABLE project_compliance_framework_settings (
project_id bigint NOT NULL,
framework smallint,
framework_id bigint,
CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL))
);
ee/app/services/ee/audit_event_service.rb
View file @
8cce1cda
...
...
@@ -133,7 +133,7 @@ module EE
# @return [AuditEvent, nil] if record is persisted or nil if audit events
# features are not enabled
def
unauth_security_event
return
unless
audit_events_enabled?
return
unless
audit_events_enabled?
&&
::
Gitlab
::
Database
.
read_write?
add_security_event_admin_details!
...
...
ee/spec/lib/ee/gitlab/search_results_spec.rb
View file @
8cce1cda
...
...
@@ -25,6 +25,6 @@ RSpec.describe Gitlab::SearchResults do
end
def
search
subject
.
objects
(
'projects'
).
map
{
|
project
|
project
.
compliance_framework_setting
.
framework
}
subject
.
objects
(
'projects'
).
map
{
|
project
|
project
.
compliance_framework_setting
}
end
end
ee/spec/services/audit_event_service_spec.rb
View file @
8cce1cda
...
...
@@ -333,6 +333,16 @@ RSpec.describe AuditEventService, :request_store do
expect
(
event
.
details
).
not_to
have_key
(
:ip_address
)
end
end
context
'on a read-only instance'
do
before
do
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
true
)
end
it
'does not create an event record in the database'
do
expect
{
service
.
for_failed_login
.
unauth_security_event
}.
not_to
change
(
AuditEvent
,
:count
)
end
end
end
describe
'#for_project_group_link'
do
...
...
spec/services/wiki_pages/create_service_spec.rb
View file @
8cce1cda
...
...
@@ -4,4 +4,24 @@ require 'spec_helper'
RSpec
.
describe
WikiPages
::
CreateService
do
it_behaves_like
'WikiPages::CreateService#execute'
,
:project
describe
'#execute'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
subject
(
:service
)
{
described_class
.
new
(
container:
project
)
}
context
'when wiki create fails due to git error'
do
let
(
:wiki_git_error
)
{
'Could not create wiki page'
}
it
'catches the thrown error and returns a ServiceResponse error'
do
allow_next_instance_of
(
WikiPage
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:create
).
and_raise
(
Gitlab
::
Git
::
CommandError
.
new
(
wiki_git_error
))
end
result
=
service
.
execute
expect
(
result
).
to
be_error
expect
(
result
.
message
).
to
eq
(
wiki_git_error
)
end
end
end
end
spec/services/wiki_pages/update_service_spec.rb
View file @
8cce1cda
...
...
@@ -4,4 +4,26 @@ require 'spec_helper'
RSpec
.
describe
WikiPages
::
UpdateService
do
it_behaves_like
'WikiPages::UpdateService#execute'
,
:project
describe
'#execute'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:page
)
{
create
(
:wiki_page
,
project:
project
)
}
subject
(
:service
)
{
described_class
.
new
(
container:
project
)
}
context
'when wiki create fails due to git error'
do
let
(
:wiki_git_error
)
{
'Could not update wiki page'
}
it
'catches the thrown error and returns a ServiceResponse error'
do
allow_next_instance_of
(
WikiPage
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:update
).
and_raise
(
Gitlab
::
Git
::
CommandError
.
new
(
wiki_git_error
))
end
result
=
service
.
execute
(
page
)
expect
(
result
).
to
be_error
expect
(
result
.
message
).
to
eq
(
wiki_git_error
)
end
end
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