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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
759cd6c2
Commit
759cd6c2
authored
Sep 26, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
9735395f
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
359 additions
and
80 deletions
+359
-80
.eslintrc.yml
.eslintrc.yml
+0
-1
.rubocop_todo.yml
.rubocop_todo.yml
+0
-13
app/assets/javascripts/jobs/store/utils.js
app/assets/javascripts/jobs/store/utils.js
+31
-0
app/models/audit_event.rb
app/models/audit_event.rb
+9
-0
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-5
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+1
-1
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+1
-1
app/models/project_services/irker_service.rb
app/models/project_services/irker_service.rb
+2
-2
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+1
-1
app/models/project_services/packagist_service.rb
app/models/project_services/packagist_service.rb
+1
-1
app/models/wiki_page.rb
app/models/wiki_page.rb
+1
-5
app/views/projects/diffs/_stats.html.haml
app/views/projects/diffs/_stats.html.haml
+2
-2
changelogs/unreleased/13426-add-user-and-timestamps-to-design-management-version.yml
...-add-user-and-timestamps-to-design-management-version.yml
+5
-0
changelogs/unreleased/29284-video-preview-not-working.yml
changelogs/unreleased/29284-video-preview-not-working.yml
+5
-0
changelogs/unreleased/31118-do-not-use-blob-for-file-path.yml
...gelogs/unreleased/31118-do-not-use-blob-for-file-path.yml
+5
-0
changelogs/unreleased/5582-add-missing-actions-and-data-to-environments-and-deployments-apis.yml
...actions-and-data-to-environments-and-deployments-apis.yml
+5
-0
db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb
..._add_user_and_timestamps_to_design_management_versions.rb
+16
-0
db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb
...6041216_add_user_indexes_to_design_management_versions.rb
+19
-0
db/schema.rb
db/schema.rb
+5
-1
doc/api/api_resources.md
doc/api/api_resources.md
+1
-0
doc/api/audit_events.md
doc/api/audit_events.md
+115
-0
doc/api/environments.md
doc/api/environments.md
+10
-4
lib/api/entities.rb
lib/api/entities.rb
+2
-0
lib/banzai/filter/video_link_filter.rb
lib/banzai/filter/video_link_filter.rb
+5
-17
lib/gitlab/diff/file.rb
lib/gitlab/diff/file.rb
+1
-1
lib/gitlab/github_import/importer/releases_importer.rb
lib/gitlab/github_import/importer/releases_importer.rb
+1
-5
spec/features/projects/commits/user_browses_commits_spec.rb
spec/features/projects/commits/user_browses_commits_spec.rb
+2
-2
spec/fixtures/api/schemas/deployment.json
spec/fixtures/api/schemas/deployment.json
+2
-1
spec/fixtures/api/schemas/public_api/v4/deployment.json
spec/fixtures/api/schemas/public_api/v4/deployment.json
+2
-1
spec/fixtures/api/schemas/public_api/v4/environment.json
spec/fixtures/api/schemas/public_api/v4/environment.json
+2
-1
spec/frontend/jobs/store/utils_spec.js
spec/frontend/jobs/store/utils_spec.js
+86
-0
spec/lib/banzai/filter/video_link_filter_spec.rb
spec/lib/banzai/filter/video_link_filter_spec.rb
+20
-15
No files found.
.eslintrc.yml
View file @
759cd6c2
...
...
@@ -46,7 +46,6 @@ rules:
promise/always-return
:
off
promise/no-callback-in-promise
:
off
promise/no-nesting
:
off
promise/valid-params
:
off
overrides
:
files
:
-
'
**/spec/**/*'
...
...
.rubocop_todo.yml
View file @
759cd6c2
...
...
@@ -442,19 +442,6 @@ Rails/LinkToBlank:
-
'
ee/app/helpers/ee/user_callouts_helper.rb'
-
'
ee/app/helpers/license_helper.rb'
# Offense count: 11
# Cop supports --auto-correct.
Rails/Presence
:
Exclude
:
-
'
app/models/ci/pipeline.rb'
-
'
app/models/concerns/mentionable.rb'
-
'
app/models/project_services/hipchat_service.rb'
-
'
app/models/project_services/irker_service.rb'
-
'
app/models/project_services/jira_service.rb'
-
'
app/models/project_services/packagist_service.rb'
-
'
app/models/wiki_page.rb'
-
'
lib/gitlab/github_import/importer/releases_importer.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include.
...
...
app/assets/javascripts/jobs/store/utils.js
View file @
759cd6c2
...
...
@@ -55,6 +55,37 @@ export const logLinesParser = (lines = [], lineNumberStart) =>
return
acc
;
},
[]);
/**
* Finds the repeated offset, removes the old one
*
* Returns a new array with the updated log without
* the repeated offset
*
* @param Array newLog
* @param Array oldParsed
* @returns Array
*
*/
export
const
findOffsetAndRemove
=
(
newLog
,
oldParsed
)
=>
{
const
cloneOldLog
=
[...
oldParsed
];
const
lastIndex
=
cloneOldLog
.
length
-
1
;
const
last
=
cloneOldLog
[
lastIndex
];
const
firstNew
=
newLog
[
0
];
if
(
last
.
offset
===
firstNew
.
offset
||
(
last
.
line
&&
last
.
line
.
offset
===
firstNew
.
offset
))
{
cloneOldLog
.
splice
(
lastIndex
);
}
else
if
(
last
.
lines
&&
last
.
lines
.
length
)
{
const
lastNestedIndex
=
last
.
lines
.
length
-
1
;
const
lastNested
=
last
.
lines
[
lastNestedIndex
];
if
(
lastNested
.
offset
===
firstNew
.
offset
)
{
last
.
lines
.
splice
(
lastNestedIndex
);
}
}
return
cloneOldLog
;
};
/**
* When the trace is not complete, backend may send the last received line
* in the new response.
...
...
app/models/audit_event.rb
View file @
759cd6c2
# frozen_string_literal: true
class
AuditEvent
<
ApplicationRecord
include
CreatedAtFilterable
serialize
:details
,
Hash
# rubocop:disable Cop/ActiveRecordSerialize
belongs_to
:user
,
foreign_key: :author_id
...
...
@@ -9,6 +11,9 @@ class AuditEvent < ApplicationRecord
validates
:entity_id
,
presence:
true
validates
:entity_type
,
presence:
true
scope
:by_entity_type
,
->
(
entity_type
)
{
where
(
entity_type:
entity_type
)
}
scope
:by_entity_id
,
->
(
entity_id
)
{
where
(
entity_id:
entity_id
)
}
after_initialize
:initialize_details
def
initialize_details
...
...
@@ -18,6 +23,10 @@ class AuditEvent < ApplicationRecord
def
author_name
self
.
user
.
name
end
def
formatted_details
details
.
merge
(
details
.
slice
(
:from
,
:to
).
transform_values
(
&
:to_s
))
end
end
AuditEvent
.
prepend_if_ee
(
'EE::AuditEvent'
)
app/models/ci/pipeline.rb
View file @
759cd6c2
...
...
@@ -584,11 +584,7 @@ module Ci
def
ci_yaml_file_path
return
unless
repository_source?
||
unknown_source?
if
project
.
ci_config_path
.
blank?
'.gitlab-ci.yml'
else
project
.
ci_config_path
end
project
.
ci_config_path
.
presence
||
'.gitlab-ci.yml'
end
def
ci_yaml_file
...
...
app/models/concerns/mentionable.rb
View file @
759cd6c2
...
...
@@ -150,7 +150,7 @@ module Mentionable
#
# Returns a Hash.
def
detect_mentionable_changes
source
=
(
changes
.
presen
t?
?
changes
:
previous_changes
).
dup
source
=
(
changes
.
presen
ce
||
previous_changes
).
dup
mentionable
=
self
.
class
.
mentionable_attrs
.
map
{
|
attr
,
options
|
attr
}
...
...
app/models/project_services/hipchat_service.rb
View file @
759cd6c2
...
...
@@ -73,7 +73,7 @@ class HipchatService < Service
private
def
gate
options
=
{
api_version:
api_version
.
presen
t?
?
api_version
:
'v2'
}
options
=
{
api_version:
api_version
.
presen
ce
||
'v2'
}
options
[
:server_url
]
=
server
unless
server
.
blank?
@gate
||=
HipChat
::
Client
.
new
(
token
,
options
)
end
...
...
app/models/project_services/irker_service.rb
View file @
759cd6c2
...
...
@@ -36,8 +36,8 @@ class IrkerService < Service
def
settings
{
server_host:
server_host
.
presen
t?
?
server_host
:
'localhost'
,
server_port:
server_port
.
presen
t?
?
server_port
:
6659
server_host:
server_host
.
presen
ce
||
'localhost'
,
server_port:
server_port
.
presen
ce
||
6659
}
end
...
...
app/models/project_services/jira_service.rb
View file @
759cd6c2
...
...
@@ -337,7 +337,7 @@ class JiraService < IssueTrackerService
end
def
client_url
api_url
.
presen
t?
?
api_url
:
url
api_url
.
presen
ce
||
url
end
def
reset_password?
...
...
app/models/project_services/packagist_service.rb
View file @
759cd6c2
...
...
@@ -59,7 +59,7 @@ class PackagistService < Service
end
def
hook_url
base_url
=
server
.
presen
t?
?
server
:
'https://packagist.org'
base_url
=
server
.
presen
ce
||
'https://packagist.org'
"
#{
base_url
}
/api/update-package?username=
#{
username
}
&apiToken=
#{
token
}
"
end
end
app/models/wiki_page.rb
View file @
759cd6c2
...
...
@@ -77,11 +77,7 @@ class WikiPage
# The escaped URL path of this page.
def
slug
if
@attributes
[
:slug
].
present?
@attributes
[
:slug
]
else
wiki
.
wiki
.
preview_slug
(
title
,
format
)
end
@attributes
[
:slug
].
presence
||
wiki
.
wiki
.
preview_slug
(
title
,
format
)
end
alias_method
:to_param
,
:slug
...
...
app/views/projects/diffs/_stats.html.haml
View file @
759cd6c2
...
...
@@ -24,9 +24,9 @@
%a
.diff-changed-file
{
href:
"##{hexdigest(diff_file.file_path)}"
,
title:
diff_file
.
new_path
}
=
sprite_icon
(
diff_file_changed_icon
(
diff_file
),
size:
16
,
css_class:
"
#{
diff_file_changed_icon_color
(
diff_file
)
}
diff-file-changed-icon append-right-8"
)
%span
.diff-changed-file-content.append-right-8
-
if
diff_file
.
blob
&
.
name
-
if
diff_file
.
file_path
%strong
.diff-changed-file-name
=
diff_file
.
blob
.
name
=
diff_file
.
file_path
-
else
%strong
.diff-changed-blank-file-name
=
s_
(
'Diffs|No file name available'
)
...
...
changelogs/unreleased/13426-add-user-and-timestamps-to-design-management-version.yml
0 → 100644
View file @
759cd6c2
---
title
:
Add user_id and created_at columns to design_management_versions table
merge_request
:
17316
author
:
type
:
added
changelogs/unreleased/29284-video-preview-not-working.yml
0 → 100644
View file @
759cd6c2
---
title
:
Fix inline rendering of videos for uploads with uppercase file extensions
merge_request
:
17581
author
:
type
:
fixed
changelogs/unreleased/31118-do-not-use-blob-for-file-path.yml
0 → 100644
View file @
759cd6c2
---
title
:
Reduce Gitaly calls when viewing a commit
merge_request
:
17095
author
:
type
:
performance
changelogs/unreleased/5582-add-missing-actions-and-data-to-environments-and-deployments-apis.yml
0 → 100644
View file @
759cd6c2
---
title
:
Add status to deployments and state to environments in API responses
merge_request
:
16242
author
:
type
:
changed
db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb
0 → 100644
View file @
759cd6c2
# frozen_string_literal: true
class
AddUserAndTimestampsToDesignManagementVersions
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
add_column
:design_management_versions
,
:user_id
,
:integer
add_column
:design_management_versions
,
:created_at
,
:datetime_with_timezone
end
def
down
remove_columns
:design_management_versions
,
:user_id
,
:created_at
end
end
db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb
0 → 100644
View file @
759cd6c2
# frozen_string_literal: true
class
AddUserIndexesToDesignManagementVersions
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_foreign_key
:design_management_versions
,
:users
,
column: :user_id
,
on_delete: :nullify
add_concurrent_index
:design_management_versions
,
:user_id
,
where:
'user_id IS NOT NULL'
end
def
down
remove_concurrent_index
:design_management_versions
,
:user_id
remove_foreign_key
:design_management_versions
,
column: :user_id
end
end
db/schema.rb
View file @
759cd6c2
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019_09_
19_16203
6
)
do
ActiveRecord
::
Schema
.
define
(
version:
2019_09_
26_04121
6
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
...
...
@@ -1232,8 +1232,11 @@ ActiveRecord::Schema.define(version: 2019_09_19_162036) do
create_table
"design_management_versions"
,
force: :cascade
do
|
t
|
t
.
binary
"sha"
,
null:
false
t
.
bigint
"issue_id"
t
.
integer
"user_id"
t
.
datetime_with_timezone
"created_at"
t
.
index
[
"issue_id"
],
name:
"index_design_management_versions_on_issue_id"
t
.
index
[
"sha"
,
"issue_id"
],
name:
"index_design_management_versions_on_sha_and_issue_id"
,
unique:
true
t
.
index
[
"user_id"
],
name:
"index_design_management_versions_on_user_id"
,
where:
"(user_id IS NOT NULL)"
end
create_table
"draft_notes"
,
force: :cascade
do
|
t
|
...
...
@@ -3930,6 +3933,7 @@ ActiveRecord::Schema.define(version: 2019_09_19_162036) do
add_foreign_key
"design_management_designs_versions"
,
"design_management_designs"
,
column:
"design_id"
,
name:
"fk_03c671965c"
,
on_delete: :cascade
add_foreign_key
"design_management_designs_versions"
,
"design_management_versions"
,
column:
"version_id"
,
name:
"fk_f4d25ba00c"
,
on_delete: :cascade
add_foreign_key
"design_management_versions"
,
"issues"
,
on_delete: :cascade
add_foreign_key
"design_management_versions"
,
"users"
,
name:
"fk_ee16b939e5"
,
on_delete: :nullify
add_foreign_key
"draft_notes"
,
"merge_requests"
,
on_delete: :cascade
add_foreign_key
"draft_notes"
,
"users"
,
column:
"author_id"
,
on_delete: :cascade
add_foreign_key
"elasticsearch_indexed_namespaces"
,
"namespaces"
,
on_delete: :cascade
...
...
doc/api/api_resources.md
View file @
759cd6c2
...
...
@@ -104,6 +104,7 @@ The following API resources are available outside of project and group contexts
| Resource | Available endpoints |
|:--------------------------------------------------|:------------------------------------------------------------------------|
|
[
Applications
](
applications.md
)
|
`/applications`
|
|
[
Audit Events
](
audit_events.md
)
**(PREMIUM ONLY)**
|
`/audit_events`
|
|
[
Avatar
](
avatar.md
)
|
`/avatar`
|
|
[
Broadcast messages
](
broadcast_messages.md
)
|
`/broadcast_messages`
|
|
[
Code snippets
](
snippets.md
)
|
`/snippets`
|
...
...
doc/api/audit_events.md
0 → 100644
View file @
759cd6c2
# Audit Events API **(PREMIUM ONLY)**
The Audit Events API allows you to retrieve
[
instance audit events
](
../administration/audit_events.md#instance-events-premium-only
)
.
To retrieve audit events using the API, you must
[
authenticate yourself
](
README.html#authentication
)
as an Administrator.
## Retrieve all instance audit events
```
GET /audit_events
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`created_after`
| string | no | Return audit events created on or after the given time. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ |
|
`created_before`
| string | no | Return audit events created on or before the given time. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ |
|
`entity_type`
| string | no | Return audit events for the given entity type. Valid values are:
`User`
,
`Group`
, or
`Project`
. |
|
`entity_id`
| boolean | no | Return audit events for the given entity ID. Requires
`entity_type`
attribute to be present. |
By default,
`GET`
requests return 20 results at a time because the API results
are paginated.
Read more on
[
pagination
](
README.md#pagination
)
.
```
bash
curl
--header
"PRIVATE-TOKEN: <your_access_token>"
https://primary.example.com/api/v4/audit_events
```
Example response:
```
json
[
{
"id"
:
1
,
"author_id"
:
1
,
"entity_id"
:
6
,
"entity_type"
:
"Project"
,
"details"
:
{
"custom_message"
:
"Project archived"
,
"author_name"
:
"Administrator"
,
"target_id"
:
"flightjs/flight"
,
"target_type"
:
"Project"
,
"target_details"
:
"flightjs/flight"
,
"ip_address"
:
"127.0.0.1"
,
"entity_path"
:
"flightjs/flight"
},
"created_at"
:
"2019-08-30T07:00:41.885Z"
},
{
"id"
:
2
,
"author_id"
:
1
,
"entity_id"
:
60
,
"entity_type"
:
"Group"
,
"details"
:
{
"add"
:
"group"
,
"author_name"
:
"Administrator"
,
"target_id"
:
"flightjs"
,
"target_type"
:
"Group"
,
"target_details"
:
"flightjs"
,
"ip_address"
:
"127.0.0.1"
,
"entity_path"
:
"flightjs"
},
"created_at"
:
"2019-08-27T18:36:44.162Z"
},
{
"id"
:
3
,
"author_id"
:
51
,
"entity_id"
:
51
,
"entity_type"
:
"User"
,
"details"
:
{
"change"
:
"email address"
,
"from"
:
"hello@flightjs.com"
,
"to"
:
"maintainer@flightjs.com"
,
"author_name"
:
"Andreas"
,
"target_id"
:
51
,
"target_type"
:
"User"
,
"target_details"
:
"Andreas"
,
"ip_address"
:
null
,
"entity_path"
:
"Andreas"
},
"created_at"
:
"2019-08-22T16:34:25.639Z"
}
]
```
## Retrieve single instance audit event
```
GET /audit_events/:id
```
```
bash
curl
--header
"PRIVATE-TOKEN: <your_access_token>"
https://primary.example.com/api/v4/audit_events/1
```
Example response:
```
json
{
"id"
:
1
,
"author_id"
:
1
,
"entity_id"
:
6
,
"entity_type"
:
"Project"
,
"details"
:
{
"custom_message"
:
"Project archived"
,
"author_name"
:
"Administrator"
,
"target_id"
:
"flightjs/flight"
,
"target_type"
:
"Project"
,
"target_details"
:
"flightjs/flight"
,
"ip_address"
:
"127.0.0.1"
,
"entity_path"
:
"flightjs/flight"
},
"created_at"
:
"2019-08-30T07:00:41.885Z"
}
```
doc/api/environments.md
View file @
759cd6c2
...
...
@@ -26,7 +26,8 @@ Example response:
"id"
:
1
,
"name"
:
"review/fix-foo"
,
"slug"
:
"review-fix-foo-dfjre3"
,
"external_url"
:
"https://review-fix-foo-dfjre3.example.gitlab.com"
"external_url"
:
"https://review-fix-foo-dfjre3.example.gitlab.com"
,
"state"
:
"available"
}
]
```
...
...
@@ -54,12 +55,14 @@ Example of response
"name"
:
"review/fix-foo"
,
"slug"
:
"review-fix-foo-dfjre3"
,
"external_url"
:
"https://review-fix-foo-dfjre3.example.gitlab.com"
"state"
:
"available"
,
"last_deployment"
:
{
"id"
:
100
,
"iid"
:
34
,
"ref"
:
"fdroid"
,
"sha"
:
"416d8ea11849050d3d1f5104cf8cf51053e790ab"
,
"created_at"
:
"2019-03-25T18:55:13.252Z"
,
"status"
:
"success"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
...
...
@@ -163,7 +166,8 @@ Example response:
"id"
:
1
,
"name"
:
"deploy"
,
"slug"
:
"deploy"
,
"external_url"
:
"https://deploy.example.gitlab.com"
"external_url"
:
"https://deploy.example.gitlab.com"
,
"state"
:
"available"
}
```
...
...
@@ -195,7 +199,8 @@ Example response:
"id"
:
1
,
"name"
:
"staging"
,
"slug"
:
"staging"
,
"external_url"
:
"https://staging.example.gitlab.com"
"external_url"
:
"https://staging.example.gitlab.com"
,
"state"
:
"available"
}
```
...
...
@@ -240,6 +245,7 @@ Example response:
"id"
:
1
,
"name"
:
"deploy"
,
"slug"
:
"deploy"
,
"external_url"
:
"https://deploy.example.gitlab.com"
"external_url"
:
"https://deploy.example.gitlab.com"
,
"state"
:
"stopped"
}
```
lib/api/entities.rb
View file @
759cd6c2
...
...
@@ -1470,11 +1470,13 @@ module API
expose
:user
,
using:
Entities
::
UserBasic
expose
:environment
,
using:
Entities
::
EnvironmentBasic
expose
:deployable
,
using:
Entities
::
Job
expose
:status
end
class
Environment
<
EnvironmentBasic
expose
:project
,
using:
Entities
::
BasicProjectDetails
expose
:last_deployment
,
using:
Entities
::
Deployment
,
if:
{
last_deployment:
true
}
expose
:state
end
class
LicenseBasic
<
Grape
::
Entity
...
...
lib/banzai/filter/video_link_filter.rb
View file @
759cd6c2
...
...
@@ -8,8 +8,8 @@ module Banzai
# a "Download" link in the case the video cannot be played.
class
VideoLinkFilter
<
HTML
::
Pipeline
::
Filter
def
call
doc
.
xpath
(
query
).
each
do
|
el
|
el
.
replace
(
video_node
(
doc
,
el
))
doc
.
xpath
(
'descendant-or-self::img[not(ancestor::a)]'
).
each
do
|
el
|
el
.
replace
(
video_node
(
doc
,
el
))
if
has_video_extension?
(
el
)
end
doc
...
...
@@ -17,22 +17,10 @@ module Banzai
private
def
query
@query
||=
begin
src_query
=
UploaderHelper
::
SAFE_VIDEO_EXT
.
map
do
|
ext
|
"'.
#{
ext
}
' = substring(@src, string-length(@src) -
#{
ext
.
size
}
)"
end
def
has_video_extension?
(
element
)
src_attr
=
context
[
:asset_proxy_enabled
]
?
'data-canonical-src'
:
'src'
if
context
[
:asset_proxy_enabled
].
present?
src_query
.
concat
(
UploaderHelper
::
SAFE_VIDEO_EXT
.
map
do
|
ext
|
"'.
#{
ext
}
' = substring(@data-canonical-src, string-length(@data-canonical-src) -
#{
ext
.
size
}
)"
end
)
end
"descendant-or-self::img[not(ancestor::a) and (
#{
src_query
.
join
(
' or '
)
}
)]"
end
element
.
attr
(
src_attr
).
downcase
.
end_with?
(
*
UploaderHelper
::
SAFE_VIDEO_EXT
)
end
def
video_node
(
doc
,
element
)
...
...
lib/gitlab/diff/file.rb
View file @
759cd6c2
...
...
@@ -428,8 +428,8 @@ module Gitlab
def
viewer_class_from
(
classes
)
return
unless
diffable?
return
if
different_type?
||
external_storage_error?
return
unless
new_file?
||
deleted_file?
||
content_changed?
return
if
different_type?
||
external_storage_error?
verify_binary
=
!
stored_externally?
...
...
lib/gitlab/github_import/importer/releases_importer.rb
View file @
759cd6c2
...
...
@@ -47,11 +47,7 @@ module Gitlab
end
def
description_for
(
release
)
if
release
.
body
.
present?
release
.
body
else
"Release for tag
#{
release
.
tag_name
}
"
end
release
.
body
.
presence
||
"Release for tag
#{
release
.
tag_name
}
"
end
end
end
...
...
spec/features/projects/commits/user_browses_commits_spec.rb
View file @
759cd6c2
...
...
@@ -93,13 +93,13 @@ describe 'User browses commits' do
context
'when the blob does not exist'
do
let
(
:commit
)
{
create
(
:commit
,
project:
project
)
}
it
'
shows a blank label
'
do
it
'
renders successfully
'
do
allow_any_instance_of
(
Gitlab
::
Diff
::
File
).
to
receive
(
:blob
).
and_return
(
nil
)
allow_any_instance_of
(
Gitlab
::
Diff
::
File
).
to
receive
(
:binary?
).
and_return
(
true
)
visit
(
project_commit_path
(
project
,
commit
))
expect
(
find
(
'.diff-file-changes'
,
visible:
false
)).
to
have_content
(
'
No file name available
'
)
expect
(
find
(
'.diff-file-changes'
,
visible:
false
)).
to
have_content
(
'
files/ruby/popen.rb
'
)
end
end
...
...
spec/fixtures/api/schemas/deployment.json
View file @
759cd6c2
...
...
@@ -60,7 +60,8 @@
"scheduled_actions"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"job/job.json"
}
}
},
"status"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/public_api/v4/deployment.json
View file @
759cd6c2
...
...
@@ -26,7 +26,8 @@
{
"type"
:
"null"
},
{
"$ref"
:
"job.json"
}
]
}
},
"status"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/public_api/v4/environment.json
View file @
759cd6c2
...
...
@@ -17,7 +17,8 @@
{
"type"
:
"null"
},
{
"$ref"
:
"deployment.json"
}
]
}
},
"state"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/frontend/jobs/store/utils_spec.js
View file @
759cd6c2
...
...
@@ -3,6 +3,7 @@ import {
updateIncrementalTrace
,
parseHeaderLine
,
parseLine
,
findOffsetAndRemove
,
}
from
'
~/jobs/store/utils
'
;
import
{
utilsMockData
,
...
...
@@ -83,6 +84,91 @@ describe('Jobs Store Utils', () => {
});
});
describe
(
'
findOffsetAndRemove
'
,
()
=>
{
describe
(
'
when last item is header
'
,
()
=>
{
const
existingLog
=
[
{
isHeader
:
true
,
isClosed
:
true
,
line
:
{
content
:
[{
text
:
'
bar
'
}],
offset
:
10
,
lineNumber
:
1
},
},
];
describe
(
'
and matches the offset
'
,
()
=>
{
it
(
'
returns an array with the item removed
'
,
()
=>
{
const
newData
=
[{
offset
:
10
,
content
:
[{
text
:
'
foobar
'
}]
}];
const
result
=
findOffsetAndRemove
(
newData
,
existingLog
);
expect
(
result
).
toEqual
([]);
});
});
describe
(
'
and does not match the offset
'
,
()
=>
{
it
(
'
returns the provided existing log
'
,
()
=>
{
const
newData
=
[{
offset
:
110
,
content
:
[{
text
:
'
foobar
'
}]
}];
const
result
=
findOffsetAndRemove
(
newData
,
existingLog
);
expect
(
result
).
toEqual
(
existingLog
);
});
});
});
describe
(
'
when last item is a regular line
'
,
()
=>
{
const
existingLog
=
[{
content
:
[{
text
:
'
bar
'
}],
offset
:
10
,
lineNumber
:
1
}];
describe
(
'
and matches the offset
'
,
()
=>
{
it
(
'
returns an array with the item removed
'
,
()
=>
{
const
newData
=
[{
offset
:
10
,
content
:
[{
text
:
'
foobar
'
}]
}];
const
result
=
findOffsetAndRemove
(
newData
,
existingLog
);
expect
(
result
).
toEqual
([]);
});
});
describe
(
'
and does not match the fofset
'
,
()
=>
{
it
(
'
returns the provided old log
'
,
()
=>
{
const
newData
=
[{
offset
:
101
,
content
:
[{
text
:
'
foobar
'
}]
}];
const
result
=
findOffsetAndRemove
(
newData
,
existingLog
);
expect
(
result
).
toEqual
(
existingLog
);
});
});
});
describe
(
'
when last item is nested
'
,
()
=>
{
const
existingLog
=
[
{
isHeader
:
true
,
isClosed
:
true
,
lines
:
[{
offset
:
101
,
content
:
[{
text
:
'
foobar
'
}],
lineNumber
:
2
}],
line
:
{
offset
:
10
,
lineNumber
:
1
,
section_duration
:
'
10:00
'
,
},
},
];
describe
(
'
and matches the offset
'
,
()
=>
{
it
(
'
returns an array with the last nested line item removed
'
,
()
=>
{
const
newData
=
[{
offset
:
101
,
content
:
[{
text
:
'
foobar
'
}]
}];
const
result
=
findOffsetAndRemove
(
newData
,
existingLog
);
expect
(
result
[
0
].
lines
).
toEqual
([]);
});
});
describe
(
'
and does not match the offset
'
,
()
=>
{
it
(
'
returns the provided old log
'
,
()
=>
{
const
newData
=
[{
offset
:
120
,
content
:
[{
text
:
'
foobar
'
}]
}];
const
result
=
findOffsetAndRemove
(
newData
,
existingLog
);
expect
(
result
).
toEqual
(
existingLog
);
});
});
});
});
describe
(
'
updateIncrementalTrace
'
,
()
=>
{
describe
(
'
without repeated section
'
,
()
=>
{
it
(
'
concats and parses both arrays
'
,
()
=>
{
...
...
spec/lib/banzai/filter/video_link_filter_spec.rb
View file @
759cd6c2
...
...
@@ -17,27 +17,32 @@ describe Banzai::Filter::VideoLinkFilter do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'when the element src has a video extension'
do
UploaderHelper
::
SAFE_VIDEO_EXT
.
each
do
|
ext
|
it
"replaces the image tag 'path/video.
#{
ext
}
' with a video tag"
do
container
=
filter
(
link_to_image
(
"/path/video.
#{
ext
}
"
)).
children
.
first
shared_examples
'replaces the image tag with a video tag'
do
|
ext
|
it
"replaces the image tag 'path/video.
#{
ext
}
' with a video tag"
do
container
=
filter
(
link_to_image
(
"/path/video.
#{
ext
}
"
)).
children
.
first
expect
(
container
.
name
).
to
eq
'div'
expect
(
container
[
'class'
]).
to
eq
'video-container'
expect
(
container
.
name
).
to
eq
'div'
expect
(
container
[
'class'
]).
to
eq
'video-container'
video
,
paragraph
=
container
.
children
video
,
paragraph
=
container
.
children
expect
(
video
.
name
).
to
eq
'video'
expect
(
video
[
'src'
]).
to
eq
"/path/video.
#{
ext
}
"
expect
(
video
.
name
).
to
eq
'video'
expect
(
video
[
'src'
]).
to
eq
"/path/video.
#{
ext
}
"
expect
(
paragraph
.
name
).
to
eq
'p'
expect
(
paragraph
.
name
).
to
eq
'p'
link
=
paragraph
.
children
.
first
link
=
paragraph
.
children
.
first
expect
(
link
.
name
).
to
eq
'a'
expect
(
link
[
'href'
]).
to
eq
"/path/video.
#{
ext
}
"
expect
(
link
[
'target'
]).
to
eq
'_blank'
end
end
expect
(
link
.
name
).
to
eq
'a'
expect
(
link
[
'href'
]).
to
eq
"/path/video.
#{
ext
}
"
expect
(
link
[
'target'
]).
to
eq
'_blank'
end
context
'when the element src has a video extension'
do
UploaderHelper
::
SAFE_VIDEO_EXT
.
each
do
|
ext
|
it_behaves_like
'replaces the image tag with a video tag'
,
ext
it_behaves_like
'replaces the image tag with a video tag'
,
ext
.
upcase
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