diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-08 15:08:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-08 15:08:48 +0300 |
commit | 88bacc889f129f8d95af34f1781dd66769ec27cc (patch) | |
tree | 28174e332bfc9ebd2dad2305a8f5300e7a656ca3 /app | |
parent | ae6b82598ff1a9844c132e53799c252225b2c4c1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
45 files changed, 152 insertions, 95 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_gfm.js b/app/assets/javascripts/behaviors/markdown/render_gfm.js index 5079da9aa02..abda31679d8 100644 --- a/app/assets/javascripts/behaviors/markdown/render_gfm.js +++ b/app/assets/javascripts/behaviors/markdown/render_gfm.js @@ -24,7 +24,7 @@ $.fn.renderGFM = function renderGFM() { const mrPopoverElements = this.find('.gfm-merge_request').get(); if (mrPopoverElements.length) { - import(/* webpackChunkName: 'MrPopoverBundle' */ '../../mr_popover') + import(/* webpackChunkName: 'MrPopoverBundle' */ '~/mr_popover') .then(({ default: initMRPopovers }) => { initMRPopovers(mrPopoverElements); }) diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js index 16556252a64..6124befd3b6 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js @@ -4,7 +4,7 @@ import { clickCopyToClipboardButton } from '~/behaviors/copy_to_clipboard'; import { getSelectedFragment } from '~/lib/utils/common_utils'; import { isElementVisible } from '~/lib/utils/dom_utils'; import { DEBOUNCE_DROPDOWN_DELAY } from '~/vue_shared/components/sidebar/labels_select_widget/constants'; -import Sidebar from '../../right_sidebar'; +import Sidebar from '~/right_sidebar'; import { CopyAsGFM } from '../markdown/copy_as_gfm'; import { keysFor, diff --git a/app/assets/javascripts/blob/pdf/pdf_viewer.vue b/app/assets/javascripts/blob/pdf/pdf_viewer.vue index a1a62abeb6f..e07e415d6cf 100644 --- a/app/assets/javascripts/blob/pdf/pdf_viewer.vue +++ b/app/assets/javascripts/blob/pdf/pdf_viewer.vue @@ -1,6 +1,6 @@ <script> import { GlLoadingIcon } from '@gitlab/ui'; -import PdfLab from '../../pdf/index.vue'; +import PdfLab from '~/pdf/index.vue'; export default { components: { diff --git a/app/assets/javascripts/boards/components/board_card_inner.vue b/app/assets/javascripts/boards/components/board_card_inner.vue index 02b99e86fd3..814ff16efec 100644 --- a/app/assets/javascripts/boards/components/board_card_inner.vue +++ b/app/assets/javascripts/boards/components/board_card_inner.vue @@ -13,7 +13,7 @@ import boardCardInner from 'ee_else_ce/boards/mixins/board_card_inner'; import { isScopedLabel } from '~/lib/utils/common_utils'; import { sprintf, __, n__ } from '~/locale'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue'; -import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import { ListType } from '../constants'; import BoardBlockedIcon from './board_blocked_icon.vue'; import IssueDueDate from './issue_due_date.vue'; diff --git a/app/assets/javascripts/code_navigation/components/app.vue b/app/assets/javascripts/code_navigation/components/app.vue index 5c77f087d63..d65b9a71288 100644 --- a/app/assets/javascripts/code_navigation/components/app.vue +++ b/app/assets/javascripts/code_navigation/components/app.vue @@ -1,6 +1,6 @@ <script> import { mapActions, mapState } from 'vuex'; -import eventHub from '../../notes/event_hub'; +import eventHub from '~/notes/event_hub'; import Popover from './popover.vue'; export default { diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index b63d49da677..075e1b4071e 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -21,7 +21,7 @@ import MrWidgetHowToMergeModal from '~/vue_merge_request_widget/components/mr_wi import PanelResizer from '~/vue_shared/components/panel_resizer.vue'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import notesEventHub from '../../notes/event_hub'; +import notesEventHub from '~/notes/event_hub'; import { TREE_LIST_WIDTH_STORAGE_KEY, INITIAL_TREE_WIDTH, diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue index cd441a613bd..b4bffdcb07f 100644 --- a/app/assets/javascripts/diffs/components/diff_content.vue +++ b/app/assets/javascripts/diffs/components/diff_content.vue @@ -9,9 +9,9 @@ import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; import NoPreviewViewer from '~/vue_shared/components/diff_viewer/viewers/no_preview.vue'; import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_diffable.vue'; -import NoteForm from '../../notes/components/note_form.vue'; -import eventHub from '../../notes/event_hub'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import NoteForm from '~/notes/components/note_form.vue'; +import eventHub from '~/notes/event_hub'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import { IMAGE_DIFF_POSITION_TYPE } from '../constants'; import { getDiffMode } from '../store/utils'; import DiffDiscussions from './diff_discussions.vue'; diff --git a/app/assets/javascripts/diffs/components/diff_discussions.vue b/app/assets/javascripts/diffs/components/diff_discussions.vue index 47a05ce11cc..b39b50c4cdc 100644 --- a/app/assets/javascripts/diffs/components/diff_discussions.vue +++ b/app/assets/javascripts/diffs/components/diff_discussions.vue @@ -2,7 +2,7 @@ import { GlIcon } from '@gitlab/ui'; import { mapActions } from 'vuex'; import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue'; -import noteableDiscussion from '../../notes/components/noteable_discussion.vue'; +import noteableDiscussion from '~/notes/components/noteable_discussion.vue'; export default { components: { diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 4e77bf81c1e..d8f27a967df 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -17,7 +17,7 @@ import { diffViewerErrors } from '~/ide/constants'; import { scrollToElement } from '~/lib/utils/common_utils'; import { sprintf } from '~/locale'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import notesEventHub from '../../notes/event_hub'; +import notesEventHub from '~/notes/event_hub'; import { DIFF_FILE_AUTOMATIC_COLLAPSE, diff --git a/app/assets/javascripts/diffs/components/diff_line_note_form.vue b/app/assets/javascripts/diffs/components/diff_line_note_form.vue index 5ce6037fd9a..7a30740e31b 100644 --- a/app/assets/javascripts/diffs/components/diff_line_note_form.vue +++ b/app/assets/javascripts/diffs/components/diff_line_note_form.vue @@ -4,13 +4,10 @@ import { s__ } from '~/locale'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import MultilineCommentForm from '../../notes/components/multiline_comment_form.vue'; -import { - commentLineOptions, - formatLineRange, -} from '../../notes/components/multiline_comment_utils'; -import noteForm from '../../notes/components/note_form.vue'; -import autosave from '../../notes/mixins/autosave'; +import MultilineCommentForm from '~/notes/components/multiline_comment_form.vue'; +import { commentLineOptions, formatLineRange } from '~/notes/components/multiline_comment_utils'; +import noteForm from '~/notes/components/note_form.vue'; +import autosave from '~/notes/mixins/autosave'; import { DIFF_NOTE_TYPE, INLINE_DIFF_LINES_KEY, diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index e967be23f42..7a30dc226a2 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -13,7 +13,7 @@ import httpStatusCodes from '~/lib/utils/http_status'; import Poll from '~/lib/utils/poll'; import { mergeUrlParams, getLocationHash } from '~/lib/utils/url_utility'; import { __, s__ } from '~/locale'; -import notesEventHub from '../../notes/event_hub'; +import notesEventHub from '~/notes/event_hub'; import { PARALLEL_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE, diff --git a/app/assets/javascripts/diffs/utils/performance.js b/app/assets/javascripts/diffs/utils/performance.js index 50bf17001a6..ad768c333e2 100644 --- a/app/assets/javascripts/diffs/utils/performance.js +++ b/app/assets/javascripts/diffs/utils/performance.js @@ -7,7 +7,7 @@ import { MR_DIFFS_MARK_DIFF_FILES_END, MR_DIFFS_MEASURE_FILE_TREE_DONE, MR_DIFFS_MEASURE_DIFF_FILES_DONE, -} from '../../performance/constants'; +} from '~/performance/constants'; import { EVT_PERF_MARK_FILE_TREE_START, diff --git a/app/assets/javascripts/environments/folder/environments_folder_bundle.js b/app/assets/javascripts/environments/folder/environments_folder_bundle.js index 206381e0b7e..4e5fe511f8a 100644 --- a/app/assets/javascripts/environments/folder/environments_folder_bundle.js +++ b/app/assets/javascripts/environments/folder/environments_folder_bundle.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; -import Translate from '../../vue_shared/translate'; +import Translate from '~/vue_shared/translate'; import environmentsFolderApp from './environments_folder_view.vue'; Vue.use(Translate); diff --git a/app/assets/javascripts/ide/components/ide_status_bar.vue b/app/assets/javascripts/ide/components/ide_status_bar.vue index 28ca1b6750f..32f87cb0a92 100644 --- a/app/assets/javascripts/ide/components/ide_status_bar.vue +++ b/app/assets/javascripts/ide/components/ide_status_bar.vue @@ -3,8 +3,8 @@ import { GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { mapActions, mapState, mapGetters } from 'vuex'; import timeAgoMixin from '~/vue_shared/mixins/timeago'; -import CiIcon from '../../vue_shared/components/ci_icon.vue'; -import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue'; +import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import userAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue'; import { rightSidebarViews } from '../constants'; import IdeStatusList from './ide_status_list.vue'; import IdeStatusMr from './ide_status_mr.vue'; diff --git a/app/assets/javascripts/image_diff/helpers/init_image_diff.js b/app/assets/javascripts/image_diff/helpers/init_image_diff.js index 51168b94e6d..55e1d802201 100644 --- a/app/assets/javascripts/image_diff/helpers/init_image_diff.js +++ b/app/assets/javascripts/image_diff/helpers/init_image_diff.js @@ -1,4 +1,4 @@ -import ImageFile from '../../commit/image_file'; +import ImageFile from '~/commit/image_file'; import ImageDiff from '../image_diff'; import ReplacedImageDiff from '../replaced_image_diff'; diff --git a/app/assets/javascripts/jira_connect/subscriptions/index.js b/app/assets/javascripts/jira_connect/subscriptions/index.js index 39800ec5067..3b584b5fe98 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/index.js +++ b/app/assets/javascripts/jira_connect/subscriptions/index.js @@ -1,4 +1,4 @@ -import '../../webpack'; +import '~/webpack'; import setConfigs from '@gitlab/ui/dist/config'; import Vue from 'vue'; diff --git a/app/assets/javascripts/mr_popover/components/mr_popover.vue b/app/assets/javascripts/mr_popover/components/mr_popover.vue index d99a3adb358..fef75b6d5d0 100644 --- a/app/assets/javascripts/mr_popover/components/mr_popover.vue +++ b/app/assets/javascripts/mr_popover/components/mr_popover.vue @@ -1,8 +1,8 @@ <script> /* eslint-disable @gitlab/vue-require-i18n-strings */ import { GlPopover, GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui'; -import CiIcon from '../../vue_shared/components/ci_icon.vue'; -import timeagoMixin from '../../vue_shared/mixins/timeago'; +import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import timeagoMixin from '~/vue_shared/mixins/timeago'; import { mrStates, humanMRStates } from '../constants'; import query from '../queries/merge_request.query.graphql'; diff --git a/app/assets/javascripts/notes/components/diff_discussion_header.vue b/app/assets/javascripts/notes/components/diff_discussion_header.vue index 0ce1eb8191a..45d97f278dc 100644 --- a/app/assets/javascripts/notes/components/diff_discussion_header.vue +++ b/app/assets/javascripts/notes/components/diff_discussion_header.vue @@ -6,7 +6,7 @@ import { mapActions } from 'vuex'; import { truncateSha } from '~/lib/utils/text_utility'; import { s__, __, sprintf } from '~/locale'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import noteEditedText from './note_edited_text.vue'; import noteHeader from './note_header.vue'; diff --git a/app/assets/javascripts/notes/components/diff_with_note.vue b/app/assets/javascripts/notes/components/diff_with_note.vue index b4f7ba5f960..e2b0c7fee32 100644 --- a/app/assets/javascripts/notes/components/diff_with_note.vue +++ b/app/assets/javascripts/notes/components/diff_with_note.vue @@ -9,7 +9,7 @@ import ImageDiffOverlay from '~/diffs/components/image_diff_overlay.vue'; import { getDiffMode } from '~/diffs/store/utils'; import { diffViewerModes } from '~/ide/constants'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; -import { isCollapsed } from '../../diffs/utils/diff_file'; +import { isCollapsed } from '~/diffs/utils/diff_file'; const FIRST_CHAR_REGEX = /^(\+|-| )/; diff --git a/app/assets/javascripts/notes/components/note_edited_text.vue b/app/assets/javascripts/notes/components/note_edited_text.vue index 7c052320c98..03cbdf45ddd 100644 --- a/app/assets/javascripts/notes/components/note_edited_text.vue +++ b/app/assets/javascripts/notes/components/note_edited_text.vue @@ -1,6 +1,6 @@ <script> /* eslint-disable @gitlab/vue-require-i18n-strings */ -import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue'; +import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; export default { name: 'EditedNoteText', diff --git a/app/assets/javascripts/notes/components/note_header.vue b/app/assets/javascripts/notes/components/note_header.vue index 044b1103086..11b427b9346 100644 --- a/app/assets/javascripts/notes/components/note_header.vue +++ b/app/assets/javascripts/notes/components/note_header.vue @@ -8,7 +8,7 @@ import { import { mapActions } from 'vuex'; import { __, s__ } from '~/locale'; import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; -import UserNameWithStatus from '../../sidebar/components/assignees/user_name_with_status.vue'; +import UserNameWithStatus from '~/sidebar/components/assignees/user_name_with_status.vue'; import { NOTEABLE_TYPE_MAPPING } from '../constants'; diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index dc980e7cc7e..000eb3bdff3 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -10,7 +10,7 @@ import { ignoreWhilePending } from '~/lib/utils/ignore_while_pending'; import { s__, __ } from '~/locale'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import eventHub from '../event_hub'; import noteable from '../mixins/noteable'; import resolvable from '../mixins/resolvable'; diff --git a/app/assets/javascripts/pages/admin/index.js b/app/assets/javascripts/pages/admin/index.js index f0f85b82e2b..a249864fa36 100644 --- a/app/assets/javascripts/pages/admin/index.js +++ b/app/assets/javascripts/pages/admin/index.js @@ -1,6 +1,6 @@ import initGitlabVersionCheck from '~/gitlab_version_check'; -import initAdminStatisticsPanel from '../../admin/statistics_panel/index'; -import initVueAlerts from '../../vue_alerts'; +import initAdminStatisticsPanel from '~/admin/statistics_panel/index'; +import initVueAlerts from '~/vue_alerts'; import initAdmin from './admin'; initVueAlerts(); diff --git a/app/assets/javascripts/pages/projects/index.js b/app/assets/javascripts/pages/projects/index.js index 8ec6e5e66b3..7380055cbbf 100644 --- a/app/assets/javascripts/pages/projects/index.js +++ b/app/assets/javascripts/pages/projects/index.js @@ -1,5 +1,5 @@ -import ShortcutsNavigation from '../../behaviors/shortcuts/shortcuts_navigation'; -import initTerraformNotification from '../../projects/terraform_notification'; +import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation'; +import initTerraformNotification from '~/projects/terraform_notification'; import { initSidebarTracking } from '../shared/nav/sidebar_tracking'; import Project from './project'; diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js index 0c17bf2f344..4f57e1308df 100644 --- a/app/assets/javascripts/pages/projects/project.js +++ b/app/assets/javascripts/pages/projects/project.js @@ -9,7 +9,7 @@ import axios from '~/lib/utils/axios_utils'; import { serializeForm } from '~/lib/utils/forms'; import { mergeUrlParams } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; -import projectSelect from '../../project_select'; +import projectSelect from '~/project_select'; export default class Project { constructor() { diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue index c3d121505b6..6b5874c1e5b 100644 --- a/app/assets/javascripts/repository/components/last_commit.vue +++ b/app/assets/javascripts/repository/components/last_commit.vue @@ -10,10 +10,10 @@ import { import defaultAvatarUrl from 'images/no_avatar.png'; import pathLastCommitQuery from 'shared_queries/repository/path_last_commit.query.graphql'; import { sprintf, s__ } from '~/locale'; -import CiIcon from '../../vue_shared/components/ci_icon.vue'; -import ClipboardButton from '../../vue_shared/components/clipboard_button.vue'; -import TimeagoTooltip from '../../vue_shared/components/time_ago_tooltip.vue'; -import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; +import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; +import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import getRefMixin from '../mixins/get_ref'; import projectPathQuery from '../queries/project_path.query.graphql'; diff --git a/app/assets/javascripts/serverless/components/url.vue b/app/assets/javascripts/serverless/components/url.vue index 79a1f39c7dd..b105f49e475 100644 --- a/app/assets/javascripts/serverless/components/url.vue +++ b/app/assets/javascripts/serverless/components/url.vue @@ -1,5 +1,5 @@ <script> -import ClipboardButton from '../../vue_shared/components/clipboard_button.vue'; +import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; export default { components: { diff --git a/app/assets/javascripts/sidebar/components/copy_email_to_clipboard.vue b/app/assets/javascripts/sidebar/components/copy_email_to_clipboard.vue index 0d8cb8cb2b6..8528ad56ddb 100644 --- a/app/assets/javascripts/sidebar/components/copy_email_to_clipboard.vue +++ b/app/assets/javascripts/sidebar/components/copy_email_to_clipboard.vue @@ -1,5 +1,5 @@ <script> -import CopyableField from '../../vue_shared/components/sidebar/copyable_field.vue'; +import CopyableField from '~/vue_shared/components/sidebar/copyable_field.vue'; export default { components: { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue index 2e3a02b1712..9499603163b 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue @@ -1,7 +1,7 @@ <script> import { GlButton, GlLoadingIcon } from '@gitlab/ui'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import ciIcon from '../../vue_shared/components/ci_icon.vue'; +import ciIcon from '~/vue_shared/components/ci_icon.vue'; export default { components: { diff --git a/app/assets/javascripts/vue_shared/components/awards_list.vue b/app/assets/javascripts/vue_shared/components/awards_list.vue index 2bdd2363e11..f5d8811e83c 100644 --- a/app/assets/javascripts/vue_shared/components/awards_list.vue +++ b/app/assets/javascripts/vue_shared/components/awards_list.vue @@ -4,7 +4,7 @@ import { groupBy } from 'lodash'; import EmojiPicker from '~/emoji/components/picker.vue'; import { __, sprintf } from '~/locale'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import { glEmojiTag } from '../../emoji'; +import { glEmojiTag } from '~/emoji'; // Internal constant, specific to this component, used when no `currentUserId` is given const NO_USER_ID = -1; diff --git a/app/controllers/groups/releases_controller.rb b/app/controllers/groups/releases_controller.rb index db5385ecc71..e87135cc104 100644 --- a/app/controllers/groups/releases_controller.rb +++ b/app/controllers/groups/releases_controller.rb @@ -17,8 +17,10 @@ module Groups def releases if Feature.enabled?(:group_releases_finder_inoperator) Releases::GroupReleasesFinder - .new(@group, current_user, { include_subgroups: true, page: params[:page], per: 30 }) + .new(@group, current_user) .execute(preload: false) + .page(params[:page]) + .per(30) else ReleasesFinder .new(@group, current_user, { include_subgroups: true }) diff --git a/app/finders/releases/group_releases_finder.rb b/app/finders/releases/group_releases_finder.rb index 39f44830ff5..8b1b0c552fd 100644 --- a/app/finders/releases/group_releases_finder.rb +++ b/app/finders/releases/group_releases_finder.rb @@ -15,10 +15,7 @@ module Releases @current_user = current_user @params = params - params[:order_by] ||= 'released_at' params[:sort] ||= 'desc' - params[:page] ||= 0 - params[:per] ||= 30 end def execute(preload: true) @@ -26,7 +23,7 @@ module Releases releases = get_releases releases.preloaded if preload - paginate_releases(releases) + releases end private @@ -46,9 +43,6 @@ module Releases Release.sort_by_attribute("released_at_#{params[:sort]}").order(id: params[:sort]) end - def paginate_releases(releases) - releases.page(params[:page].to_i).per(params[:per]) - end # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 79c3e3a836b..53a7dbcd094 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -139,6 +139,10 @@ module WikiHelper api_v4_projects_wikis_path(wiki_page_render_api_endpoint_params(page)) end + def wiki_markup_hash_by_name_id + Wiki::VALID_USER_MARKUPS.map { |key, value| { value[:name] => key } }.reduce({}, :merge) + end + private def wiki_page_render_api_endpoint_params(page) diff --git a/app/models/ci/namespace_mirror.rb b/app/models/ci/namespace_mirror.rb index d5cbbb96134..e8f08db597f 100644 --- a/app/models/ci/namespace_mirror.rb +++ b/app/models/ci/namespace_mirror.rb @@ -4,6 +4,8 @@ module Ci # This model represents a record in a shadow table of the main database's namespaces table. # It allows us to navigate the namespace hierarchy on the ci database without resorting to a JOIN. class NamespaceMirror < ApplicationRecord + include FromUnion + belongs_to :namespace scope :by_group_and_descendants, -> (id) do @@ -14,6 +16,24 @@ module Ci where('traversal_ids && ARRAY[?]::int[]', ids) end + scope :contains_traversal_ids, -> (traversal_ids) do + mirrors = [] + + traversal_ids.group_by(&:count).each do |columns_count, traversal_ids_group| + columns = Array.new(columns_count) { |i| "(traversal_ids[#{i + 1}])" } + pairs = traversal_ids_group.map do |ids| + ids = ids.map { |id| Arel::Nodes.build_quoted(id).to_sql } + "(#{ids.join(",")})" + end + + # Create condition in format: + # ((traversal_ids[1]),(traversal_ids[2])) IN ((1,2),(2,3)) + mirrors << Ci::NamespaceMirror.where("(#{columns.join(",")}) IN (#{pairs.join(",")})") # rubocop:disable GitlabSecurity/SqlInjection + end + + self.from_union(mirrors) + end + scope :by_namespace_id, -> (namespace_id) { where(namespace_id: namespace_id) } class << self diff --git a/app/models/ci/secure_file.rb b/app/models/ci/secure_file.rb index 18f0093ea41..1509344415d 100644 --- a/app/models/ci/secure_file.rb +++ b/app/models/ci/secure_file.rb @@ -16,6 +16,7 @@ module Ci validates :file, presence: true, file_size: { maximum: FILE_SIZE_LIMIT } validates :checksum, :file_store, :name, :permissions, :project_id, presence: true + after_initialize :generate_key_data before_validation :assign_checksum enum permissions: { read_only: 0, read_write: 1, execute: 2 } @@ -33,5 +34,11 @@ module Ci def assign_checksum self.checksum = file.checksum if file.present? && file_changed? end + + def generate_key_data + return if key_data.present? + + self.key_data = SecureRandom.hex(64) + end end end diff --git a/app/models/concerns/from_set_operator.rb b/app/models/concerns/from_set_operator.rb index c6d63631c84..ce3a83e9fa1 100644 --- a/app/models/concerns/from_set_operator.rb +++ b/app/models/concerns/from_set_operator.rb @@ -11,7 +11,12 @@ module FromSetOperator raise "Trying to redefine method '#{method(method_name)}'" if methods.include?(method_name) define_method(method_name) do |members, remove_duplicates: true, remove_order: true, alias_as: table_name| - operator_sql = operator.new(members, remove_duplicates: remove_duplicates, remove_order: remove_order).to_sql + operator_sql = + if members.any? + operator.new(members, remove_duplicates: remove_duplicates, remove_order: remove_order).to_sql + else + where("1=0").to_sql + end from(Arel.sql("(#{operator_sql}) #{alias_as}")) end diff --git a/app/models/user.rb b/app/models/user.rb index 5ebbf39be29..027ea70958c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2286,17 +2286,20 @@ class User < ApplicationRecord # to avoid querying descendants since they are already covered # by ancestor namespaces. If the FF is not available fallback to # inefficient search: https://gitlab.com/gitlab-org/gitlab/-/issues/336436 - namespace_ids = - if Feature.enabled?(:use_traversal_ids, default_enabled: :yaml) - Group.joins(:all_group_members) - .merge(search_members) - .shortest_traversal_ids_prefixes - .map(&:last) - else - search_members.pluck(:source_id) - end + unless Feature.enabled?(:use_traversal_ids, default_enabled: :yaml) + return Ci::NamespaceMirror.contains_any_of_namespaces(search_members.pluck(:source_id)) + end - Ci::NamespaceMirror.contains_any_of_namespaces(namespace_ids) + traversal_ids = Group.joins(:all_group_members) + .merge(search_members) + .shortest_traversal_ids_prefixes + + # Use efficient btree index to perform search + if Feature.enabled?(:ci_owned_runners_unnest_index, self, default_enabled: :yaml) + Ci::NamespaceMirror.contains_traversal_ids(traversal_ids) + else + Ci::NamespaceMirror.contains_any_of_namespaces(traversal_ids.map(&:last)) + end end end diff --git a/app/models/wiki.rb b/app/models/wiki.rb index cb572fb5971..b3f09b20463 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -10,18 +10,45 @@ class Wiki extend ActiveModel::Naming MARKUPS = { # rubocop:disable Style/MultilineIfModifier - 'Markdown' => :markdown, - 'RDoc' => :rdoc, - 'AsciiDoc' => :asciidoc, - 'Org' => :org + markdown: { + name: 'Markdown', + default_extension: :md, + created_by_user: true + }, + rdoc: { + name: 'RDoc', + default_extension: :rdoc, + created_by_user: true + }, + asciidoc: { + name: 'AsciiDoc', + default_extension: :asciidoc, + created_by_user: true + }, + org: { + name: 'Org', + default_extension: :org, + created_by_user: true + }, + textile: { + name: 'Textile', + default_extension: :textile + }, + creole: { + name: 'Creole', + default_extension: :creole + }, + rest: { + name: 'reStructuredText', + default_extension: :rst + }, + mediawiki: { + name: 'MediaWiki', + default_extension: :mediawiki + } }.freeze unless defined?(MARKUPS) - DEFAULT_MARKUP_EXTENSIONS = { # rubocop:disable Style/MultilineIfModifier - markdown: 'md', - rdoc: 'rdoc', - asciidoc: 'asciidoc', - org: 'org' - }.freeze unless defined?(DEFAULT_MARKUP_EXTENSIONS) + VALID_USER_MARKUPS = MARKUPS.select { |_, v| v[:created_by_user] }.freeze unless defined?(VALID_USER_MARKUPS) CouldNotCreateWikiError = Class.new(StandardError) @@ -355,13 +382,15 @@ class Wiki end def with_valid_format(format, &block) - unless Wiki::MARKUPS.value?(format.to_sym) + default_extension = Wiki::VALID_USER_MARKUPS.dig(format.to_sym, :default_extension).to_s + + if default_extension.blank? @error_message = _('Invalid format selected') return false end - yield Wiki::DEFAULT_MARKUP_EXTENSIONS[format.to_sym] + yield default_extension end def sluggified_full_path(title, extension) diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index c3ea0e14447..647b4e787c6 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -185,7 +185,7 @@ class WikiPage # :content - The raw markup content. # :format - Optional symbol representing the # content format. Can be any type - # listed in the Wiki::MARKUPS + # listed in the Wiki::VALID_USER_MARKUPS # Hash. # :message - Optional commit message to set on # the new page. @@ -205,7 +205,7 @@ class WikiPage # attrs - Hash of attributes to be updated on the page. # :content - The raw markup content to replace the existing. # :format - Optional symbol representing the content format. - # See Wiki::MARKUPS Hash for available formats. + # See Wiki::VALID_USER_MARKUPS Hash for available formats. # :message - Optional commit message to set on the new version. # :last_commit_sha - Optional last commit sha to validate the page unchanged. # :title - The Title (optionally including dir) to replace existing title diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb index 7fa21a58e44..417680e37cf 100644 --- a/app/services/event_create_service.rb +++ b/app/services/event_create_service.rb @@ -184,8 +184,9 @@ class EventCreateService track_event(event_action: :pushed, event_target: Project, author_id: current_user.id) - if Feature.enabled?(:route_hll_to_snowplow, project, default_enabled: :yaml) - Gitlab::Tracking.event(self.class.to_s, 'action_active_users_project_repo', namespace: project, user: current_user) + namespace = project.namespace + if Feature.enabled?(:route_hll_to_snowplow, namespace, default_enabled: :yaml) + Gitlab::Tracking.event(self.class.to_s, 'action_active_users_project_repo', namespace: namespace, user: current_user, project: project) end Users::LastPushEventService.new(current_user) diff --git a/app/uploaders/ci/secure_file_uploader.rb b/app/uploaders/ci/secure_file_uploader.rb index 514d88dd177..8aa624d6b30 100644 --- a/app/uploaders/ci/secure_file_uploader.rb +++ b/app/uploaders/ci/secure_file_uploader.rb @@ -10,7 +10,7 @@ module Ci encrypt(key: :key) def key - OpenSSL::HMAC.digest('SHA256', Gitlab::Application.secrets.db_key_base, model.project_id.to_s) + Digest::SHA256.digest model.key_data end def checksum diff --git a/app/views/errors/_footer.html.haml b/app/views/errors/_footer.html.haml index 62bac62c70c..3adde3ef544 100644 --- a/app/views/errors/_footer.html.haml +++ b/app/views/errors/_footer.html.haml @@ -4,8 +4,8 @@ = link_to s_('Nav|Home'), root_path %li - if current_user - = link_to s_('Nav|Sign out and sign in with a different account'), '#', id: 'sign_out_link' - %form{ action: destroy_user_session_path, method: :post, id: 'sign_out_form' } + = link_to s_('Nav|Sign out and sign in with a different account'), '#', class: 'js-sign-out-link' + %form.js-sign-out-form{ action: destroy_user_session_path, method: :post } - else = link_to s_('Nav|Sign In / Register'), new_session_path(:user, redirect_to_referer: 'yes') %li diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml index 57260ccedea..3ddd8c6780f 100644 --- a/app/views/layouts/errors.html.haml +++ b/app/views/layouts/errors.html.haml @@ -22,8 +22,8 @@ } // We do not have rails_ujs here, so we're manually making a link trigger a form submit. - document.getElementById('sign_out_link').addEventListener('click', function(e) { + document.querySelector('.js-sign-out-link')?.addEventListener('click', (e) => { e.preventDefault(); - document.getElementById('sign_out_form').submit(); + document.querySelector('.js-sign-out-form')?.submit(); }); }()); diff --git a/app/views/projects/forks/index.html.haml b/app/views/projects/forks/index.html.haml index 5330c3aa6d6..905c5779c7d 100644 --- a/app/views/projects/forks/index.html.haml +++ b/app/views/projects/forks/index.html.haml @@ -1,5 +1,7 @@ - sort_value = @sort || sort_value_recently_created -- sort_title = forks_sort_options_hash[sort_value] +- excluded_filters = [:state, :scope, :label_name, :milestone_id, :assignee_id, :author_id] +- created_at = { value: sort_value_created_date, text: sort_title_created_date, href: page_filter_path(sort: sort_value_recently_created, without: excluded_filters) } +- activity = { value: sort_value_latest_activity, text: sort_title_latest_activity, href: page_filter_path(sort: sort_value_latest_activity, without: excluded_filters) } .top-area .nav-text @@ -14,14 +16,7 @@ .dropdown.gl-display-inline.gl-md-ml-3.issue-sort-dropdown.gl-mt-3.gl-md-mt-0 .btn-group{ role: 'group' } .btn-group{ role: 'group' } - %button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'gl-button btn btn-default' } - = sort_title - = sprite_icon('chevron-down', css_class: "dropdown-menu-toggle-icon gl-top-3") - %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort - %li - - excluded_filters = [:state, :scope, :label_name, :milestone_id, :assignee_id, :author_id] - = sortable_item(sort_title_created_date, page_filter_path(sort: sort_value_recently_created, without: excluded_filters), sort_title) - = sortable_item(sort_title_latest_activity, page_filter_path(sort: sort_value_latest_activity, without: excluded_filters), sort_title) + = gl_redirect_listbox_tag [created_at, activity], @sort = forks_sort_direction_button(sort_value) - if current_user && can?(current_user, :fork_project, @project) diff --git a/app/views/shared/wikis/_form.html.haml b/app/views/shared/wikis/_form.html.haml index e121725b9af..34bedbd928a 100644 --- a/app/views/shared/wikis/_form.html.haml +++ b/app/views/shared/wikis/_form.html.haml @@ -3,4 +3,4 @@ .gl-mt-3 = form_errors(@page, truncate: :title) -#js-wiki-form{ data: { page_info: page_info.to_json, format_options: Wiki::MARKUPS.to_json } } +#js-wiki-form{ data: { page_info: page_info.to_json, format_options: wiki_markup_hash_by_name_id.to_json } } |