Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 12:06:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 12:06:04 +0300
commit759cd6c2985088d187ed519f2a881c2c690b34ec (patch)
tree183e291c0404bf9b3ac7638be6fa1fe94b7d2d14 /lib
parent9735395f94088df7e6470e3e8a2638385ede36b6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb2
-rw-r--r--lib/banzai/filter/video_link_filter.rb22
-rw-r--r--lib/gitlab/diff/file.rb2
-rw-r--r--lib/gitlab/github_import/importer/releases_importer.rb6
4 files changed, 9 insertions, 23 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 9d393f0217b..72bbba8065e 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -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
diff --git a/lib/banzai/filter/video_link_filter.rb b/lib/banzai/filter/video_link_filter.rb
index 58006cc6c13..bdd257a5e67 100644
--- a/lib/banzai/filter/video_link_filter.rb
+++ b/lib/banzai/filter/video_link_filter.rb
@@ -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)
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb
index c46087e65de..30fe7440148 100644
--- a/lib/gitlab/diff/file.rb
+++ b/lib/gitlab/diff/file.rb
@@ -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?
diff --git a/lib/gitlab/github_import/importer/releases_importer.rb b/lib/gitlab/github_import/importer/releases_importer.rb
index fe3a8d4aea5..1881f715c99 100644
--- a/lib/gitlab/github_import/importer/releases_importer.rb
+++ b/lib/gitlab/github_import/importer/releases_importer.rb
@@ -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