diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-11 12:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-11 12:09:45 +0300 |
commit | c7ba7b997608a103a0a9165b2e5cef9530c4ef53 (patch) | |
tree | 3af88eaacba25539b97da4ad358418b6a69c11d7 /app | |
parent | a031b1f4f34470fba578856dc7ab735a6f54733a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
14 files changed, 113 insertions, 17 deletions
diff --git a/app/assets/javascripts/alert_management/components/alert_management_list.vue b/app/assets/javascripts/alert_management/components/alert_management_list.vue index f1716182e5f..7fe74eb1da8 100644 --- a/app/assets/javascripts/alert_management/components/alert_management_list.vue +++ b/app/assets/javascripts/alert_management/components/alert_management_list.vue @@ -197,11 +197,11 @@ export default { </template> <template #cell(startedAt)="{ item }"> - <time-ago :time="item.startedAt" /> + <time-ago v-if="item.startedAt" :time="item.startedAt" /> </template> <template #cell(endedAt)="{ item }"> - <time-ago :time="item.endedAt" /> + <time-ago v-if="item.endedAt" :time="item.endedAt" /> </template> <template #cell(title)="{ item }"> diff --git a/app/assets/javascripts/behaviors/markdown/render_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_mermaid.js index 057cdb6cc4c..e42f6e5ba48 100644 --- a/app/assets/javascripts/behaviors/markdown/render_mermaid.js +++ b/app/assets/javascripts/behaviors/markdown/render_mermaid.js @@ -82,7 +82,7 @@ function renderMermaidEl(el) { return; } - svg.classList.add('mermaid'); + svg.classList.add('mermaid', 'mw-100'); // pre > code > svg svg.closest('pre').replaceWith(svg); diff --git a/app/assets/javascripts/ci_variable_list/constants.js b/app/assets/javascripts/ci_variable_list/constants.js index 5fe1e32e37e..a4db6481720 100644 --- a/app/assets/javascripts/ci_variable_list/constants.js +++ b/app/assets/javascripts/ci_variable_list/constants.js @@ -4,7 +4,7 @@ import { __ } from '~/locale'; export const ADD_CI_VARIABLE_MODAL_ID = 'add-ci-variable'; export const displayText = { - variableText: __('Var'), + variableText: __('Variable'), fileText: __('File'), allEnvironmentsText: __('All (default)'), }; diff --git a/app/assets/javascripts/ide/services/index.js b/app/assets/javascripts/ide/services/index.js index 3adf0cf073f..3d11c683711 100644 --- a/app/assets/javascripts/ide/services/index.js +++ b/app/assets/javascripts/ide/services/index.js @@ -88,8 +88,8 @@ export default { commit(projectId, payload) { return Api.commitMultiple(projectId, payload); }, - getFiles(projectUrl, ref) { - const url = `${projectUrl}/-/files/${ref}`; + getFiles(projectPath, ref) { + const url = `${gon.relative_url_root}/${projectPath}/-/files/${ref}`; return axios.get(url, { params: { format: 'json' } }); }, lastCommitPipelines({ getters }) { diff --git a/app/assets/javascripts/ide/stores/actions/tree.js b/app/assets/javascripts/ide/stores/actions/tree.js index 7d48f0adc4c..1ca608f1287 100644 --- a/app/assets/javascripts/ide/stores/actions/tree.js +++ b/app/assets/javascripts/ide/stores/actions/tree.js @@ -59,7 +59,7 @@ export const getFiles = ({ state, commit, dispatch }, payload = {}) => commit(types.CREATE_TREE, { treePath: `${projectId}/${branchId}` }); service - .getFiles(selectedProject.web_url, ref) + .getFiles(selectedProject.path_with_namespace, ref) .then(({ data }) => { const { entries, treeList } = decorateFiles({ data, diff --git a/app/assets/javascripts/image_diff/helpers/badge_helper.js b/app/assets/javascripts/image_diff/helpers/badge_helper.js index 7921650e8a0..229e0a62c51 100644 --- a/app/assets/javascripts/image_diff/helpers/badge_helper.js +++ b/app/assets/javascripts/image_diff/helpers/badge_helper.js @@ -15,7 +15,7 @@ export function createImageBadge(noteId, { x, y }, classNames = []) { export function addImageBadge(containerEl, { coordinate, badgeText, noteId }) { const buttonEl = createImageBadge(noteId, coordinate, ['badge', 'badge-pill']); - buttonEl.innerText = badgeText; + buttonEl.textContent = badgeText; containerEl.appendChild(buttonEl); } @@ -32,6 +32,6 @@ export function addAvatarBadge(el, event) { // Add badge to new comment const avatarBadgeEl = el.querySelector(`#${noteId} .badge`); - avatarBadgeEl.innerText = badgeNumber; + avatarBadgeEl.textContent = badgeNumber; avatarBadgeEl.classList.remove('hidden'); } diff --git a/app/assets/javascripts/image_diff/helpers/dom_helper.js b/app/assets/javascripts/image_diff/helpers/dom_helper.js index 74ca907c99f..a61e5f01f9b 100644 --- a/app/assets/javascripts/image_diff/helpers/dom_helper.js +++ b/app/assets/javascripts/image_diff/helpers/dom_helper.js @@ -11,12 +11,12 @@ export function setPositionDataAttribute(el, options) { export function updateDiscussionAvatarBadgeNumber(discussionEl, newBadgeNumber) { const avatarBadgeEl = discussionEl.querySelector('.image-diff-avatar-link .badge'); - avatarBadgeEl.innerText = newBadgeNumber; + avatarBadgeEl.textContent = newBadgeNumber; } export function updateDiscussionBadgeNumber(discussionEl, newBadgeNumber) { const discussionBadgeEl = discussionEl.querySelector('.badge'); - discussionBadgeEl.innerText = newBadgeNumber; + discussionBadgeEl.textContent = newBadgeNumber; } export function toggleCollapsed(event) { diff --git a/app/assets/javascripts/image_diff/image_diff.js b/app/assets/javascripts/image_diff/image_diff.js index 89f696dd1d8..079f4a63f6e 100644 --- a/app/assets/javascripts/image_diff/image_diff.js +++ b/app/assets/javascripts/image_diff/image_diff.js @@ -128,7 +128,7 @@ export default class ImageDiff { const updatedBadgeNumber = index; const discussionEl = this.el.querySelector(`#discussion_${discussionId}`); - imageBadgeEls[index].innerText = updatedBadgeNumber; + imageBadgeEls[index].textContent = updatedBadgeNumber; imageDiffHelper.updateDiscussionBadgeNumber(discussionEl, updatedBadgeNumber); imageDiffHelper.updateDiscussionAvatarBadgeNumber(discussionEl, updatedBadgeNumber); diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index a525f660801..6e695de447d 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -1396,7 +1396,7 @@ export default class Notes { } /** - * Check if note does not exists on page + * Check if note does not exist on page */ static isNewNote(noteEntity, noteIds) { return $.inArray(noteEntity.id, noteIds) === -1; diff --git a/app/controllers/projects/design_management/designs/raw_images_controller.rb b/app/controllers/projects/design_management/designs/raw_images_controller.rb new file mode 100644 index 00000000000..beb7e9d294b --- /dev/null +++ b/app/controllers/projects/design_management/designs/raw_images_controller.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Returns full-size design images +module Projects + module DesignManagement + module Designs + class RawImagesController < Projects::DesignManagement::DesignsController + include SendsBlob + + skip_before_action :default_cache_headers, only: :show + + def show + blob = design_repository.blob_at(ref, design.full_path) + + send_blob(design_repository, blob, inline: false, allow_caching: project.public?) + end + + private + + def design_repository + @design_repository ||= project.design_repository + end + + def ref + sha || design_repository.root_ref + end + end + end + end +end diff --git a/app/controllers/projects/design_management/designs/resized_image_controller.rb b/app/controllers/projects/design_management/designs/resized_image_controller.rb new file mode 100644 index 00000000000..50a997f32db --- /dev/null +++ b/app/controllers/projects/design_management/designs/resized_image_controller.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Returns smaller sized design images +module Projects + module DesignManagement + module Designs + class ResizedImageController < Projects::DesignManagement::DesignsController + include SendFileUpload + + before_action :validate_size! + + skip_before_action :default_cache_headers, only: :show + + def show + relation = design.actions + relation = relation.up_to_version(sha) if sha + action = relation.most_recent.first + + return render_404 unless action + + # This controller returns a 404 if the the `size` param + # is not one of our specific sizes, so using `send` here is safe. + uploader = action.public_send(:"image_#{size}") # rubocop:disable GitlabSecurity/PublicSend + + return render_404 unless uploader.file # The image has not been processed + + if stale?(etag: action.cache_key) + workhorse_set_content_type! + + send_upload(uploader, attachment: design.filename) + end + end + + private + + def validate_size! + render_404 unless ::DesignManagement::DESIGN_IMAGE_SIZES.include?(size) + end + + def size + params[:id] + end + end + end + end +end diff --git a/app/controllers/projects/design_management/designs_controller.rb b/app/controllers/projects/design_management/designs_controller.rb new file mode 100644 index 00000000000..fec09fa9515 --- /dev/null +++ b/app/controllers/projects/design_management/designs_controller.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class Projects::DesignManagement::DesignsController < Projects::ApplicationController + before_action :authorize_read_design! + + private + + def authorize_read_design! + unless can?(current_user, :read_design, design) + access_denied! + end + end + + def design + @design ||= project.designs.find(params[:design_id]) + end + + def sha + params[:sha].presence + end +end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index d759983dafa..fa4b91c5e02 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -21,7 +21,6 @@ class Projects::IssuesController < Projects::ApplicationController prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) } prepend_before_action(only: [:calendar]) { authenticate_sessionless_user!(:ics) } prepend_before_action :authenticate_user!, only: [:new, :export_csv] - # designs is only applicable to EE, but defining a prepend_before_action in EE code would overwrite this prepend_before_action :store_uri, only: [:new, :show, :designs] before_action :whitelist_query_limiting, only: [:create, :create_merge_request, :move, :bulk_update] diff --git a/app/graphql/types/alert_management/alert_sort_enum.rb b/app/graphql/types/alert_management/alert_sort_enum.rb index 76ef43d9dcf..e6d38af8170 100644 --- a/app/graphql/types/alert_management/alert_sort_enum.rb +++ b/app/graphql/types/alert_management/alert_sort_enum.rb @@ -11,9 +11,9 @@ module Types value 'END_TIME_ASC', 'End time by ascending order', value: :end_time_asc value 'END_TIME_DESC', 'End time by descending order', value: :end_time_desc value 'CREATED_TIME_ASC', 'Created time by ascending order', value: :created_at_asc - value 'CREATED_TIME_DESC', 'Created time by ascending order', value: :created_at_desc - value 'UPDATED_TIME_ASC', 'Created time by ascending order', value: :updated_at_desc - value 'UPDATED_TIME_DESC', 'Created time by ascending order', value: :updated_at_desc + value 'CREATED_TIME_DESC', 'Created time by descending order', value: :created_at_desc + value 'UPDATED_TIME_ASC', 'Created time by ascending order', value: :updated_at_asc + value 'UPDATED_TIME_DESC', 'Created time by descending order', value: :updated_at_desc value 'EVENTS_COUNT_ASC', 'Events count by ascending order', value: :events_count_asc value 'EVENTS_COUNT_DESC', 'Events count by descending order', value: :events_count_desc value 'SEVERITY_ASC', 'Severity by ascending order', value: :severity_asc |