diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-28 01:28:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-28 01:29:21 +0300 |
commit | 7876ab520632ed36f678ccd8a9c16dc569638904 (patch) | |
tree | 8f7b9f60ad93880cf0bcbe4f611cb7c34eb80282 /app | |
parent | 0cd445b1da235ab1807f7018ac8292d3bf6fec9f (diff) |
Add latest changes from gitlab-org/security/gitlab@16-2-stable-ee
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/behaviors/markdown/render_math.js | 21 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/markdown_area.scss | 10 | ||||
-rw-r--r-- | app/models/project_team.rb | 6 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 1 |
4 files changed, 27 insertions, 11 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_math.js b/app/assets/javascripts/behaviors/markdown/render_math.js index b2348cf0bad..7525fc76d16 100644 --- a/app/assets/javascripts/behaviors/markdown/render_math.js +++ b/app/assets/javascripts/behaviors/markdown/render_math.js @@ -66,16 +66,12 @@ class SafeMathRenderer { el.removeAttribute('style'); if (!forceRender && (this.totalMS >= MAX_RENDER_TIME_MS || text.length > MAX_MATH_CHARS)) { // Show unrendered math code - const wrapperElement = document.createElement('div'); const codeElement = document.createElement('pre'); codeElement.className = 'code'; codeElement.textContent = el.textContent; codeElement.dataset.mathStyle = el.dataset.mathStyle; - const { parentNode } = el; - parentNode.replaceChild(wrapperElement, el); - let message; if (text.length > MAX_MATH_CHARS) { message = sprintf( @@ -103,11 +99,11 @@ class SafeMathRenderer { </div> `; - if (!wrapperElement.classList.contains('lazy-alert-shown')) { + if (!el.classList.contains('lazy-alert-shown')) { // eslint-disable-next-line no-unsanitized/property - wrapperElement.innerHTML = html; - wrapperElement.append(codeElement); - wrapperElement.classList.add('lazy-alert-shown'); + el.innerHTML = html; + el.append(codeElement); + el.classList.add('lazy-alert-shown'); } // Render the next math @@ -125,6 +121,12 @@ class SafeMathRenderer { } try { + if (displayContainer.dataset.mathStyle === 'inline') { + displayContainer.classList.add('math-content-inline'); + } else { + displayContainer.classList.add('math-content-display'); + } + // eslint-disable-next-line no-unsanitized/property displayContainer.innerHTML = this.katex.renderToString(text, { displayMode: el.dataset.mathStyle === 'display', @@ -169,8 +171,7 @@ class SafeMathRenderer { render() { // Replace math blocks with a placeholder so they aren't rendered twice this.elements.forEach((el) => { - const placeholder = document.createElement('span'); - placeholder.style.display = 'none'; + const placeholder = document.createElement('div'); placeholder.dataset.mathStyle = el.dataset.mathStyle; placeholder.textContent = el.textContent; el.parentNode.replaceChild(placeholder, el); diff --git a/app/assets/stylesheets/framework/markdown_area.scss b/app/assets/stylesheets/framework/markdown_area.scss index f8f54567ef2..f0050b3d3f6 100644 --- a/app/assets/stylesheets/framework/markdown_area.scss +++ b/app/assets/stylesheets/framework/markdown_area.scss @@ -137,6 +137,16 @@ border-radius: $border-radius-default $border-radius-default 0 0; } +.math-content-inline { + overflow: auto; + display: inline-flex; +} + +.math-content-display { + overflow: auto; + display: block; +} + @include media-breakpoint-down(xs) { .referenced-users { margin-right: 0; diff --git a/app/models/project_team.rb b/app/models/project_team.rb index fbdc88e7b76..3bc1ad8a85c 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -120,7 +120,7 @@ class ProjectTeam def import(source_project, current_user) target_project = project - source_members = source_project.project_members.to_a + source_members = source_members_for_import(source_project) target_user_ids = target_project.project_members.pluck_user_ids importer_access_level = max_member_access(current_user.id) @@ -243,6 +243,10 @@ class ProjectTeam def member_user_ids Member.on_project_and_ancestors(project).select(:user_id) end + + def source_members_for_import(source_project) + source_project.project_members.to_a + end end ProjectTeam.prepend_mod_with('ProjectTeam') diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index e0b75163604..549b5b2e156 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -283,6 +283,7 @@ class ProjectPolicy < BasePolicy enable :change_visibility_level enable :remove_project enable :archive_project + enable :link_forked_project enable :remove_fork_project enable :destroy_merge_request enable :destroy_issue |