diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 09:06:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 09:06:04 +0000 |
commit | 759cd6c2985088d187ed519f2a881c2c690b34ec (patch) | |
tree | 183e291c0404bf9b3ac7638be6fa1fe94b7d2d14 /lib | |
parent | 9735395f94088df7e6470e3e8a2638385ede36b6 (diff) | |
download | gitlab-ce-759cd6c2985088d187ed519f2a881c2c690b34ec.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/banzai/filter/video_link_filter.rb | 22 | ||||
-rw-r--r-- | lib/gitlab/diff/file.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/github_import/importer/releases_importer.rb | 6 |
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 |