Commit 9194297e authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 76bda5da add00b69
# coding: utf-8
# frozen_string_literal: true # frozen_string_literal: true
module PageLayoutHelper module PageLayoutHelper
...@@ -36,7 +37,7 @@ module PageLayoutHelper ...@@ -36,7 +37,7 @@ module PageLayoutHelper
if description.present? if description.present?
@page_description = description.squish @page_description = description.squish
elsif @page_description.present? elsif @page_description.present?
sanitize(@page_description, tags: []).truncate_words(30) sanitize(@page_description.truncate_words(30), tags: [])
end end
end end
......
---
title: Fix performance issue with large Markdown content in issue or merge request
description
merge_request: 28597
author:
type: performance
---
title: Fix invalid visibility string comparison in project import
merge_request: 28612
author:
type: fixed
...@@ -129,7 +129,7 @@ module Gitlab ...@@ -129,7 +129,7 @@ module Gitlab
def visibility_level def visibility_level
level = override_params['visibility_level'] || json_params['visibility_level'] || @project.visibility_level level = override_params['visibility_level'] || json_params['visibility_level'] || @project.visibility_level
level = @project.group.visibility_level if @project.group && level > @project.group.visibility_level level = @project.group.visibility_level if @project.group && level.to_i > @project.group.visibility_level
{ 'visibility_level' => level } { 'visibility_level' => level }
end end
......
...@@ -38,6 +38,14 @@ describe PageLayoutHelper do ...@@ -38,6 +38,14 @@ describe PageLayoutHelper do
expect(helper.page_description).to eq 'Bold Header' expect(helper.page_description).to eq 'Bold Header'
end end
it 'truncates before sanitizing' do
helper.page_description('<b>Bold</b> <img> <img> <img> <h1>Header</h1> ' * 10)
# 12 words because <img> was counted as a word
expect(helper.page_description)
.to eq('Bold Header Bold Header Bold Header Bold Header Bold Header Bold Header...')
end
end end
describe 'page_image' do describe 'page_image' do
......
...@@ -328,6 +328,19 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -328,6 +328,19 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end end
context 'when the project has overridden params in import data' do context 'when the project has overridden params in import data' do
it 'handles string versions of visibility_level' do
# Project needs to be in a group for visibility level comparison
# to happen
group = create(:group)
project.group = group
project.create_import_data(data: { override_params: { visibility_level: Gitlab::VisibilityLevel::INTERNAL.to_s } })
restored_project_json
expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL)
end
it 'overwrites the params stored in the JSON' do it 'overwrites the params stored in the JSON' do
project.create_import_data(data: { override_params: { description: "Overridden" } }) project.create_import_data(data: { override_params: { description: "Overridden" } })
......
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