diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 14:02:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 14:02:45 +0000 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /app | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) | |
download | gitlab-ce-80f61b4035607d7cd87de993b8f5e996bde3481f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
203 files changed, 657 insertions, 520 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_metrics.js b/app/assets/javascripts/behaviors/markdown/render_metrics.js index 252b98610b6..8050604e6e7 100644 --- a/app/assets/javascripts/behaviors/markdown/render_metrics.js +++ b/app/assets/javascripts/behaviors/markdown/render_metrics.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import Metrics from '~/monitoring/components/embed.vue'; import { createStore } from '~/monitoring/stores'; -// TODO: Handle copy-pasting - https://gitlab.com/gitlab-org/gitlab-ce/issues/64369. +// TODO: Handle copy-pasting - https://gitlab.com/gitlab-org/gitlab-foss/issues/64369. export default function renderMetrics(elements) { if (!elements.length) { return; diff --git a/app/assets/javascripts/behaviors/preview_markdown.js b/app/assets/javascripts/behaviors/preview_markdown.js index b2571fb840c..1909830e9ed 100644 --- a/app/assets/javascripts/behaviors/preview_markdown.js +++ b/app/assets/javascripts/behaviors/preview_markdown.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, object-shorthand, prefer-arrow-callback */ +/* eslint-disable func-names, no-var, prefer-arrow-callback */ import $ from 'jquery'; import axios from '~/lib/utils/axios_utils'; @@ -82,7 +82,7 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) { }) .then(({ data }) => { this.ajaxCache = { - text: text, + text, response: data, }; success(data); diff --git a/app/assets/javascripts/blob/blob_file_dropzone.js b/app/assets/javascripts/blob/blob_file_dropzone.js index 9010cd0c3c1..9f0680cc6a7 100644 --- a/app/assets/javascripts/blob/blob_file_dropzone.js +++ b/app/assets/javascripts/blob/blob_file_dropzone.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, object-shorthand, prefer-arrow-callback */ +/* eslint-disable func-names, prefer-arrow-callback */ import $ from 'jquery'; import Dropzone from 'dropzone'; @@ -32,7 +32,7 @@ export default class BlobFileDropzone { url: form.attr('action'), // Rails uses a hidden input field for PUT // http://stackoverflow.com/questions/21056482/how-to-set-method-put-in-form-tag-in-rails - method: method, + method, clickable: true, uploadMultiple: false, paramName: 'file', @@ -42,7 +42,7 @@ export default class BlobFileDropzone { addRemoveLinks: true, previewsContainer: '.dropzone-previews', headers: csrf.headers, - init: function() { + init() { this.on('addedfile', function() { toggleLoading(submitButton, submitButtonLoadingIcon, false); dropzoneMessage.addClass(HIDDEN_CLASS); @@ -69,7 +69,7 @@ export default class BlobFileDropzone { }); }, // Override behavior of adding error underneath preview - error: function(file, errorMessage) { + error(file, errorMessage) { const stripped = $('<div/>') .html(errorMessage) .text(); diff --git a/app/assets/javascripts/boards/components/board.js b/app/assets/javascripts/boards/components/board.js index c6122fbc686..58759fd1efe 100644 --- a/app/assets/javascripts/boards/components/board.js +++ b/app/assets/javascripts/boards/components/board.js @@ -50,6 +50,9 @@ export default Vue.extend({ }; }, computed: { + isLoggedIn() { + return Boolean(gon.current_user_id); + }, counterTooltip() { const { issuesSize } = this.list; return `${n__('%d issue', '%d issues', issuesSize)}`; @@ -106,7 +109,11 @@ export default Vue.extend({ Sortable.create(this.$el.parentNode, sortableOptions); }, created() { - if (this.list.isExpandable && AccessorUtilities.isLocalStorageAccessSafe()) { + if ( + this.list.isExpandable && + AccessorUtilities.isLocalStorageAccessSafe() && + !this.isLoggedIn + ) { const isCollapsed = localStorage.getItem(`${this.uniqueKey}.expanded`) === 'false'; this.list.isExpanded = !isCollapsed; @@ -120,10 +127,14 @@ export default Vue.extend({ if (this.list.isExpandable) { this.list.isExpanded = !this.list.isExpanded; - if (AccessorUtilities.isLocalStorageAccessSafe()) { + if (AccessorUtilities.isLocalStorageAccessSafe() && !this.isLoggedIn) { localStorage.setItem(`${this.uniqueKey}.expanded`, this.list.isExpanded); } + if (this.isLoggedIn) { + this.list.update(); + } + // When expanding/collapsing, the tooltip on the caret button sometimes stays open. // Close all tooltips manually to prevent dangling tooltips. $('.tooltip').tooltip('hide'); diff --git a/app/assets/javascripts/boards/components/new_list_dropdown.js b/app/assets/javascripts/boards/components/new_list_dropdown.js index c8a9cb1c296..229bb82152b 100644 --- a/app/assets/javascripts/boards/components/new_list_dropdown.js +++ b/app/assets/javascripts/boards/components/new_list_dropdown.js @@ -1,7 +1,9 @@ -/* eslint-disable func-names, no-new, promise/catch-or-return */ +/* eslint-disable func-names, no-new */ import $ from 'jquery'; +import { __ } from '~/locale'; import axios from '~/lib/utils/axios_utils'; +import flash from '~/flash'; import CreateLabelDropdown from '../../create_label'; import boardsStore from '../stores/boards_store'; @@ -26,18 +28,23 @@ $(document) export default function initNewListDropdown() { $('.js-new-board-list').each(function() { - const $this = $(this); + const $dropdownToggle = $(this); + const $dropdown = $dropdownToggle.closest('.dropdown'); new CreateLabelDropdown( - $this.closest('.dropdown').find('.dropdown-new-label'), - $this.data('namespacePath'), - $this.data('projectPath'), + $dropdown.find('.dropdown-new-label'), + $dropdownToggle.data('namespacePath'), + $dropdownToggle.data('projectPath'), ); - $this.glDropdown({ + $dropdownToggle.glDropdown({ data(term, callback) { - axios.get($this.attr('data-list-labels-path')).then(({ data }) => { - callback(data); - }); + axios + .get($dropdownToggle.attr('data-list-labels-path')) + .then(({ data }) => callback(data)) + .catch(() => { + $dropdownToggle.data('bs.dropdown').hide(); + flash(__('Error fetching labels.')); + }); }, renderRow(label) { const active = boardsStore.findListByLabelId(label.id); diff --git a/app/assets/javascripts/boards/models/issue.js b/app/assets/javascripts/boards/models/issue.js index 086340105b7..1cee9e5725a 100644 --- a/app/assets/javascripts/boards/models/issue.js +++ b/app/assets/javascripts/boards/models/issue.js @@ -11,11 +11,6 @@ import boardsStore from '../stores/boards_store'; class ListIssue { constructor(obj, defaultAvatar) { - this.id = obj.id; - this.iid = obj.iid; - this.title = obj.title; - this.confidential = obj.confidential; - this.dueDate = obj.due_date; this.subscribed = obj.subscribed; this.labels = []; this.assignees = []; @@ -25,6 +20,16 @@ class ListIssue { subscriptions: true, }; this.isLoading = {}; + + this.refreshData(obj, defaultAvatar); + } + + refreshData(obj, defaultAvatar) { + this.id = obj.id; + this.iid = obj.iid; + this.title = obj.title; + this.confidential = obj.confidential; + this.dueDate = obj.due_date; this.sidebarInfoEndpoint = obj.issue_sidebar_endpoint; this.referencePath = obj.reference_path; this.path = obj.real_path; @@ -42,11 +47,13 @@ class ListIssue { this.milestone_id = obj.milestone.id; } - obj.labels.forEach(label => { - this.labels.push(new ListLabel(label)); - }); + if (obj.labels) { + this.labels = obj.labels.map(label => new ListLabel(label)); + } - this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); + if (obj.assignees) { + this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); + } } addLabel(label) { diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index 1edaf971afd..b3e56a34c28 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -1,4 +1,4 @@ -/* eslint-disable no-underscore-dangle, class-methods-use-this, consistent-return, no-shadow, no-param-reassign */ +/* eslint-disable no-underscore-dangle, class-methods-use-this, consistent-return, no-shadow */ import { __ } from '~/locale'; import ListLabel from './label'; @@ -45,7 +45,7 @@ class List { const typeInfo = this.getTypeInfo(this.type); this.preset = Boolean(typeInfo.isPreset); this.isExpandable = Boolean(typeInfo.isExpandable); - this.isExpanded = true; + this.isExpanded = !obj.collapsed; this.page = 1; this.loading = true; this.loadingMore = false; @@ -113,7 +113,8 @@ class List { } update() { - gl.boardService.updateList(this.id, this.position).catch(() => { + const collapsed = !this.isExpanded; + return gl.boardService.updateList(this.id, this.position, collapsed).catch(() => { // TODO: handle request error }); } @@ -259,12 +260,7 @@ class List { } onNewIssueResponse(issue, data) { - issue.id = data.id; - issue.iid = data.iid; - issue.project = data.project; - issue.path = data.real_path; - issue.referencePath = data.reference_path; - issue.assignableLabelsEndpoint = data.assignable_labels_endpoint; + issue.refreshData(data); if (this.issuesSize > 1) { const moveBeforeId = this.issues[1].id; diff --git a/app/assets/javascripts/boards/services/board_service.js b/app/assets/javascripts/boards/services/board_service.js index 56a6cab6c73..0d11db89511 100644 --- a/app/assets/javascripts/boards/services/board_service.js +++ b/app/assets/javascripts/boards/services/board_service.js @@ -2,7 +2,7 @@ /** * This file is intended to be deleted. * The existing functions will removed one by one in favor of using the board store directly. - * see https://gitlab.com/gitlab-org/gitlab-ce/issues/61621 + * see https://gitlab.com/gitlab-org/gitlab-foss/issues/61621 */ import boardsStore from '~/boards/stores/boards_store'; @@ -32,8 +32,8 @@ export default class BoardService { return boardsStore.createList(entityId, entityType); } - updateList(id, position) { - return boardsStore.updateList(id, position); + updateList(id, position, collapsed) { + return boardsStore.updateList(id, position, collapsed); } destroyList(id) { diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index f57c684691c..6da1cca9628 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -82,7 +82,7 @@ const boardsStore = { this.state.lists = _.sortBy(this.state.lists, 'position'); }) .catch(() => { - // https://gitlab.com/gitlab-org/gitlab-ce/issues/30821 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/30821 }); this.removeBlankState(); }, @@ -278,10 +278,11 @@ const boardsStore = { }); }, - updateList(id, position) { + updateList(id, position, collapsed) { return axios.put(`${this.state.endpoints.listsEndpoint}/${id}`, { list: { position, + collapsed, }, }); }, diff --git a/app/assets/javascripts/boards/stores/boards_store_ee.js b/app/assets/javascripts/boards/stores/boards_store_ee.js index 09e3a938fbe..2a289ce5d0a 100644 --- a/app/assets/javascripts/boards/stores/boards_store_ee.js +++ b/app/assets/javascripts/boards/stores/boards_store_ee.js @@ -1,4 +1,4 @@ -// this is just to make ee_else_ce happy and will be cleaned up in https://gitlab.com/gitlab-org/gitlab-ce/issues/59807 +// this is just to make ee_else_ce happy and will be cleaned up in https://gitlab.com/gitlab-org/gitlab-foss/issues/59807 export default { initEESpecific() {}, diff --git a/app/assets/javascripts/ci_variable_list/ci_variable_list.js b/app/assets/javascripts/ci_variable_list/ci_variable_list.js index 0303e4e51dd..5c79f245f6d 100644 --- a/app/assets/javascripts/ci_variable_list/ci_variable_list.js +++ b/app/assets/javascripts/ci_variable_list/ci_variable_list.js @@ -54,7 +54,7 @@ export default class VariableList { environment_scope: { // We can't use a `.js-` class here because // gl_dropdown replaces the <input> and doesn't copy over the class - // See https://gitlab.com/gitlab-org/gitlab-ce/issues/42458 + // See https://gitlab.com/gitlab-org/gitlab-foss/issues/42458 selector: `input[name="${this.formField}[variables_attributes][][environment_scope]"]`, default: '*', }, diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 28850710f80..d386960f3b6 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -111,15 +111,25 @@ export default class Clusters { this.initApplications(clusterType); this.initEnvironments(); - if (clusterEnvironmentsPath) { - this.fetchEnvironments(); + if (clusterEnvironmentsPath && this.environments) { + this.store.toggleFetchEnvironments(true); + + this.initPolling( + 'fetchClusterEnvironments', + data => this.handleClusterEnvironmentsSuccess(data), + () => this.handleEnvironmentsPollError(), + ); } this.updateContainer(null, this.store.state.status, this.store.state.statusReason); this.addListeners(); if (statusPath && !this.environments) { - this.initPolling(); + this.initPolling( + 'fetchClusterStatus', + data => this.handleClusterStatusSuccess(data), + () => this.handlePollError(), + ); } } @@ -179,16 +189,9 @@ export default class Clusters { }); } - fetchEnvironments() { - this.store.toggleFetchEnvironments(true); - - this.service - .fetchClusterEnvironments() - .then(data => { - this.store.toggleFetchEnvironments(false); - this.store.updateEnvironments(data.data); - }) - .catch(() => Clusters.handleError()); + handleClusterEnvironmentsSuccess(data) { + this.store.toggleFetchEnvironments(false); + this.store.updateEnvironments(data.data); } static initDismissableCallout() { @@ -224,21 +227,16 @@ export default class Clusters { eventHub.$off('uninstallApplication'); } - initPolling() { + initPolling(method, successCallback, errorCallback) { this.poll = new Poll({ resource: this.service, - method: 'fetchData', - successCallback: data => this.handleSuccess(data), - errorCallback: () => Clusters.handleError(), + method, + successCallback, + errorCallback, }); if (!Visibility.hidden()) { this.poll.makeRequest(); - } else { - this.service - .fetchData() - .then(data => this.handleSuccess(data)) - .catch(() => Clusters.handleError()); } Visibility.change(() => { @@ -250,11 +248,21 @@ export default class Clusters { }); } + handlePollError() { + this.constructor.handleError(); + } + + handleEnvironmentsPollError() { + this.store.toggleFetchEnvironments(false); + + this.handlePollError(); + } + static handleError() { Flash(s__('ClusterIntegration|Something went wrong on our end.')); } - handleSuccess(data) { + handleClusterStatusSuccess(data) { const prevStatus = this.store.state.status; const prevApplicationMap = Object.assign({}, this.store.state.applications); diff --git a/app/assets/javascripts/clusters/services/clusters_service.js b/app/assets/javascripts/clusters/services/clusters_service.js index 9139e0beafb..fa12802b3de 100644 --- a/app/assets/javascripts/clusters/services/clusters_service.js +++ b/app/assets/javascripts/clusters/services/clusters_service.js @@ -17,7 +17,7 @@ export default class ClusterService { }; } - fetchData() { + fetchClusterStatus() { return axios.get(this.options.endpoint); } diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index a032f589ee4..5cddb4cc098 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -218,6 +218,7 @@ export default class ClusterStore { environmentPath: environment.environment_path, lastDeployment: environment.last_deployment, rolloutStatus: { + status: environment.rollout_status ? environment.rollout_status.status : null, instances: environment.rollout_status ? environment.rollout_status.instances : [], }, updatedAt: environment.updated_at, diff --git a/app/assets/javascripts/compare_autocomplete.js b/app/assets/javascripts/compare_autocomplete.js index 5bfe158ceda..81ba15577fb 100644 --- a/app/assets/javascripts/compare_autocomplete.js +++ b/app/assets/javascripts/compare_autocomplete.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, one-var, no-var, object-shorthand, no-else-return */ +/* eslint-disable func-names, one-var, no-var, no-else-return */ import $ from 'jquery'; import { __ } from './locale'; @@ -15,7 +15,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( const $fieldInput = $(`input[name="${$dropdown.data('fieldName')}"]`, $dropdownContainer); const $filterInput = $('input[type="search"]', $dropdownContainer); $dropdown.glDropdown({ - data: function(term, callback) { + data(term, callback) { const params = { ref: $dropdown.data('ref'), search: term, @@ -43,7 +43,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( filterRemote: Boolean($dropdown.data('refsUrl')), fieldName: $dropdown.data('fieldName'), filterInput: 'input[type="search"]', - renderRow: function(ref) { + renderRow(ref) { var link; if (ref.header != null) { return $('<li />') @@ -58,10 +58,10 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( return $('<li />').append(link); } }, - id: function(obj, $el) { + id(obj, $el) { return $el.attr('data-ref'); }, - toggleLabel: function(obj, $el) { + toggleLabel(obj, $el) { return $el.text().trim(); }, clicked: () => clickHandler($dropdown), diff --git a/app/assets/javascripts/contextual_sidebar.js b/app/assets/javascripts/contextual_sidebar.js index 9263e9b27e4..f43b6f3d777 100644 --- a/app/assets/javascripts/contextual_sidebar.js +++ b/app/assets/javascripts/contextual_sidebar.js @@ -5,7 +5,7 @@ import bp from './breakpoints'; import { parseBoolean } from '~/lib/utils/common_utils'; // NOTE: at 1200px nav sidebar should not overlap the content -// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24555#note_134136110 +// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/24555#note_134136110 const NAV_SIDEBAR_BREAKPOINT = 1200; export const SIDEBAR_COLLAPSED_CLASS = 'js-sidebar-collapsed'; diff --git a/app/assets/javascripts/cycle_analytics/components/stage_code_component.vue b/app/assets/javascripts/cycle_analytics/components/stage_code_component.vue index 333ea111cd6..55e5f4ffad2 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_code_component.vue +++ b/app/assets/javascripts/cycle_analytics/components/stage_code_component.vue @@ -32,7 +32,7 @@ export default { <div class="item-details"> <!-- FIXME: Pass an alt attribute here for accessibility --> <user-avatar-image :img-src="mergeRequest.author.avatarUrl" /> - <h5 class="item-title merge-merquest-title"> + <h5 class="item-title merge-request-title"> <a :href="mergeRequest.url"> {{ mergeRequest.title }} </a> </h5> <a :href="mergeRequest.url" class="issue-link"> !{{ mergeRequest.iid }} </a> · diff --git a/app/assets/javascripts/cycle_analytics/components/stage_review_component.vue b/app/assets/javascripts/cycle_analytics/components/stage_review_component.vue index f874f11aff0..a295c8b496b 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_review_component.vue +++ b/app/assets/javascripts/cycle_analytics/components/stage_review_component.vue @@ -34,7 +34,7 @@ export default { <div class="item-details"> <!-- FIXME: Pass an alt attribute here for accessibility --> <user-avatar-image :img-src="mergeRequest.author.avatarUrl" /> - <h5 class="item-title merge-merquest-title"> + <h5 class="item-title merge-request-title"> <a :href="mergeRequest.url"> {{ mergeRequest.title }} </a> </h5> <a :href="mergeRequest.url" class="issue-link">!{{ mergeRequest.iid }}</a> · diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js index c9a6b10b2f3..7744984edfc 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js @@ -74,7 +74,7 @@ export default () => { // after a group is selected the cycle analyitcs data will be fetched). Once the // old (current) page has been removed this entire created method as well as the // variable itself can be completely removed. - // Follow up issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/64490 + // Follow up issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/64490 if (cycleAnalyticsEl.dataset.requestPath) this.fetchCycleAnalyticsData(); }, methods: { diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js index 245f1a7c558..a343138a9e1 100644 --- a/app/assets/javascripts/diff.js +++ b/app/assets/javascripts/diff.js @@ -5,7 +5,7 @@ import { __ } from '~/locale'; import { getLocationHash } from './lib/utils/url_utility'; import FilesCommentButton from './files_comment_button'; import SingleFileDiff from './single_file_diff'; -import imageDiffHelper from './image_diff/helpers/index'; +import initImageDiffHelper from './image_diff/helpers/init_image_diff'; const UNFOLD_COUNT = 20; let isBound = false; @@ -28,7 +28,7 @@ export default class Diff { .first() .get(0); const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note'); - $diffFile.each((index, file) => imageDiffHelper.initImageDiff(file, canCreateNote)); + $diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote)); if (!isBound) { $(document) diff --git a/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js b/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js index 7817b41514d..84e07598fed 100644 --- a/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js +++ b/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js @@ -1,4 +1,4 @@ -/* eslint-disable object-shorthand, func-names, no-else-return, no-lonely-if */ +/* eslint-disable no-else-return, no-lonely-if */ /* global CommentsStore */ import $ from 'jquery'; @@ -19,17 +19,17 @@ const CommentAndResolveBtn = Vue.extend({ }; }, computed: { - showButton: function() { + showButton() { if (this.discussion) { return this.discussion.isResolvable(); } else { return false; } }, - isDiscussionResolved: function() { + isDiscussionResolved() { return this.discussion.isResolved(); }, - buttonText: function() { + buttonText() { if (this.isDiscussionResolved) { if (this.textareaIsEmpty) { return __('Unresolve thread'); @@ -50,7 +50,7 @@ const CommentAndResolveBtn = Vue.extend({ this.discussion = CommentsStore.state[this.discussionId]; } }, - mounted: function() { + mounted() { if (!this.discussionId) return; const $textarea = $( @@ -62,7 +62,7 @@ const CommentAndResolveBtn = Vue.extend({ this.textareaIsEmpty = $textarea.val() === ''; }); }, - destroyed: function() { + destroyed() { if (!this.discussionId) return; $(`.js-discussion-note-form[data-discussion-id=${this.discussionId}] .note-textarea`).off( diff --git a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js index fe4088cadda..092c69a01d3 100644 --- a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js +++ b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js @@ -1,4 +1,4 @@ -/* eslint-disable object-shorthand, func-names, no-else-return, guard-for-in, no-restricted-syntax, no-lonely-if, no-continue */ +/* eslint-disable func-names, no-else-return, guard-for-in, no-restricted-syntax, no-lonely-if, no-continue */ /* global CommentsStore */ import $ from 'jquery'; @@ -15,24 +15,24 @@ const JumpToDiscussion = Vue.extend({ required: true, }, }, - data: function() { + data() { return { discussions: CommentsStore.state, discussion: {}, }; }, computed: { - buttonText: function() { + buttonText() { if (this.discussionId) { return __('Jump to next unresolved discussion'); } else { return __('Jump to first unresolved discussion'); } }, - allResolved: function() { + allResolved() { return this.unresolvedDiscussionCount === 0; }, - showButton: function() { + showButton() { if (this.discussionId) { if (this.unresolvedDiscussionCount > 1) { return true; @@ -43,7 +43,7 @@ const JumpToDiscussion = Vue.extend({ return this.unresolvedDiscussionCount >= 1; } }, - lastResolvedId: function() { + lastResolvedId() { let lastId; for (const discussionId in this.discussions) { const discussion = this.discussions[discussionId]; @@ -59,7 +59,7 @@ const JumpToDiscussion = Vue.extend({ this.discussion = this.discussions[this.discussionId]; }, methods: { - jumpToNextUnresolvedDiscussion: function() { + jumpToNextUnresolvedDiscussion() { let discussionsSelector; let discussionIdsInScope; let firstUnresolvedDiscussionId; diff --git a/app/assets/javascripts/diff_notes/components/resolve_count.js b/app/assets/javascripts/diff_notes/components/resolve_count.js index d8b056096f4..f960853b25b 100644 --- a/app/assets/javascripts/diff_notes/components/resolve_count.js +++ b/app/assets/javascripts/diff_notes/components/resolve_count.js @@ -1,4 +1,3 @@ -/* eslint-disable object-shorthand, func-names */ /* global CommentsStore */ import Vue from 'vue'; @@ -13,13 +12,13 @@ window.ResolveCount = Vue.extend({ required: true, }, }, - data: function() { + data() { return { discussions: CommentsStore.state, }; }, computed: { - allResolved: function() { + allResolved() { return this.resolvedDiscussionCount === this.discussionCount; }, resolvedCountText() { diff --git a/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js b/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js index 4b204fdfeb0..5f2a17da630 100644 --- a/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js +++ b/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js @@ -1,4 +1,4 @@ -/* eslint-disable object-shorthand, func-names, no-else-return */ +/* eslint-disable no-else-return */ /* global CommentsStore */ /* global ResolveService */ @@ -20,34 +20,34 @@ const ResolveDiscussionBtn = Vue.extend({ required: true, }, }, - data: function() { + data() { return { discussion: {}, }; }, computed: { - showButton: function() { + showButton() { if (this.discussion) { return this.discussion.isResolvable(); } else { return false; } }, - isDiscussionResolved: function() { + isDiscussionResolved() { if (this.discussion) { return this.discussion.isResolved(); } else { return false; } }, - buttonText: function() { + buttonText() { if (this.isDiscussionResolved) { return __('Unresolve discussion'); } else { return __('Resolve discussion'); } }, - loading: function() { + loading() { if (this.discussion) { return this.discussion.loading; } else { @@ -55,13 +55,13 @@ const ResolveDiscussionBtn = Vue.extend({ } }, }, - created: function() { + created() { CommentsStore.createDiscussion(this.discussionId, this.canResolve); this.discussion = CommentsStore.state[this.discussionId]; }, methods: { - resolve: function() { + resolve() { ResolveService.toggleResolveForDiscussion(this.mergeRequestId, this.discussionId); }, }, diff --git a/app/assets/javascripts/diff_notes/mixins/discussion.js b/app/assets/javascripts/diff_notes/mixins/discussion.js index dea64dca132..ef3001393cf 100644 --- a/app/assets/javascripts/diff_notes/mixins/discussion.js +++ b/app/assets/javascripts/diff_notes/mixins/discussion.js @@ -1,11 +1,11 @@ -/* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, */ +/* eslint-disable guard-for-in, no-restricted-syntax, */ const DiscussionMixins = { computed: { - discussionCount: function() { + discussionCount() { return Object.keys(this.discussions).length; }, - resolvedDiscussionCount: function() { + resolvedDiscussionCount() { let resolvedCount = 0; for (const discussionId in this.discussions) { @@ -18,7 +18,7 @@ const DiscussionMixins = { return resolvedCount; }, - unresolvedDiscussionCount: function() { + unresolvedDiscussionCount() { let unresolvedCount = 0; for (const discussionId in this.discussions) { diff --git a/app/assets/javascripts/diff_notes/stores/comments.js b/app/assets/javascripts/diff_notes/stores/comments.js index 060bb044f78..69a972f644d 100644 --- a/app/assets/javascripts/diff_notes/stores/comments.js +++ b/app/assets/javascripts/diff_notes/stores/comments.js @@ -1,14 +1,14 @@ -/* eslint-disable object-shorthand, func-names, camelcase, no-restricted-syntax, guard-for-in */ +/* eslint-disable camelcase, no-restricted-syntax, guard-for-in */ /* global DiscussionModel */ import Vue from 'vue'; window.CommentsStore = { state: {}, - get: function(discussionId, noteId) { + get(discussionId, noteId) { return this.state[discussionId].getNote(noteId); }, - createDiscussion: function(discussionId, canResolve) { + createDiscussion(discussionId, canResolve) { let discussion = this.state[discussionId]; if (!this.state[discussionId]) { discussion = new DiscussionModel(discussionId); @@ -21,18 +21,18 @@ window.CommentsStore = { return discussion; }, - create: function(noteObj) { + create(noteObj) { const discussion = this.createDiscussion(noteObj.discussionId); discussion.createNote(noteObj); }, - update: function(discussionId, noteId, resolved, resolved_by) { + update(discussionId, noteId, resolved, resolved_by) { const discussion = this.state[discussionId]; const note = discussion.getNote(noteId); note.resolved = resolved; note.resolved_by = resolved_by; }, - delete: function(discussionId, noteId) { + delete(discussionId, noteId) { const discussion = this.state[discussionId]; discussion.deleteNote(noteId); @@ -40,7 +40,7 @@ window.CommentsStore = { Vue.delete(this.state, discussionId); } }, - unresolvedDiscussionIds: function() { + unresolvedDiscussionIds() { const ids = []; for (const discussionId in this.state) { diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue index c82b4a7abc6..761fd1583ed 100644 --- a/app/assets/javascripts/diffs/components/commit_item.vue +++ b/app/assets/javascripts/diffs/components/commit_item.vue @@ -17,7 +17,7 @@ import initUserPopovers from '../../user_popovers'; * * This Component was cloned from a HAML view. For the time being they * coexist, but there is an issue to remove the duplication. - * https://gitlab.com/gitlab-org/gitlab-ce/issues/51613 + * https://gitlab.com/gitlab-org/gitlab-foss/issues/51613 * */ export default { diff --git a/app/assets/javascripts/diffs/components/commit_widget.vue b/app/assets/javascripts/diffs/components/commit_widget.vue index d45f91c7023..31ed003cc0f 100644 --- a/app/assets/javascripts/diffs/components/commit_widget.vue +++ b/app/assets/javascripts/diffs/components/commit_widget.vue @@ -11,7 +11,7 @@ import CommitItem from './commit_item.vue'; * * This Component was cloned from a HAML view. For the time being, * they coexist, but there is an issue to remove the duplication. - * https://gitlab.com/gitlab-org/gitlab-ce/issues/51613 + * https://gitlab.com/gitlab-org/gitlab-foss/issues/51613 * */ export default { diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue index d59b1136677..9a1e59ec045 100644 --- a/app/assets/javascripts/diffs/components/diff_content.vue +++ b/app/assets/javascripts/diffs/components/diff_content.vue @@ -45,7 +45,6 @@ export default { computed: { ...mapState({ projectPath: state => state.diffs.projectPath, - endpoint: state => state.diffs.endpoint, }), ...mapGetters('diffs', ['isInlineView', 'isParallelView']), ...mapGetters('diffs', ['getCommentFormForDiffFile']), diff --git a/app/assets/javascripts/environments/components/environment_actions.vue b/app/assets/javascripts/environments/components/environment_actions.vue index 21244c14977..22bba21526c 100644 --- a/app/assets/javascripts/environments/components/environment_actions.vue +++ b/app/assets/javascripts/environments/components/environment_actions.vue @@ -40,7 +40,7 @@ export default { ), { jobName: action.name }, ); - // https://gitlab.com/gitlab-org/gitlab-ce/issues/52156 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/52156 // eslint-disable-next-line no-alert if (!window.confirm(confirmationMessage)) { return; diff --git a/app/assets/javascripts/environments/components/environment_item.vue b/app/assets/javascripts/environments/components/environment_item.vue index 1d4a6e64f9d..c94039326aa 100644 --- a/app/assets/javascripts/environments/components/environment_item.vue +++ b/app/assets/javascripts/environments/components/environment_item.vue @@ -278,7 +278,7 @@ export default { */ isLastDeployment() { // name: 'last?' is a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26#possible-false-positives - // Vue i18n ESLint rules issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/63560 + // Vue i18n ESLint rules issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/63560 // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings return this.model && this.model.last_deployment && this.model.last_deployment['last?']; }, diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js index d1f52b91d9e..fd335362e5b 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js @@ -474,7 +474,7 @@ export default class FilteredSearchManager { } }) .catch(() => { - // https://gitlab.com/gitlab-org/gitlab-ce/issues/30821 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/30821 }); } diff --git a/app/assets/javascripts/image_diff/helpers/badge_helper.js b/app/assets/javascripts/image_diff/helpers/badge_helper.js index 000157efad0..7921650e8a0 100644 --- a/app/assets/javascripts/image_diff/helpers/badge_helper.js +++ b/app/assets/javascripts/image_diff/helpers/badge_helper.js @@ -1,3 +1,5 @@ +import { spriteIcon } from '~/lib/utils/common_utils'; + export function createImageBadge(noteId, { x, y }, classNames = []) { const buttonEl = document.createElement('button'); const classList = classNames.concat(['js-image-badge']); @@ -20,7 +22,7 @@ export function addImageBadge(containerEl, { coordinate, badgeText, noteId }) { export function addImageCommentBadge(containerEl, { coordinate, noteId }) { const buttonEl = createImageBadge(noteId, coordinate, ['image-comment-badge']); - buttonEl.innerHTML = gl.utils.spriteIcon('image-comment-dark'); + buttonEl.innerHTML = spriteIcon('image-comment-dark'); containerEl.appendChild(buttonEl); } diff --git a/app/assets/javascripts/image_diff/helpers/comment_indicator_helper.js b/app/assets/javascripts/image_diff/helpers/comment_indicator_helper.js index 7051a968dac..df3d90cff68 100644 --- a/app/assets/javascripts/image_diff/helpers/comment_indicator_helper.js +++ b/app/assets/javascripts/image_diff/helpers/comment_indicator_helper.js @@ -1,3 +1,5 @@ +import { spriteIcon } from '~/lib/utils/common_utils'; + export function addCommentIndicator(containerEl, { x, y }) { const buttonEl = document.createElement('button'); buttonEl.classList.add('btn-transparent'); @@ -6,7 +8,7 @@ export function addCommentIndicator(containerEl, { x, y }) { buttonEl.style.left = `${x}px`; buttonEl.style.top = `${y}px`; - buttonEl.innerHTML = gl.utils.spriteIcon('image-comment-dark'); + buttonEl.innerHTML = spriteIcon('image-comment-dark'); containerEl.appendChild(buttonEl); } diff --git a/app/assets/javascripts/image_diff/helpers/index.js b/app/assets/javascripts/image_diff/helpers/index.js index 4a100631003..feeb0e8fa16 100644 --- a/app/assets/javascripts/image_diff/helpers/index.js +++ b/app/assets/javascripts/image_diff/helpers/index.js @@ -21,5 +21,4 @@ export default { resizeCoordinatesToImageElement: utilsHelper.resizeCoordinatesToImageElement, generateBadgeFromDiscussionDOM: utilsHelper.generateBadgeFromDiscussionDOM, getTargetSelection: utilsHelper.getTargetSelection, - initImageDiff: utilsHelper.initImageDiff, }; diff --git a/app/assets/javascripts/image_diff/helpers/init_image_diff.js b/app/assets/javascripts/image_diff/helpers/init_image_diff.js new file mode 100644 index 00000000000..8eef930c372 --- /dev/null +++ b/app/assets/javascripts/image_diff/helpers/init_image_diff.js @@ -0,0 +1,27 @@ +import ImageDiff from '../image_diff'; +import ReplacedImageDiff from '../replaced_image_diff'; +import ImageFile from '../../commit/image_file'; + +function initImageDiff(fileEl, canCreateNote, renderCommentBadge) { + const options = { + canCreateNote, + renderCommentBadge, + }; + let diff; + + // ImageFile needs to be invoked before initImageDiff so that badges + // can mount to the correct location + new ImageFile(fileEl); // eslint-disable-line no-new + + if (fileEl.querySelector('.diff-file .js-single-image')) { + diff = new ImageDiff(fileEl, options); + diff.init(); + } else if (fileEl.querySelector('.diff-file .js-replaced-image')) { + diff = new ReplacedImageDiff(fileEl, options); + diff.init(); + } + + return diff; +} + +export default { initImageDiff }; diff --git a/app/assets/javascripts/image_diff/helpers/utils_helper.js b/app/assets/javascripts/image_diff/helpers/utils_helper.js index beec99e6934..4b383b42dff 100644 --- a/app/assets/javascripts/image_diff/helpers/utils_helper.js +++ b/app/assets/javascripts/image_diff/helpers/utils_helper.js @@ -1,7 +1,4 @@ import ImageBadge from '../image_badge'; -import ImageDiff from '../image_diff'; -import ReplacedImageDiff from '../replaced_image_diff'; -import ImageFile from '../../commit/image_file'; export function resizeCoordinatesToImageElement(imageEl, meta) { const { x, y, width, height } = meta; @@ -70,25 +67,3 @@ export function getTargetSelection(event) { }, }; } - -export function initImageDiff(fileEl, canCreateNote, renderCommentBadge) { - const options = { - canCreateNote, - renderCommentBadge, - }; - let diff; - - // ImageFile needs to be invoked before initImageDiff so that badges - // can mount to the correct location - new ImageFile(fileEl); // eslint-disable-line no-new - - if (fileEl.querySelector('.diff-file .js-single-image')) { - diff = new ImageDiff(fileEl, options); - diff.init(); - } else if (fileEl.querySelector('.diff-file .js-replaced-image')) { - diff = new ReplacedImageDiff(fileEl, options); - diff.init(); - } - - return diff; -} diff --git a/app/assets/javascripts/image_diff/init_discussion_tab.js b/app/assets/javascripts/image_diff/init_discussion_tab.js index dbe4c06a4e9..54ff2858206 100644 --- a/app/assets/javascripts/image_diff/init_discussion_tab.js +++ b/app/assets/javascripts/image_diff/init_discussion_tab.js @@ -1,4 +1,4 @@ -import imageDiffHelper from './helpers/index'; +import initImageDiffHelper from './helpers/init_image_diff'; export default () => { // Always pass can-create-note as false because a user @@ -8,6 +8,6 @@ export default () => { const diffFileEls = document.querySelectorAll('.timeline-content .diff-file.js-image-file'); [...diffFileEls].forEach(diffFileEl => - imageDiffHelper.initImageDiff(diffFileEl, canCreateNote, renderCommentBadge), + initImageDiffHelper.initImageDiff(diffFileEl, canCreateNote, renderCommentBadge), ); }; diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index 88975c2cc73..b8b3a4f44fd 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -102,10 +102,10 @@ export default { required: false, default: '', }, - issuableTemplates: { - type: Array, + issuableTemplateNamesPath: { + type: String, required: false, - default: () => [], + default: '', }, markdownPreviewPath: { type: String, @@ -156,9 +156,13 @@ export default { store, state: store.state, showForm: false, + templatesRequested: false, }; }, computed: { + issuableTemplates() { + return this.store.formState.issuableTemplates; + }, formState() { return this.store.formState; }, @@ -233,6 +237,7 @@ export default { } return undefined; }, + updateStoreState() { return this.service .getData() @@ -245,7 +250,7 @@ export default { }); }, - openForm() { + updateAndShowForm(templates = []) { if (!this.showForm) { this.showForm = true; this.store.setFormState({ @@ -254,9 +259,32 @@ export default { lock_version: this.state.lock_version, lockedWarningVisible: false, updateLoading: false, + issuableTemplates: templates, + }); + } + }, + + requestTemplatesAndShowForm() { + return this.service + .loadTemplates(this.issuableTemplateNamesPath) + .then(res => { + this.updateAndShowForm(res.data); + }) + .catch(() => { + createFlash(this.defaultErrorMessage); + this.updateAndShowForm(); }); + }, + + openForm() { + if (!this.templatesRequested) { + this.templatesRequested = true; + this.requestTemplatesAndShowForm(); + } else { + this.updateAndShowForm(this.issuableTemplates); } }, + closeForm() { this.showForm = false; }, diff --git a/app/assets/javascripts/issue_show/services/index.js b/app/assets/javascripts/issue_show/services/index.js index 3c8334bee50..b1deeaae0fc 100644 --- a/app/assets/javascripts/issue_show/services/index.js +++ b/app/assets/javascripts/issue_show/services/index.js @@ -17,4 +17,13 @@ export default class Service { updateIssuable(data) { return axios.put(this.endpoint, data); } + + // eslint-disable-next-line class-methods-use-this + loadTemplates(templateNamesEndpoint) { + if (!templateNamesEndpoint) { + return Promise.resolve([]); + } + + return axios.get(templateNamesEndpoint); + } } diff --git a/app/assets/javascripts/issue_show/stores/index.js b/app/assets/javascripts/issue_show/stores/index.js index 3c17e73ccec..d32747b5053 100644 --- a/app/assets/javascripts/issue_show/stores/index.js +++ b/app/assets/javascripts/issue_show/stores/index.js @@ -9,6 +9,7 @@ export default class Store { lockedWarningVisible: false, updateLoading: false, lock_version: 0, + issuableTemplates: [], }; } diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index 8cc3bc8373f..b028e9564c9 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -1,4 +1,4 @@ -/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, object-shorthand, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */ +/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */ /* global Issuable */ /* global ListLabel */ @@ -197,8 +197,8 @@ export default class LabelsSelect { .catch(() => flash(__('Error saving label update.'))); }; $dropdown.glDropdown({ - showMenuAbove: showMenuAbove, - data: function(term, callback) { + showMenuAbove, + data(term, callback) { labelUrl = $dropdown.attr('data-labels'); axios .get(labelUrl) @@ -231,7 +231,7 @@ export default class LabelsSelect { }) .catch(() => flash(__('Error fetching labels.'))); }, - renderRow: function(label) { + renderRow(label) { var linkEl, listItemEl, colorEl, @@ -316,7 +316,7 @@ export default class LabelsSelect { selectable: true, filterable: true, selected: $dropdown.data('selected') || [], - toggleLabel: function(selected, el) { + toggleLabel(selected, el) { var $dropdownParent = $dropdown.parent(); var $dropdownInputField = $dropdownParent.find('.dropdown-input-field'); var isSelected = el !== null ? el.hasClass('is-active') : false; @@ -350,7 +350,7 @@ export default class LabelsSelect { } }, fieldName: $dropdown.data('fieldName'), - id: function(label) { + id(label) { if (label.id <= 0) return label.title; if ($dropdown.hasClass('js-issuable-form-dropdown')) { @@ -363,7 +363,7 @@ export default class LabelsSelect { return label.id; } }, - hidden: function() { + hidden() { var isIssueIndex, isMRIndex, page; page = $('body').attr('data-page'); isIssueIndex = page === 'projects:issues:index'; @@ -394,7 +394,7 @@ export default class LabelsSelect { }, multiSelect: $dropdown.hasClass('js-multiselect'), vue: $dropdown.hasClass('js-issue-board-sidebar'), - clicked: function(clickEvent) { + clicked(clickEvent) { const { $el, e, isMarking } = clickEvent; const label = clickEvent.selectedObj; @@ -478,7 +478,7 @@ export default class LabelsSelect { } } }, - opened: function() { + opened() { if ($dropdown.hasClass('js-issue-board-sidebar')) { const previousSelection = $dropdown.attr('data-selected'); this.selected = previousSelection ? previousSelection.split(',') : []; diff --git a/app/assets/javascripts/lazy_loader.js b/app/assets/javascripts/lazy_loader.js index 66f25b622e0..9e8edd05b88 100644 --- a/app/assets/javascripts/lazy_loader.js +++ b/app/assets/javascripts/lazy_loader.js @@ -92,7 +92,7 @@ export default class LazyLoader { onIntersection = entries => { entries.forEach(entry => { // We are using `intersectionRatio > 0` over `isIntersecting`, as some browsers did not ship the latter - // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/54407 + // See: https://gitlab.com/gitlab-org/gitlab-foss/issues/54407 if (entry.intersectionRatio > 0) { this.intersectionObserver.unobserve(entry.target); this.lazyImages.push(entry.target); diff --git a/app/assets/javascripts/lib/utils/notify.js b/app/assets/javascripts/lib/utils/notify.js index e7f6255e5f1..3439db1e326 100644 --- a/app/assets/javascripts/lib/utils/notify.js +++ b/app/assets/javascripts/lib/utils/notify.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign, object-shorthand */ +/* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign */ function notificationGranted(message, opts, onclick) { var notification; @@ -21,8 +21,8 @@ function notifyPermissions() { function notifyMe(message, body, icon, onclick) { var opts; opts = { - body: body, - icon: icon, + body, + icon, }; // Let's check if the browser supports notifications /* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */ diff --git a/app/assets/javascripts/locale/sprintf.js b/app/assets/javascripts/locale/sprintf.js index 68b64a3a16a..a3557fbf3fb 100644 --- a/app/assets/javascripts/locale/sprintf.js +++ b/app/assets/javascripts/locale/sprintf.js @@ -9,7 +9,7 @@ import _ from 'underscore'; @returns {String} the text with parameters replaces (e.g. '5 users use us') @see https://ruby-doc.org/core-2.3.3/Kernel.html#method-i-sprintf - @see https://gitlab.com/gitlab-org/gitlab-ce/issues/37992 + @see https://gitlab.com/gitlab-org/gitlab-foss/issues/37992 */ export default (input, parameters, escapeParameters = true) => { let output = input; diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 0ddf40b0405..49be11d466d 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -37,6 +37,7 @@ import GlFieldErrors from './gl_field_errors'; import initUserPopovers from './user_popovers'; import { initUserTracking } from './tracking'; import { __ } from './locale'; +import initPrivacyPolicyUpdateCallout from './privacy_policy_update_callout'; import 'ee_else_ce/main_ee'; @@ -96,6 +97,7 @@ function deferredInitialisation() { initUsagePingConsent(); initUserPopovers(); initUserTracking(); + initPrivacyPolicyUpdateCallout(); if (document.querySelector('.search')) initSearchAutocomplete(); diff --git a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js index a62ebe23646..70b18d9728d 100644 --- a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js +++ b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js @@ -1,4 +1,4 @@ -/* eslint-disable no-useless-computed-key, object-shorthand, no-param-reassign */ +/* eslint-disable no-param-reassign */ /* global ace */ import Vue from 'vue'; @@ -42,7 +42,7 @@ import getModeByFileExtension from '~/lib/utils/ace_utils'; }, }, watch: { - ['file.showEditor'](val) { + 'file.showEditor': function showEditorWatcher(val) { this.resetEditorContent(); if (!val || this.fileLoaded || this.loading) { diff --git a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js index 88bc0940741..e7fcc183715 100644 --- a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js +++ b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js @@ -1,4 +1,4 @@ -/* eslint-disable object-shorthand, no-param-reassign, camelcase, no-nested-ternary, no-continue */ +/* eslint-disable no-param-reassign, camelcase, no-nested-ternary, no-continue */ import $ from 'jquery'; import Vue from 'vue'; @@ -31,7 +31,7 @@ import { s__ } from '~/locale'; hasError: false, isSubmitting: false, isParallel: diffViewType === VIEW_TYPES.PARALLEL, - diffViewType: diffViewType, + diffViewType, conflictsData: {}, }, @@ -188,7 +188,7 @@ import { s__ } from '~/locale'; getHeadHeaderLine(id) { return { - id: id, + id, richText: HEAD_HEADER_TEXT, buttonTitle: HEAD_BUTTON_TITLE, type: 'new', @@ -233,7 +233,7 @@ import { s__ } from '~/locale'; getOriginHeaderLine(id) { return { - id: id, + id, richText: ORIGIN_HEADER_TEXT, buttonTitle: ORIGIN_BUTTON_TITLE, type: 'old', diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index 9c0d55326ee..1738dbe439c 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -1,4 +1,4 @@ -/* eslint-disable one-var, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */ +/* eslint-disable one-var, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */ /* global Issuable */ /* global ListMilestone */ @@ -65,7 +65,7 @@ export default class MilestoneSelect { milestoneLinkNoneTemplate = `<span class="no-value">${__('None')}</span>`; } return $dropdown.glDropdown({ - showMenuAbove: showMenuAbove, + showMenuAbove, data: (term, callback) => axios.get(milestonesUrl).then(({ data }) => { const extraOptions = []; @@ -126,7 +126,7 @@ export default class MilestoneSelect { return defaultLabel; } }, - defaultLabel: defaultLabel, + defaultLabel, fieldName: $dropdown.data('fieldName'), text: milestone => _.escape(milestone.title), id: milestone => { diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue index 5f1d742d952..f3f3bf15295 100644 --- a/app/assets/javascripts/monitoring/components/charts/time_series.vue +++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue @@ -1,6 +1,5 @@ <script> import { __ } from '~/locale'; -import { mapState } from 'vuex'; import { GlLink, GlButton } from '@gitlab/ui'; import { GlAreaChart, GlLineChart, GlChartSeriesLabel } from '@gitlab/ui/dist/charts'; import dateFormat from 'dateformat'; @@ -70,7 +69,6 @@ export default { }; }, computed: { - ...mapState('monitoringDashboard', ['exportMetricsToCsvEnabled']), chartData() { // Transforms & supplements query data to render appropriate labels & styles // Input: [{ queryAttributes1 }, { queryAttributes2 }] @@ -190,18 +188,6 @@ export default { yAxisLabel() { return `${this.graphData.y_label}`; }, - csvText() { - const chartData = this.chartData[0].data; - const header = `timestamp,${this.graphData.y_label}\r\n`; // eslint-disable-line @gitlab/i18n/no-non-i18n-strings - return chartData.reduce((csv, data) => { - const row = data.join(','); - return `${csv}${row}\r\n`; - }, header); - }, - downloadLink() { - const data = new Blob([this.csvText], { type: 'text/plain' }); - return window.URL.createObjectURL(data); - }, }, watch: { containerWidth: 'onResize', @@ -270,16 +256,6 @@ export default { <div class="prometheus-graph"> <div class="prometheus-graph-header"> <h5 class="prometheus-graph-title js-graph-title">{{ graphData.title }}</h5> - <gl-button - v-if="exportMetricsToCsvEnabled" - :href="downloadLink" - :title="__('Download CSV')" - :aria-label="__('Download CSV')" - style="margin-left: 200px;" - download="chart_metrics.csv" - > - {{ __('Download CSV') }} - </gl-button> <div class="prometheus-graph-widgets js-graph-widgets"> <slot></slot> </div> diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue index 7a5a3789bd6..12a4c83e053 100644 --- a/app/assets/javascripts/monitoring/components/dashboard.vue +++ b/app/assets/javascripts/monitoring/components/dashboard.vue @@ -262,7 +262,7 @@ export default { return window.URL.createObjectURL(data); }, // TODO: BEGIN, Duplicated code with panel_type until feature flag is removed - // Issue number: https://gitlab.com/gitlab-org/gitlab-ce/issues/63845 + // Issue number: https://gitlab.com/gitlab-org/gitlab-foss/issues/63845 getGraphAlerts(queries) { if (!this.allAlerts) return {}; const metricIdsForChart = queries.map(q => q.metricId); diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index 2ef081837e6..4ddbec71ba6 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, object-shorthand, no-else-return, prefer-template, prefer-arrow-callback */ +/* eslint-disable func-names, no-else-return, prefer-template, prefer-arrow-callback */ import $ from 'jquery'; import Api from './api'; @@ -18,15 +18,15 @@ export default class NamespaceSelect { search: { fields: ['path'], }, - fieldName: fieldName, - toggleLabel: function(selected) { + fieldName, + toggleLabel(selected) { if (selected.id == null) { return selected.text; } else { return selected.kind + ': ' + selected.full_path; } }, - data: function(term, dataCallback) { + data(term, dataCallback) { return Api.namespaces(term, function(namespaces) { if (isFilter) { const anyNamespace = { @@ -39,7 +39,7 @@ export default class NamespaceSelect { return dataCallback(namespaces); }); }, - text: function(namespace) { + text(namespace) { if (namespace.id == null) { return namespace.text; } else { diff --git a/app/assets/javascripts/notes/components/discussion_actions.vue b/app/assets/javascripts/notes/components/discussion_actions.vue index e3be91a4966..6bbf2fa6ee4 100644 --- a/app/assets/javascripts/notes/components/discussion_actions.vue +++ b/app/assets/javascripts/notes/components/discussion_actions.vue @@ -36,10 +36,11 @@ export default { }, }, computed: { + resolvableNotes() { + return this.discussion.notes.filter(x => x.resolvable); + }, userCanResolveDiscussion() { - return this.discussion.notes.every( - note => note.current_user && note.current_user.can_resolve, - ); + return this.resolvableNotes.every(note => note.current_user && note.current_user.can_resolve); }, }, }; diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index 9019f0542b6..fa8fc7d02e4 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -98,7 +98,7 @@ export default { // We need to do this to ensure we have the correct sentence order // when translating this as the sentence order may change from one // language to the next. See: - // https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24427#note_133713771 + // https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/24427#note_133713771 const { id, url } = this.commit; const commitLink = `<a class="commit-sha monospace" href="${escape(url)}">${truncateSha( id, diff --git a/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js b/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js index ec3919dd073..505ca938f40 100644 --- a/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js +++ b/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js @@ -1,8 +1,8 @@ -/* eslint-disable func-names, object-shorthand, no-var, one-var, camelcase, no-param-reassign, no-return-assign, prefer-arrow-callback, consistent-return, no-cond-assign, no-else-return */ +/* eslint-disable func-names, no-var, one-var, camelcase, no-param-reassign, no-return-assign, prefer-arrow-callback, consistent-return, no-cond-assign, no-else-return */ import _ from 'underscore'; export default { - parse_log: function(log) { + parse_log(log) { var by_author, by_email, data, entry, i, len, total, normalized_email; total = {}; by_author = {}; @@ -25,15 +25,15 @@ export default { total = _.toArray(total); by_author = _.toArray(by_author); return { - total: total, - by_author: by_author, + total, + by_author, }; }, - add_date: function(date, collection) { + add_date(date, collection) { collection[date] = {}; return (collection[date].date = date); }, - add_author: function(author, by_author, by_email) { + add_author(author, by_author, by_email) { var data, normalized_email; data = {}; data.author_name = author.author_name; @@ -43,36 +43,36 @@ export default { by_email[normalized_email] = data; return data; }, - store_data: function(entry, total, by_author) { + store_data(entry, total, by_author) { this.store_commits(total, by_author); this.store_additions(entry, total, by_author); return this.store_deletions(entry, total, by_author); }, - store_commits: function(total, by_author) { + store_commits(total, by_author) { this.add(total, 'commits', 1); return this.add(by_author, 'commits', 1); }, - add: function(collection, field, value) { + add(collection, field, value) { if (collection[field] == null) { collection[field] = 0; } return (collection[field] += value); }, - store_additions: function(entry, total, by_author) { + store_additions(entry, total, by_author) { if (entry.additions == null) { entry.additions = 0; } this.add(total, 'additions', entry.additions); return this.add(by_author, 'additions', entry.additions); }, - store_deletions: function(entry, total, by_author) { + store_deletions(entry, total, by_author) { if (entry.deletions == null) { entry.deletions = 0; } this.add(total, 'deletions', entry.deletions); return this.add(by_author, 'deletions', entry.deletions); }, - get_total_data: function(parsed_log, field) { + get_total_data(parsed_log, field) { var log, total_data; log = parsed_log.total; total_data = this.pick_field(log, field); @@ -80,7 +80,7 @@ export default { return d.date; }); }, - pick_field: function(log, field) { + pick_field(log, field) { var total_data; total_data = []; _.each(log, function(d) { @@ -88,7 +88,7 @@ export default { }); return total_data; }, - get_author_data: function(parsed_log, field, date_range) { + get_author_data(parsed_log, field, date_range) { var author_data, log; if (date_range == null) { date_range = null; @@ -111,7 +111,7 @@ export default { return d[field]; }).reverse(); }, - parse_log_entry: function(log_entry, field, date_range) { + parse_log_entry(log_entry, field, date_range) { var parsed_entry; parsed_entry = {}; @@ -138,7 +138,7 @@ export default { ); return parsed_entry; }, - in_range: function(date, date_range) { + in_range(date, date_range) { var ref; if (date_range === null || (date_range[0] <= (ref = new Date(date)) && ref <= date_range[1])) { return true; diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js index 33e9a8e9d56..b99408e3609 100644 --- a/app/assets/javascripts/pages/projects/project.js +++ b/app/assets/javascripts/pages/projects/project.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, no-return-assign, object-shorthand, vars-on-top */ +/* eslint-disable func-names, no-var, no-return-assign, vars-on-top */ import $ from 'jquery'; import Cookies from 'js-cookie'; @@ -123,7 +123,7 @@ export default class Project { filterByText: true, inputFieldName: $dropdown.data('inputFieldName'), fieldName, - renderRow: function(ref) { + renderRow(ref) { var li = refListItem.cloneNode(false); if (ref.header != null) { @@ -144,13 +144,13 @@ export default class Project { return li; }, - id: function(obj, $el) { + id(obj, $el) { return $el.attr('data-ref'); }, - toggleLabel: function(obj, $el) { + toggleLabel(obj, $el) { return $el.text().trim(); }, - clicked: function(options) { + clicked(options) { const { e } = options; e.preventDefault(); if ($(`input[name="${fieldName}"]`).length) { diff --git a/app/assets/javascripts/pipelines/components/graph/graph_component.vue b/app/assets/javascripts/pipelines/components/graph/graph_component.vue index 27c1b639889..cfc72327ef7 100644 --- a/app/assets/javascripts/pipelines/components/graph/graph_component.vue +++ b/app/assets/javascripts/pipelines/components/graph/graph_component.vue @@ -2,35 +2,43 @@ import { GlLoadingIcon } from '@gitlab/ui'; import StageColumnComponent from './stage_column_component.vue'; import GraphMixin from '../../mixins/graph_component_mixin'; +import GraphWidthMixin from '~/pipelines/mixins/graph_width_mixin'; export default { components: { StageColumnComponent, GlLoadingIcon, }, - mixins: [GraphMixin], + mixins: [GraphMixin, GraphWidthMixin], }; </script> <template> <div class="build-content middle-block js-pipeline-graph"> <div class="pipeline-visualization pipeline-graph pipeline-tab-content"> - <div v-if="isLoading" class="m-auto"><gl-loading-icon :size="3" /></div> + <div + :style="{ + paddingLeft: `${graphLeftPadding}px`, + paddingRight: `${graphRightPadding}px`, + }" + > + <gl-loading-icon v-if="isLoading" class="m-auto" :size="3" /> - <ul v-if="!isLoading" class="stage-column-list"> - <stage-column-component - v-for="(stage, index) in graph" - :key="stage.name" - :class="{ - 'append-right-48': shouldAddRightMargin(index), - }" - :title="capitalizeStageName(stage.name)" - :groups="stage.groups" - :stage-connector-class="stageConnectorClass(index, stage)" - :is-first-column="isFirstColumn(index)" - :action="stage.status.action" - @refreshPipelineGraph="refreshPipelineGraph" - /> - </ul> + <ul v-if="!isLoading" class="stage-column-list"> + <stage-column-component + v-for="(stage, index) in graph" + :key="stage.name" + :class="{ + 'append-right-48': shouldAddRightMargin(index), + }" + :title="capitalizeStageName(stage.name)" + :groups="stage.groups" + :stage-connector-class="stageConnectorClass(index, stage)" + :is-first-column="isFirstColumn(index)" + :action="stage.status.action" + @refreshPipelineGraph="refreshPipelineGraph" + /> + </ul> + </div> </div> </div> </template> diff --git a/app/assets/javascripts/pipelines/components/pipelines_actions.vue b/app/assets/javascripts/pipelines/components/pipelines_actions.vue index 4b2d816c6a0..9764e32955c 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_actions.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_actions.vue @@ -37,7 +37,7 @@ export default { ), { jobName: action.name }, ); - // https://gitlab.com/gitlab-org/gitlab-ce/issues/52156 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/52156 // eslint-disable-next-line no-alert if (!window.confirm(confirmationMessage)) { return; diff --git a/app/assets/javascripts/pipelines/constants.js b/app/assets/javascripts/pipelines/constants.js index eaa11a84cb9..d27829db50c 100644 --- a/app/assets/javascripts/pipelines/constants.js +++ b/app/assets/javascripts/pipelines/constants.js @@ -1,2 +1,3 @@ export const CANCEL_REQUEST = 'CANCEL_REQUEST'; export const PIPELINES_TABLE = 'PIPELINES_TABLE'; +export const LAYOUT_CHANGE_DELAY = 300; diff --git a/app/assets/javascripts/pipelines/mixins/graph_width_mixin.js b/app/assets/javascripts/pipelines/mixins/graph_width_mixin.js new file mode 100644 index 00000000000..2dbaa5a5c9a --- /dev/null +++ b/app/assets/javascripts/pipelines/mixins/graph_width_mixin.js @@ -0,0 +1,50 @@ +import { debounceByAnimationFrame } from '~/lib/utils/common_utils'; +import { LAYOUT_CHANGE_DELAY } from '~/pipelines/constants'; + +export default { + debouncedResize: null, + sidebarMutationObserver: null, + data() { + return { + graphLeftPadding: 0, + graphRightPadding: 0, + }; + }, + beforeDestroy() { + window.removeEventListener('resize', this.$options.debouncedResize); + + if (this.$options.sidebarMutationObserver) { + this.$options.sidebarMutationObserver.disconnect(); + } + }, + created() { + this.$options.debouncedResize = debounceByAnimationFrame(this.setGraphPadding); + window.addEventListener('resize', this.$options.debouncedResize); + }, + mounted() { + this.setGraphPadding(); + + this.$options.sidebarMutationObserver = new MutationObserver(this.handleLayoutChange); + this.$options.sidebarMutationObserver.observe(document.querySelector('.layout-page'), { + attributes: true, + childList: false, + subtree: false, + }); + }, + methods: { + setGraphPadding() { + // only add padding to main graph (not inline upstream/downstream graphs) + if (this.type && this.type !== 'main') return; + + const container = document.querySelector('.js-pipeline-container'); + if (!container) return; + + this.graphLeftPadding = container.offsetLeft; + this.graphRightPadding = window.innerWidth - container.offsetLeft - container.offsetWidth; + }, + handleLayoutChange() { + // wait until animations finish, then recalculate padding + window.setTimeout(this.setGraphPadding, LAYOUT_CHANGE_DELAY); + }, + }, +}; diff --git a/app/assets/javascripts/privacy_policy_update_callout.js b/app/assets/javascripts/privacy_policy_update_callout.js index 126b1ee1132..97f41deb30f 100644 --- a/app/assets/javascripts/privacy_policy_update_callout.js +++ b/app/assets/javascripts/privacy_policy_update_callout.js @@ -1,7 +1,7 @@ import PersistentUserCallout from '~/persistent_user_callout'; function initPrivacyPolicyUpdateCallout() { - const callout = document.querySelector('.privacy-policy-update-64341'); + const callout = document.querySelector('.js-privacy-policy-update'); PersistentUserCallout.factory(callout); } diff --git a/app/assets/javascripts/profile/gl_crop.js b/app/assets/javascripts/profile/gl_crop.js index 6a07ccc7586..44bc2d9f5f8 100644 --- a/app/assets/javascripts/profile/gl_crop.js +++ b/app/assets/javascripts/profile/gl_crop.js @@ -1,4 +1,4 @@ -/* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-return-assign, object-shorthand, one-var, consistent-return, class-methods-use-this */ +/* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-return-assign, one-var, consistent-return, class-methods-use-this */ import $ from 'jquery'; import 'cropper'; @@ -100,7 +100,7 @@ import _ from 'underscore'; cropBoxMovable: false, cropBoxResizable: false, toggleDragModeOnDblclick: false, - built: function() { + built() { const $image = $(this); const container = $image.cropper('getContainerData'); const { cropBoxWidth, cropBoxHeight } = _this; diff --git a/app/assets/javascripts/project_select.js b/app/assets/javascripts/project_select.js index dbe354a547b..88665ed2ab7 100644 --- a/app/assets/javascripts/project_select.js +++ b/app/assets/javascripts/project_select.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, object-shorthand, one-var, no-else-return */ +/* eslint-disable func-names, no-var, one-var, no-else-return */ import $ from 'jquery'; import Api from './api'; @@ -28,7 +28,7 @@ export default function projectSelect() { } $(select).select2({ - placeholder: placeholder, + placeholder, minimumInputLength: 0, query: (function(_this) { return function(query) { @@ -79,18 +79,18 @@ export default function projectSelect() { } }; })(this), - id: function(project) { + id(project) { if (simpleFilter) return project.id; return JSON.stringify({ name: project.name, url: project.web_url, }); }, - text: function(project) { + text(project) { return project.name_with_namespace || project.name; }, - initSelection: function(el, callback) { + initSelection(el, callback) { return Api.project(el.val()).then(({ data }) => callback(data)); }, diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index f02c55c3d5b..2f37dcec197 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -1,4 +1,4 @@ -/* eslint-disable no-return-assign, one-var, no-var, consistent-return, object-shorthand, prefer-template, class-methods-use-this, no-lonely-if, vars-on-top */ +/* eslint-disable no-return-assign, one-var, no-var, consistent-return, prefer-template, class-methods-use-this, no-lonely-if, vars-on-top */ import $ from 'jquery'; import { escape, throttle } from 'underscore'; @@ -171,7 +171,7 @@ export class SearchAutocomplete { params: { project_id: this.projectId, project_ref: this.projectRef, - term: term, + term, }, }) .then(response => { diff --git a/app/assets/javascripts/single_file_diff.js b/app/assets/javascripts/single_file_diff.js index f2b9d75dd00..b70e384fae5 100644 --- a/app/assets/javascripts/single_file_diff.js +++ b/app/assets/javascripts/single_file_diff.js @@ -5,7 +5,7 @@ import { __ } from './locale'; import axios from './lib/utils/axios_utils'; import createFlash from './flash'; import FilesCommentButton from './files_comment_button'; -import imageDiffHelper from './image_diff/helpers/index'; +import initImageDiffHelper from './image_diff/helpers/init_image_diff'; import syntaxHighlight from './syntax_highlight'; const WRAPPER = '<div class="diff-content"></div>'; @@ -101,7 +101,7 @@ export default class SingleFileDiff { FilesCommentButton.init($file); const canCreateNote = $file.closest('.files').is('[data-can-create-note]'); - imageDiffHelper.initImageDiff($file[0], canCreateNote); + initImageDiffHelper.initImageDiff($file[0], canCreateNote); if (cb) cb(); }) diff --git a/app/assets/javascripts/tracking.js b/app/assets/javascripts/tracking.js index 03281b5ef49..1b4ca1d5741 100644 --- a/app/assets/javascripts/tracking.js +++ b/app/assets/javascripts/tracking.js @@ -10,12 +10,8 @@ const DEFAULT_SNOWPLOW_OPTIONS = { forceSecureTracker: true, eventMethod: 'post', contexts: { webPage: true }, - // Page tracking tracks a single event when the page loads. - pageTrackingEnabled: false, - // Activity tracking tracks when a user is still interacting with the page. - // Events like scrolling and mouse movements are used to determine if the - // user has the tab active and is still actively engaging. - activityTrackingEnabled: false, + formTracking: false, + linkClickTracking: false, }; const extractData = (el, opts = {}) => { @@ -96,6 +92,9 @@ export function initUserTracking() { const opts = Object.assign({}, DEFAULT_SNOWPLOW_OPTIONS, window.snowplowOptions); window.snowplow('newTracker', opts.namespace, opts.hostname, opts); - if (opts.activityTrackingEnabled) window.snowplow('enableActivityTracking', 30, 30); - if (opts.pageTrackingEnabled) window.snowplow('trackPageView'); // must be after enableActivityTracking + window.snowplow('enableActivityTracking', 30, 30); + window.snowplow('trackPageView'); // must be after enableActivityTracking + + if (opts.formTracking) window.snowplow('enableFormTracking'); + if (opts.linkClickTracking) window.snowplow('enableLinkClickTracking'); } diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index 4b3c42ae848..e78ca56be0e 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, object-shorthand, no-shadow, no-else-return, no-self-compare, prefer-template, no-unused-expressions, yoda, prefer-spread, camelcase, no-param-reassign */ +/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, no-shadow, no-else-return, no-self-compare, prefer-template, no-unused-expressions, yoda, prefer-spread, camelcase, no-param-reassign */ /* global Issuable */ /* global emitSidebarEvent */ @@ -248,8 +248,8 @@ function UsersSelect(currentUser, els, options = {}) { })}</span> <% } %>`, ); return $dropdown.glDropdown({ - showMenuAbove: showMenuAbove, - data: function(term, callback) { + showMenuAbove, + data(term, callback) { return _this.users( term, options, @@ -261,7 +261,7 @@ function UsersSelect(currentUser, els, options = {}) { }.bind(this), ); }, - processData: function(term, data, callback) { + processData(term, data, callback) { let users = data; // Only show assigned user list when there is no search term @@ -326,7 +326,7 @@ function UsersSelect(currentUser, els, options = {}) { } anyUser = { beforeDivider: true, - name: name, + name, id: null, }; users.unshift(anyUser); @@ -376,7 +376,7 @@ function UsersSelect(currentUser, els, options = {}) { }, selectable: true, fieldName: $dropdown.data('fieldName'), - toggleLabel: function(selected, el, glDropdown) { + toggleLabel(selected, el, glDropdown) { const inputValue = glDropdown.filterInput.val(); if (this.multiSelect && inputValue === '') { @@ -404,8 +404,8 @@ function UsersSelect(currentUser, els, options = {}) { return defaultLabel; } }, - defaultLabel: defaultLabel, - hidden: function() { + defaultLabel, + hidden() { if ($dropdown.hasClass('js-multiselect')) { emitSidebarEvent('sidebar.saveAssignees'); } @@ -422,7 +422,7 @@ function UsersSelect(currentUser, els, options = {}) { }, multiSelect: $dropdown.hasClass('js-multiselect'), inputMeta: $dropdown.data('inputMeta'), - clicked: function(options) { + clicked(options) { const { $el, e, isMarking } = options; const user = options.selectedObj; @@ -522,10 +522,10 @@ function UsersSelect(currentUser, els, options = {}) { $dropdown.dropdown('toggle'); } }, - id: function(user) { + id(user) { return user.id; }, - opened: function(e) { + opened(e) { const $el = $(e.currentTarget); const selected = getSelected(); if ($dropdown.hasClass('js-issue-board-sidebar') && selected.length === 0) { @@ -546,7 +546,7 @@ function UsersSelect(currentUser, els, options = {}) { } }, updateLabel: $dropdown.data('dropdownTitle'), - renderRow: function(user) { + renderRow(user) { var avatar, img, username; username = user.username ? '@' + user.username : ''; avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url; @@ -605,7 +605,7 @@ function UsersSelect(currentUser, els, options = {}) { placeholder: __('Search for a user'), multiple: $(select).hasClass('multiselect'), minimumInputLength: 0, - query: function(query) { + query(query) { return _this.users(query.term, options, function(users) { var anyUser, data, emailUser, index, len, name, nullUser, obj, ref; data = { @@ -638,7 +638,7 @@ function UsersSelect(currentUser, els, options = {}) { name = s__('UsersSelect|Any User'); } anyUser = { - name: name, + name, id: null, }; data.results.unshift(anyUser); @@ -661,24 +661,24 @@ function UsersSelect(currentUser, els, options = {}) { return query.callback(data); }); }, - initSelection: function() { + initSelection() { var args; args = 1 <= arguments.length ? [].slice.call(arguments, 0) : []; return _this.initSelection.apply(_this, args); }, - formatResult: function() { + formatResult() { var args; args = 1 <= arguments.length ? [].slice.call(arguments, 0) : []; return _this.formatResult.apply(_this, args); }, - formatSelection: function() { + formatSelection() { var args; args = 1 <= arguments.length ? [].slice.call(arguments, 0) : []; return _this.formatSelection.apply(_this, args); }, dropdownCssClass: 'ajax-users-dropdown', // we do not want to escape markup since we are displaying html in results - escapeMarkup: function(m) { + escapeMarkup(m) { return m; }, }); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue index e294e1de976..2c113770d8b 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue @@ -88,7 +88,8 @@ export default { mergeButtonText() { if (this.isMergingImmediately) { return __('Merge in progress'); - } else if (this.isAutoMergeAvailable) { + } + if (this.isAutoMergeAvailable) { return this.autoMergeText; } @@ -306,7 +307,7 @@ export default { </template> <template v-else> <span class="bold js-resolve-mr-widget-items-message"> - {{ __('You can only merge once the items above are resolved') }} + {{ mergeDisabledText }} </span> </template> </div> diff --git a/app/assets/javascripts/vue_merge_request_widget/mixins/ready_to_merge.js b/app/assets/javascripts/vue_merge_request_widget/mixins/ready_to_merge.js index eef49e20159..40e6203599f 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mixins/ready_to_merge.js +++ b/app/assets/javascripts/vue_merge_request_widget/mixins/ready_to_merge.js @@ -1,5 +1,7 @@ import { __ } from '~/locale'; +export const MERGE_DISABLED_TEXT = __('You can only merge once the items above are resolved.'); + export default { computed: { isMergeButtonDisabled() { @@ -11,6 +13,9 @@ export default { this.mr.preventMerge, ); }, + mergeDisabledText() { + return MERGE_DISABLED_TEXT; + }, autoMergeText() { // MWPS is currently the only auto merge strategy available in CE return __('Merge when pipeline succeeds'); diff --git a/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js b/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js index f637a44bf2d..8a229d80954 100644 --- a/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js +++ b/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js @@ -37,7 +37,7 @@ export default class MRWidgetService { // two endpoints are requested in order to get MR info: // one which is etag-cached and invalidated and another one which is not cached // the idea is to move all the fields to etag-cached endpoint and then perform only one request - // https://gitlab.com/gitlab-org/gitlab-ce/issues/61559#note_188801390 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/61559#note_188801390 const getData = axios.get(this.endpoints.mergeRequestWidgetPath); const getCachedData = axios.get(this.endpoints.mergeRequestCachedWidgetPath); diff --git a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue index b0962684430..0e0bb8735b4 100644 --- a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue +++ b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue @@ -7,7 +7,7 @@ import CiIcon from './ci_icon.vue'; * * Receives status object containing: * status: { - * details_path: "/gitlab-org/gitlab-ce/pipelines/8150156" // url + * details_path: "/gitlab-org/gitlab-foss/pipelines/8150156" // url * group:"running" // used for CSS class * icon: "icon_status_running" // used to render the icon * label:"running" // used for potential tooltip diff --git a/app/assets/javascripts/vue_shared/components/ci_icon.vue b/app/assets/javascripts/vue_shared/components/ci_icon.vue index 25f80219993..5d373e179b2 100644 --- a/app/assets/javascripts/vue_shared/components/ci_icon.vue +++ b/app/assets/javascripts/vue_shared/components/ci_icon.vue @@ -6,7 +6,7 @@ import Icon from '../../vue_shared/components/icon.vue'; * * Receives status object containing: * status: { - * details_path: "/gitlab-org/gitlab-ce/pipelines/8150156" // url + * details_path: "/gitlab-org/gitlab-foss/pipelines/8150156" // url * group:"running" // used for CSS class * icon: "icon_status_running" // used to render the icon * label:"running" // used for potential tooltip diff --git a/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue b/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue index 596fd48f96a..7f0345c7ec0 100644 --- a/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue +++ b/app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue @@ -1,6 +1,6 @@ <script> import _ from 'underscore'; -import { GlLoadingIcon } from '@gitlab/ui'; +import { GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui'; import ProjectListItem from './project_list_item.vue'; const SEARCH_INPUT_TIMEOUT_MS = 500; @@ -9,6 +9,7 @@ export default { name: 'ProjectSelector', components: { GlLoadingIcon, + GlSearchBoxByType, ProjectListItem, }, props: { @@ -53,9 +54,6 @@ export default { isSelected(project) { return Boolean(_.findWhere(this.selectedProjects, { id: project.id })); }, - focusSearchInput() { - this.$refs.searchInput.focus(); - }, onInput: _.debounce(function debouncedOnInput() { this.$emit('searched', this.searchQuery); }, SEARCH_INPUT_TIMEOUT_MS), @@ -64,12 +62,11 @@ export default { </script> <template> <div> - <input - ref="searchInput" + <gl-search-box-by-type v-model="searchQuery" :placeholder="__('Search your projects')" type="search" - class="form-control mb-3 js-project-selector-input" + class="mb-3" autofocus @input="onInput" /> diff --git a/app/assets/stylesheets/bootstrap_migration.scss b/app/assets/stylesheets/bootstrap_migration.scss index 29473da21cc..c9b00e5ff27 100644 --- a/app/assets/stylesheets/bootstrap_migration.scss +++ b/app/assets/stylesheets/bootstrap_migration.scss @@ -342,7 +342,7 @@ input[type=color].form-control { /* Bootstrap 4.1.2 introduced a new default vertical alignment which breaks our icons, so we need to reset the vertical alignment to the default value. See: - - https://gitlab.com/gitlab-org/gitlab-ce/issues/51362 + - https://gitlab.com/gitlab-org/gitlab-foss/issues/51362 */ svg { vertical-align: baseline; diff --git a/app/assets/stylesheets/framework/flash.scss b/app/assets/stylesheets/framework/flash.scss index af05d069f97..7e7b08797b2 100644 --- a/app/assets/stylesheets/framework/flash.scss +++ b/app/assets/stylesheets/framework/flash.scss @@ -131,16 +131,16 @@ $notification-box-shadow-color: rgba(0, 0, 0, 0.25); } } -.with-system-header .flash-container { +.with-system-header .flash-container.sticky { top: $flash-container-top + $system-header-height; } .with-performance-bar { - .flash-container { + .flash-container.sticky { top: $flash-container-top + $performance-bar-height; } - &.with-system-header .flash-container { + &.with-system-header .flash-container.sticky { top: $flash-container-top + $performance-bar-height + $system-header-height; } } diff --git a/app/assets/stylesheets/framework/highlight.scss b/app/assets/stylesheets/framework/highlight.scss index 983bd032da4..58516cbd1a9 100644 --- a/app/assets/stylesheets/framework/highlight.scss +++ b/app/assets/stylesheets/framework/highlight.scss @@ -71,7 +71,7 @@ } // Vertically aligns <table> line numbers (eg. blame view) -// see https://gitlab.com/gitlab-org/gitlab-ce/issues/54048 +// see https://gitlab.com/gitlab-org/gitlab-foss/issues/54048 td.line-numbers { line-height: 1; } diff --git a/app/assets/stylesheets/mailers/highlighted_diff_email.scss b/app/assets/stylesheets/mailers/highlighted_diff_email.scss index 33c114838c2..58c83ac7915 100644 --- a/app/assets/stylesheets/mailers/highlighted_diff_email.scss +++ b/app/assets/stylesheets/mailers/highlighted_diff_email.scss @@ -4,7 +4,7 @@ // avoid all descendant selectors (`table td`). This is because the CSS inlining // we use performs dramatically worse on descendant selectors than the // alternatives. -// <https://gitlab.com/gitlab-org/gitlab-ee/issues/490#note_12283632> +// <https://gitlab.com/gitlab-org/gitlab/issues/490#note_12283632> // // DO NOT ADD ANY DESCENDANT SELECTORS TO THIS FILE. Instead, use (in order of // preference): plain class selectors, type (element name) selectors, or diff --git a/app/assets/stylesheets/pages/boards.scss b/app/assets/stylesheets/pages/boards.scss index 4bf0abccd00..d540a347dde 100644 --- a/app/assets/stylesheets/pages/boards.scss +++ b/app/assets/stylesheets/pages/boards.scss @@ -73,7 +73,7 @@ .board { // the next line cannot be replaced with .d-inline-block because it breaks display: none of SortableJS - // see https://gitlab.com/gitlab-org/gitlab-ce/issues/64828 + // see https://gitlab.com/gitlab-org/gitlab-foss/issues/64828 display: inline-block; width: calc(85vw - 15px); diff --git a/app/assets/stylesheets/pages/commits.scss b/app/assets/stylesheets/pages/commits.scss index 0b0a4e50146..be0311f584f 100644 --- a/app/assets/stylesheets/pages/commits.scss +++ b/app/assets/stylesheets/pages/commits.scss @@ -81,7 +81,7 @@ position: relative; font-family: $monospace-font; $left: 12px; - overflow: hidden; // See https://gitlab.com/gitlab-org/gitlab-ce/issues/13987 + overflow: hidden; // See https://gitlab.com/gitlab-org/gitlab-foss/issues/13987 .max-width-marker { width: 72ch; color: $commit-max-width-marker-color; diff --git a/app/assets/stylesheets/pages/cycle_analytics.scss b/app/assets/stylesheets/pages/cycle_analytics.scss index e20711a193d..76cd4f34865 100644 --- a/app/assets/stylesheets/pages/cycle_analytics.scss +++ b/app/assets/stylesheets/pages/cycle_analytics.scss @@ -1,5 +1,5 @@ -#cycle-analytics { - max-width: 1000px; +#cycle-analytics, +.cycle-analytics { margin: 24px auto 0; position: relative; @@ -41,7 +41,8 @@ width: 20%; } - .fa { + .fa, + svg { color: $cycle-analytics-light-gray; &:hover { @@ -233,7 +234,7 @@ &.issue-title, &.commit-title, - &.merge-merquest-title { + &.merge-request-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -266,6 +267,7 @@ color: $gl-text-color; } + .mr-link, .issue-link, .commit-author-link, .issue-author-link { diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 0e844b0e4a5..5617ab0af41 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -571,7 +571,7 @@ /* * Overwrite hover style for dropdown items, so that they are not blue - * This should be removed during dev of https://gitlab.com/gitlab-org/gitlab-ce/issues/44040 + * This should be removed during dev of https://gitlab.com/gitlab-org/gitlab-foss/issues/44040 */ li a { &:hover, diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 6c03dbb56a7..d67a0f83aa2 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -492,7 +492,7 @@ $note-form-margin-left: 72px; vertical-align: top; white-space: normal; - // Fixes subpixel rounding issue https://gitlab.com/gitlab-org/gitlab-ce/issues/53973 + // Fixes subpixel rounding issue https://gitlab.com/gitlab-org/gitlab-foss/issues/53973 // background-color is needed for dark code preference padding-bottom: 1px; background-color: $white-light; @@ -980,7 +980,7 @@ $note-form-margin-left: 72px; } //This needs to be deleted when Snippet/Commit comments are convered to Vue -// See https://gitlab.com/gitlab-org/gitlab-ce/issues/53918#note_117038785 +// See https://gitlab.com/gitlab-org/gitlab-foss/issues/53918#note_117038785 .unstyled-comments { .discussion-header { padding: $gl-padding; diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index cda6c9ce0cc..1b2af932733 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -453,7 +453,7 @@ display: flex; width: 100%; background-color: $gray-light; - padding: $gl-padding; + padding: $gl-padding 0; overflow: auto; } diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 03e935fceae..fbf63997b15 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -69,7 +69,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/63107') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/63107') end def application_setting_params @@ -86,7 +86,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController params[:application_setting][:import_sources]&.delete("") params[:application_setting][:restricted_visibility_levels]&.delete("") - # TODO Remove domain_blacklist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-ce/issues/67204) + # TODO Remove domain_blacklist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-foss/issues/67204) params.delete(:domain_blacklist_raw) if params[:domain_blacklist_file] params.delete(:domain_blacklist_raw) if params[:domain_blacklist] params.delete(:domain_whitelist_raw) if params[:domain_whitelist] diff --git a/app/controllers/admin/clusters_controller.rb b/app/controllers/admin/clusters_controller.rb index f54933de10f..5b1902fad51 100644 --- a/app/controllers/admin/clusters_controller.rb +++ b/app/controllers/admin/clusters_controller.rb @@ -11,3 +11,5 @@ class Admin::ClustersController < Clusters::ClustersController @clusterable ||= InstanceClusterablePresenter.fabricate(Clusters::Instance.new, current_user: current_user) end end + +Admin::ClustersController.prepend_if_ee('EE::Admin::ClustersController') diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index c455930c044..e31e0e09978 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -46,6 +46,6 @@ class Admin::ServicesController < Admin::ApplicationController # rubocop: enable CodeReuse/ActiveRecord def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42430') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42430') end end diff --git a/app/controllers/boards/issues_controller.rb b/app/controllers/boards/issues_controller.rb index 1d1a72d21f1..9894dd7d180 100644 --- a/app/controllers/boards/issues_controller.rb +++ b/app/controllers/boards/issues_controller.rb @@ -130,8 +130,8 @@ module Boards end def whitelist_query_limiting - # Also see https://gitlab.com/gitlab-org/gitlab-ce/issues/42439 - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42428') + # Also see https://gitlab.com/gitlab-org/gitlab-foss/issues/42439 + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42428') end def validate_id_list diff --git a/app/controllers/boards/lists_controller.rb b/app/controllers/boards/lists_controller.rb index 7633e2aedd2..d0f4904c34e 100644 --- a/app/controllers/boards/lists_controller.rb +++ b/app/controllers/boards/lists_controller.rb @@ -25,7 +25,7 @@ module Boards end def update - list = board.lists.movable.find(params[:id]) + list = board.lists.find(params[:id]) service = Boards::Lists::UpdateService.new(board_parent, current_user, update_list_params) result = service.execute(list) diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb index b55061b5dc6..15f1e8284ff 100644 --- a/app/controllers/clusters/clusters_controller.rb +++ b/app/controllers/clusters/clusters_controller.rb @@ -31,7 +31,7 @@ class Clusters::ClustersController < Clusters::BaseController # In EE (Premium) we can have any number, as multiple clusters are # supported, but the number of clusters are fairly low currently. # - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/55260 also. + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/55260 also. @clusters = Kaminari.paginate_array(clusters).page(params[:page]).per(20) @has_ancestor_clusters = finder.has_ancestor_clusters? diff --git a/app/controllers/concerns/record_user_last_activity.rb b/app/controllers/concerns/record_user_last_activity.rb index 372c803278d..a394ef9a2b8 100644 --- a/app/controllers/concerns/record_user_last_activity.rb +++ b/app/controllers/concerns/record_user_last_activity.rb @@ -6,7 +6,7 @@ # for any authenticated GET request. The DB update will only happen once per day. # # In order to determine if you should include this concern or not, please check the -# description and discussion on this issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/54947 +# description and discussion on this issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/54947 module RecordUserLastActivity include CookiesHelper extend ActiveSupport::Concern diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb index 912036da0ea..d34a07324da 100644 --- a/app/controllers/dashboard/milestones_controller.rb +++ b/app/controllers/dashboard/milestones_controller.rb @@ -28,7 +28,7 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController DashboardGroupMilestone.build_collection(groups, params) end - # See [#39545](https://gitlab.com/gitlab-org/gitlab-ce/issues/39545) for info about the deprecation of dynamic milestones + # See [#39545](https://gitlab.com/gitlab-org/gitlab-foss/issues/39545) for info about the deprecation of dynamic milestones def dynamic_milestones DashboardMilestone.build_collection(@projects, params) end diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 6457732dff0..9659d7719b9 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -55,7 +55,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController end def render_projects - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40260 + # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/40260 Gitlab::GitalyClient.allow_n_plus_1_calls do render end diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 940d1482611..7012bfcefe3 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -84,7 +84,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController end def todos_page_count(todos) - if todo_params.except(:sort, :page).empty? # rubocop: disable CodeReuse/ActiveRecord + if todo_params.except(:sort, :page).empty? (current_user.todos_pending_count.to_f / todos.limit_value).ceil else todos.total_pages diff --git a/app/controllers/groups/runners_controller.rb b/app/controllers/groups/runners_controller.rb index af2b2cbd1fd..635c248024e 100644 --- a/app/controllers/groups/runners_controller.rb +++ b/app/controllers/groups/runners_controller.rb @@ -2,7 +2,7 @@ class Groups::RunnersController < Groups::ApplicationController # Proper policies should be implemented per - # https://gitlab.com/gitlab-org/gitlab-ce/issues/45894 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/45894 before_action :authorize_admin_group! before_action :runner, only: [:edit, :update, :destroy, :pause, :resume, :show] diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index 1cea0299fb2..72f830fc9a1 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -29,7 +29,7 @@ class Import::GithubController < Import::BaseController def status # Request repos to display error page if provider token is invalid - # Improving in https://gitlab.com/gitlab-org/gitlab-ce/issues/55585 + # Improving in https://gitlab.com/gitlab-org/gitlab-foss/issues/55585 client_repos respond_to do |format| diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb index 89889141be6..c9c487cec26 100644 --- a/app/controllers/import/gitlab_projects_controller.rb +++ b/app/controllers/import/gitlab_projects_controller.rb @@ -49,6 +49,6 @@ class Import::GitlabProjectsController < Import::BaseController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42437') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42437') end end diff --git a/app/controllers/import/manifest_controller.rb b/app/controllers/import/manifest_controller.rb index 320cd45b925..7ba8b3ce938 100644 --- a/app/controllers/import/manifest_controller.rb +++ b/app/controllers/import/manifest_controller.rb @@ -96,6 +96,6 @@ class Import::ManifestController < Import::BaseController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/48939') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/48939') end end diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 4125f44d00a..7c3d43fb49a 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -95,7 +95,7 @@ class Projects::BlobController < Projects::ApplicationController @form = Blobs::UnfoldPresenter.new(blob, diff_params) # keep only json rendering when - # https://gitlab.com/gitlab-org/gitlab-ce/issues/44988 is done + # https://gitlab.com/gitlab-org/gitlab-foss/issues/44988 is done if rendered_for_merge_request? render json: DiffLineSerializer.new.represent(@form.diff_lines) else diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index e7bdb4b2042..c125ed3605a 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -25,7 +25,7 @@ class Projects::BranchesController < Projects::ApplicationController @refs_pipelines = @project.ci_pipelines.latest_successful_for_refs(@branches.map(&:name)) @merged_branch_names = repository.merged_branch_names(@branches.map(&:name)) - # https://gitlab.com/gitlab-org/gitlab-ce/issues/48097 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/48097 Gitlab::GitalyClient.allow_n_plus_1_calls do render end diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 98cd66cf6f9..079d30127d6 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -24,3 +24,5 @@ class Projects::ClustersController < Clusters::ClustersController @repository ||= project.repository end end + +Projects::ClustersController.prepend_if_ee('EE::Projects::ClustersController') diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb index f540ccee386..76705b4410c 100644 --- a/app/controllers/projects/commits_controller.rb +++ b/app/controllers/projects/commits_controller.rb @@ -77,6 +77,6 @@ class Projects::CommitsController < Projects::ApplicationController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42330') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42330') end end diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb index 3b0abecf2c9..b9d7dbd37be 100644 --- a/app/controllers/projects/cycle_analytics_controller.rb +++ b/app/controllers/projects/cycle_analytics_controller.rb @@ -42,6 +42,6 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42671') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42671') end end diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 7f776b8b497..64de0e665d3 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -164,7 +164,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController result = dashboard_finder.find( project, current_user, - environment, + environment: environment, dashboard_path: params[:dashboard], **dashboard_params.to_h.symbolize_keys ) @@ -172,13 +172,13 @@ class Projects::EnvironmentsController < Projects::ApplicationController result = dashboard_finder.find( project, current_user, - environment, + environment: environment, dashboard_path: params[:dashboard] ) result[:all_dashboards] = dashboard_finder.find_all_paths(project) else - result = dashboard_finder.find(project, current_user, environment) + result = dashboard_finder.find(project, current_user, environment: environment) end respond_to do |format| diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index 1bb21857dcf..cb6d9c2ba18 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -62,6 +62,6 @@ class Projects::ForksController < Projects::ApplicationController # rubocop: enable CodeReuse/ActiveRecord def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42335') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42335') end end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index a3dcb36aa3b..7a192a9ec2d 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -277,10 +277,10 @@ class Projects::IssuesController < Projects::ApplicationController def whitelist_query_limiting # Also see the following issues: # - # 1. https://gitlab.com/gitlab-org/gitlab-ce/issues/42423 - # 2. https://gitlab.com/gitlab-org/gitlab-ce/issues/42424 - # 3. https://gitlab.com/gitlab-org/gitlab-ce/issues/42426 - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42422') + # 1. https://gitlab.com/gitlab-org/gitlab-foss/issues/42423 + # 2. https://gitlab.com/gitlab-org/gitlab-foss/issues/42424 + # 3. https://gitlab.com/gitlab-org/gitlab-foss/issues/42426 + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42422') end end diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index c83d4e307a7..0fdd4d4f33d 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -96,7 +96,7 @@ class Projects::JobsController < Projects::ApplicationController end def json_trace - # will be implemented with https://gitlab.com/gitlab-org/gitlab-ce/issues/66454 + # will be implemented with https://gitlab.com/gitlab-org/gitlab-foss/issues/66454 end def retry diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb index 6ac5bb90706..808265634da 100644 --- a/app/controllers/projects/merge_requests/creations_controller.rb +++ b/app/controllers/projects/merge_requests/creations_controller.rb @@ -12,7 +12,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap before_action :build_merge_request, except: [:create] def new - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40934 + # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/40934 Gitlab::GitalyClient.allow_n_plus_1_calls do define_new_vars end @@ -92,7 +92,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap def build_merge_request params[:merge_request] ||= ActionController::Parameters.new(source_project: @project) - # Gitaly N+1 issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/58096 + # Gitaly N+1 issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/58096 Gitlab::GitalyClient.allow_n_plus_1_calls do @merge_request = ::MergeRequests::BuildService.new(project, current_user, merge_request_params.merge(diff_options: diff_options)).execute end @@ -135,7 +135,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap # rubocop: enable CodeReuse/ActiveRecord def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42384') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42384') end def incr_count_webide_merge_request diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index af87e04f9c8..e51ce752233 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -276,7 +276,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo if auto_merge_requested? if merge_request.auto_merge_enabled? # TODO: We should have a dedicated endpoint for updating merge params. - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/63130. + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/63130. AutoMergeService.new(project, current_user, merge_params).update(merge_request) else AutoMergeService.new(project, current_user, merge_params) @@ -328,8 +328,8 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo end def whitelist_query_limiting - # Also see https://gitlab.com/gitlab-org/gitlab-ce/issues/42441 - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42438') + # Also see https://gitlab.com/gitlab-org/gitlab-foss/issues/42441 + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42438') end def reports_response(report_comparison) diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb index 6543711ecfa..47788438da9 100644 --- a/app/controllers/projects/network_controller.rb +++ b/app/controllers/projects/network_controller.rb @@ -41,6 +41,6 @@ class Projects::NetworkController < Projects::ApplicationController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42333') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42333') end end diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 13e8453ed00..c0b8c9e550d 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -86,6 +86,6 @@ class Projects::NotesController < Projects::ApplicationController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42383') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42383') end end diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 477ba36e9d1..cfa46705483 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -204,8 +204,8 @@ class Projects::PipelinesController < Projects::ApplicationController end def whitelist_query_limiting - # Also see https://gitlab.com/gitlab-org/gitlab-ce/issues/42343 - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42339') + # Also see https://gitlab.com/gitlab-org/gitlab-foss/issues/42343 + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42339') end def authorize_update_pipeline! diff --git a/app/controllers/projects/templates_controller.rb b/app/controllers/projects/templates_controller.rb index f987033a26c..95739f96d39 100644 --- a/app/controllers/projects/templates_controller.rb +++ b/app/controllers/projects/templates_controller.rb @@ -13,6 +13,14 @@ class Projects::TemplatesController < Projects::ApplicationController end end + def names + templates = @template_type.dropdown_names(project) + + respond_to do |format| + format.json { render json: templates } + end + end + private # User must have: diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a6ed783b433..b8beecf823c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -457,7 +457,7 @@ class ProjectsController < Projects::ApplicationController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42440') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42440') end def present_project diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index a973ed23da9..2e4c6a801b0 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -124,7 +124,7 @@ class RegistrationsController < Devise::RegistrationsController end def whitelist_query_limiting - Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42380') + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42380') end def ensure_terms_accepted diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 310ae17abbf..5b06f4f4b51 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -15,7 +15,7 @@ class RootController < Dashboard::ProjectsController before_action :redirect_logged_user, if: -> { current_user.present? } def index - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40260 + # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/40260 Gitlab::GitalyClient.allow_n_plus_1_calls do super end diff --git a/app/finders/environments_finder.rb b/app/finders/environments_finder.rb index 29c00e4b2c2..d4e803beb4e 100644 --- a/app/finders/environments_finder.rb +++ b/app/finders/environments_finder.rb @@ -51,7 +51,7 @@ class EnvironmentsFinder # efficient way to get relevant environment entries. # Currently, `#execute` method has a serious technical debt and # we will likely rework on it in the future. - # See more https://gitlab.com/gitlab-org/gitlab-ce/issues/63381 + # See more https://gitlab.com/gitlab-org/gitlab-foss/issues/63381 def find environments = project.environments environments = by_name(environments) diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb index ed6d20b9585..427fd3e7d85 100644 --- a/app/finders/todos_finder.rb +++ b/app/finders/todos_finder.rb @@ -47,11 +47,12 @@ class TodosFinder sort(items) end - # Returns `true` if the current user has any todos for the given target. + # Returns `true` if the current user has any todos for the given target with the optional given state. # # target - The value of the `target_type` column, such as `Issue`. - def any_for_target?(target) - current_user.todos.any_for_target?(target) + # state - The value of the `state` column, such as `pending` or `done`. + def any_for_target?(target, state = nil) + current_user.todos.any_for_target?(target, state) end private diff --git a/app/graphql/resolvers/full_path_resolver.rb b/app/graphql/resolvers/full_path_resolver.rb index 2afd0411ea6..46d3360baae 100644 --- a/app/graphql/resolvers/full_path_resolver.rb +++ b/app/graphql/resolvers/full_path_resolver.rb @@ -7,7 +7,7 @@ module Resolvers prepended do argument :full_path, GraphQL::ID_TYPE, required: true, - description: 'The full path of the project, group or namespace, e.g., "gitlab-org/gitlab-ce"' + description: 'The full path of the project, group or namespace, e.g., "gitlab-org/gitlab-foss"' end def model_by_full_path(model, full_path) diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index 4e71a7a9ead..850df2885aa 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -50,7 +50,7 @@ module Resolvers return Issue.none if project.nil? # Will need to be be made group & namespace aware with - # https://gitlab.com/gitlab-org/gitlab-ce/issues/54520 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/54520 args[:project_id] = project.id args[:iids] ||= [args[:iid]].compact diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 9a1a2b3a79c..8c5be1c315d 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -184,10 +184,10 @@ module ApplicationSettingsHelper :disabled_oauth_sign_in_sources, :domain_blacklist, :domain_blacklist_enabled, - # TODO Remove domain_blacklist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-ce/issues/67204) + # TODO Remove domain_blacklist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-foss/issues/67204) :domain_blacklist_raw, :domain_whitelist, - # TODO Remove domain_whitelist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-ce/issues/67204) + # TODO Remove domain_whitelist_raw in APIv5 (See https://gitlab.com/gitlab-org/gitlab-foss/issues/67204) :domain_whitelist_raw, :outbound_local_requests_whitelist_raw, :dsa_key_restriction, diff --git a/app/helpers/boards_helper.rb b/app/helpers/boards_helper.rb index d3950219f3f..3f0679f9bf9 100644 --- a/app/helpers/boards_helper.rb +++ b/app/helpers/boards_helper.rb @@ -88,7 +88,7 @@ module BoardsHelper end def boards_link_text - if current_board_parent.multiple_issue_boards_available? + if multiple_boards_available? s_("IssueBoards|Boards") else s_("IssueBoards|Board") diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 32431959851..7f3e78f3a81 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -189,11 +189,9 @@ module DiffHelper params[:w] == '1' end - # rubocop: disable CodeReuse/ActiveRecord def params_with_whitespace hide_whitespace? ? request.query_parameters.except(:w) : request.query_parameters.merge(w: 1) end - # rubocop: enable CodeReuse/ActiveRecord def toggle_whitespace_link(url, options) options[:class] = [*options[:class], 'btn btn-default'].join(' ') diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb index ee4991c0b53..c244eba9e08 100644 --- a/app/helpers/emails_helper.rb +++ b/app/helpers/emails_helper.rb @@ -102,7 +102,7 @@ module EmailsHelper end when String # Technically speaking this should be Commit but per - # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15610#note_163812339 + # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/15610#note_163812339 # we can't deserialize Commit without custom serializer for ActiveJob return "" unless Ability.allowed?(@recipient, :download_code, @project) diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 014523b54cb..24614b5030c 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -272,7 +272,7 @@ module IssuablesHelper markdownPreviewPath: preview_markdown_path(parent), markdownDocsPath: help_page_path('user/markdown'), lockVersion: issuable.lock_version, - issuableTemplates: issuable_templates(issuable), + issuableTemplateNamesPath: template_names_path(parent, issuable), initialTitleHtml: markdown_field(issuable, :title), initialTitleText: issuable.title, initialDescriptionHtml: markdown_field(issuable, :description), @@ -429,6 +429,12 @@ module IssuablesHelper end end + def template_names_path(parent, issuable) + return '' unless parent.is_a?(Project) + + project_template_names_path(parent, template_type: issuable.class.name.underscore) + end + def issuable_sidebar_options(issuable) { endpoint: "#{issuable[:issuable_json_path]}?serializer=sidebar_extras", diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5ed95311767..bf6abdb8c4b 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -235,7 +235,6 @@ module ProjectsHelper # # If no limit is applied we'll just issue a COUNT since the result set could # be too large to load into memory. - # rubocop: disable CodeReuse/ActiveRecord def any_projects?(projects) return projects.any? if projects.is_a?(Array) @@ -245,10 +244,9 @@ module ProjectsHelper projects.except(:offset).any? end end - # rubocop: enable CodeReuse/ActiveRecord # TODO: Remove this method when removing the feature flag - # https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/11209#note_162234863 + # https://gitlab.com/gitlab-org/gitlab/merge_requests/11209#note_162234863 # make sure to remove from the EE specific controller as well: ee/app/controllers/ee/dashboard/projects_controller.rb def show_projects?(projects, params) Feature.enabled?(:project_list_filter_bar) || !!(params[:personal] || params[:name] || any_projects?(projects)) diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb index d7a509e2bd3..d871aaa9c86 100644 --- a/app/helpers/runners_helper.rb +++ b/app/helpers/runners_helper.rb @@ -30,7 +30,7 @@ module RunnersHelper end # Due to inability of performing sorting of runners by cached "contacted_at" values we have to show uncached values if sorting by "contacted_asc" is requested. - # Please refer to the following issue for more details: https://gitlab.com/gitlab-org/gitlab-ce/issues/55920 + # Please refer to the following issue for more details: https://gitlab.com/gitlab-org/gitlab-foss/issues/55920 def runner_contacted_at(runner) if params[:sort] == 'contacted_asc' runner.uncached_contacted_at diff --git a/app/helpers/safe_params_helper.rb b/app/helpers/safe_params_helper.rb index 18bbf3347a8..72bf1377b02 100644 --- a/app/helpers/safe_params_helper.rb +++ b/app/helpers/safe_params_helper.rb @@ -3,7 +3,6 @@ module SafeParamsHelper # Rails 5.0 requires to permit `params` if they're used in url helpers. # Use this helper when generating links with `params.merge(...)` - # rubocop: disable CodeReuse/ActiveRecord def safe_params if params.respond_to?(:permit!) params.except(:host, :port, :protocol).permit! @@ -11,5 +10,4 @@ module SafeParamsHelper params end end - # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 2393540b04c..1f8a0373450 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -64,7 +64,7 @@ module Ci # `ci_builds` creation. We can look up a relevant `environment` through # `deployment` relation today. This is much more efficient than expanding # environment name with variables. - # (See more https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22380) + # (See more https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/22380) # # However, we have to still expand environment name if it's a stop action, # because `deployment` persists information for start action only. diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 0c331b0b8c9..20b8be4017e 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -373,7 +373,7 @@ module Ci ## # TODO We do not completely switch to persisted stages because of - # race conditions with setting statuses gitlab-ce#23257. + # race conditions with setting statuses gitlab-foss#23257. # def ordered_stages return legacy_stages unless complete? @@ -386,7 +386,7 @@ module Ci end def legacy_stages - # TODO, this needs refactoring, see gitlab-ce#26481. + # TODO, this needs refactoring, see gitlab-foss#26481. stages_query = statuses .group('stage').select(:stage).order('max(stage_idx)') diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb index 50def3ba38c..44c66f06059 100644 --- a/app/models/clusters/applications/ingress.rb +++ b/app/models/clusters/applications/ingress.rb @@ -35,6 +35,10 @@ module Clusters 'stable/nginx-ingress' end + def values + content_values.to_yaml + end + def allowed_to_uninstall? external_ip_or_hostname? && application_jupyter_nil_or_installable? end @@ -67,6 +71,23 @@ module Clusters private + def specification + return {} unless Feature.enabled?(:ingress_modsecurity) + + { + "controller" => { + "config" => { + "enable-modsecurity" => "true", + "enable-owasp-modsecurity-crs" => "true" + } + } + } + end + + def content_values + YAML.load_file(chart_values_file).deep_merge!(specification) + end + def application_jupyter_nil_or_installable? cluster.application_jupyter.nil? || cluster.application_jupyter&.installable? end diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 7a61622b139..6a5b98a4676 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -234,7 +234,7 @@ module Clusters # as the AUTO_DEVOPS_DOMAIN is needed for CI_ENVIRONMENT_URL # # This method should is scheduled to be removed on - # https://gitlab.com/gitlab-org/gitlab-ce/issues/56959 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/56959 def legacy_auto_devops_domain if project_type? project&.auto_devops&.domain.presence || diff --git a/app/models/concerns/avatarable.rb b/app/models/concerns/avatarable.rb index 80278e07e65..269145309fc 100644 --- a/app/models/concerns/avatarable.rb +++ b/app/models/concerns/avatarable.rb @@ -19,7 +19,7 @@ module Avatarable module ShadowMethods def avatar_url(**args) # We use avatar_path instead of overriding avatar_url because of carrierwave. - # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864 + # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/11001/diffs#note_28659864 avatar_path(only_path: args.fetch(:only_path, true), size: args[:size]) || super end diff --git a/app/models/concerns/group_descendant.rb b/app/models/concerns/group_descendant.rb index ed14b73ac1b..7e6a20c27e8 100644 --- a/app/models/concerns/group_descendant.rb +++ b/app/models/concerns/group_descendant.rb @@ -50,7 +50,7 @@ module GroupDescendant child: child.inspect, preloaded: preloaded.map(&:full_path) } - issue_url = 'https://gitlab.com/gitlab-org/gitlab-ce/issues/49404' + issue_url = 'https://gitlab.com/gitlab-org/gitlab-foss/issues/49404' Gitlab::Sentry.track_exception(exception, issue_url: issue_url, extra: extras) end diff --git a/app/models/concerns/issuable_states.rb b/app/models/concerns/issuable_states.rb index b722c541580..33bc41d7f44 100644 --- a/app/models/concerns/issuable_states.rb +++ b/app/models/concerns/issuable_states.rb @@ -6,7 +6,7 @@ module IssuableStates # The state:string column is being migrated to state_id:integer column # This is a temporary hook to populate state_id column with new values # and should be removed after the state column is removed. - # Check https://gitlab.com/gitlab-org/gitlab-ce/issues/51789 for more information + # Check https://gitlab.com/gitlab-org/gitlab-foss/issues/51789 for more information included do before_save :set_state_id end diff --git a/app/models/concerns/label_eventable.rb b/app/models/concerns/label_eventable.rb index d22d93448e4..aad7259f2ad 100644 --- a/app/models/concerns/label_eventable.rb +++ b/app/models/concerns/label_eventable.rb @@ -5,7 +5,7 @@ # Contains functionality related to objects that support adding/removing labels. # # This concern is not used yet, it will be used for: -# https://gitlab.com/gitlab-org/gitlab-ce/issues/48483 +# https://gitlab.com/gitlab-org/gitlab-foss/issues/48483 module LabelEventable extend ActiveSupport::Concern diff --git a/app/models/concerns/reactive_caching.rb b/app/models/concerns/reactive_caching.rb index d91be73d6f0..f9a52cd54bd 100644 --- a/app/models/concerns/reactive_caching.rb +++ b/app/models/concerns/reactive_caching.rb @@ -173,11 +173,7 @@ module ReactiveCaching end def within_reactive_cache_lifetime?(*args) - if Feature.enabled?(:reactive_caching_check_key_exists, default_enabled: true) - Rails.cache.exist?(alive_reactive_cache_key(*args)) - else - !!Rails.cache.read(alive_reactive_cache_key(*args)) - end + Rails.cache.exist?(alive_reactive_cache_key(*args)) end def enqueuing_update(*args) diff --git a/app/models/concerns/relative_positioning.rb b/app/models/concerns/relative_positioning.rb index 6d3c7a7ed68..dfe3c391880 100644 --- a/app/models/concerns/relative_positioning.rb +++ b/app/models/concerns/relative_positioning.rb @@ -225,7 +225,7 @@ module RelativePositioning def calculate_relative_position(calculation) # When calculating across projects, this is much more efficient than # MAX(relative_position) without the GROUP BY, due to index usage: - # https://gitlab.com/gitlab-org/gitlab-ce/issues/54276#note_119340977 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/54276#note_119340977 relation = scoped_items .order(Gitlab::Database.nulls_last_order('position', 'DESC')) .group(self.class.relative_positioning_parent_column) diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb index 57118bf7a6b..bdd87437e2a 100644 --- a/app/models/concerns/routable.rb +++ b/app/models/concerns/routable.rb @@ -29,7 +29,7 @@ module Routable # # Usage: # - # Klass.find_by_full_path('gitlab-org/gitlab-ce') + # Klass.find_by_full_path('gitlab-org/gitlab-foss') # # Returns a single object, or nil. def find_by_full_path(path, follow_redirects: false) @@ -48,7 +48,7 @@ module Routable # # Usage: # - # Klass.where_full_path_in(%w{gitlab-org/gitlab-ce gitlab-org/gitlab-ee}) + # Klass.where_full_path_in(%w{gitlab-org/gitlab-foss gitlab-org/gitlab}) # # Returns an ActiveRecord::Relation. def where_full_path_in(paths) diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index 177004deba6..c5826f58966 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -14,7 +14,7 @@ module ShaAttribute # This only gets executed in non-production environments as an additional check to ensure # the column is the correct type. In production it should behave like any other attribute. - # See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5502 for more discussion + # See https://gitlab.com/gitlab-org/gitlab/merge_requests/5502 for more discussion def validate_binary_column_exists!(name) return unless database_exists? diff --git a/app/models/deployment.rb b/app/models/deployment.rb index bff5d348ca0..db7f9e06362 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -165,7 +165,7 @@ class Deployment < ApplicationRecord def deployed_by # We use deployable's user if available because Ci::PlayBuildService # does not update the deployment's user, just the one for the deployable. - # TODO: use deployment's user once https://gitlab.com/gitlab-org/gitlab-ce/issues/66442 + # TODO: use deployment's user once https://gitlab.com/gitlab-org/gitlab-foss/issues/66442 # is completed. deployable&.user || user end diff --git a/app/models/environment.rb b/app/models/environment.rb index 3d3edcbbe66..fe438b142b2 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -54,7 +54,7 @@ class Environment < ApplicationRecord # Search environments which have names like the given query. # Do not set a large limit unless you've confirmed that it works on gitlab.com scale. scope :for_name_like, -> (query, limit: 5) do - where('name LIKE ?', "#{sanitize_sql_like(query)}%").limit(limit) + where(arel_table[:name].matches("#{sanitize_sql_like query}%")).limit(limit) end scope :for_project, -> (project) { where(project_id: project) } diff --git a/app/models/individual_note_discussion.rb b/app/models/individual_note_discussion.rb index d926e39f96e..bdfa6dcc6bd 100644 --- a/app/models/individual_note_discussion.rb +++ b/app/models/individual_note_discussion.rb @@ -20,7 +20,7 @@ class IndividualNoteDiscussion < Discussion def convert_to_discussion!(save: false) first_note.becomes!(Discussion.note_class).to_discussion.tap do # Save needs to be called on first_note instead of the transformed note - # because of https://gitlab.com/gitlab-org/gitlab-ce/issues/57324 + # because of https://gitlab.com/gitlab-org/gitlab-foss/issues/57324 first_note.save if save end end diff --git a/app/models/label.rb b/app/models/label.rb index ea200b4937a..dbb96a2b9da 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -215,8 +215,8 @@ class Label < ApplicationRecord # # Label.first.to_reference # => "~1" # Label.first.to_reference(format: :name) # => "~\"bug\"" - # Label.first.to_reference(project, target_project: same_namespace_project) # => "gitlab-ce~1" - # Label.first.to_reference(project, target_project: another_namespace_project) # => "gitlab-org/gitlab-ce~1" + # Label.first.to_reference(project, target_project: same_namespace_project) # => "gitlab-foss~1" + # Label.first.to_reference(project, target_project: another_namespace_project) # => "gitlab-org/gitlab-foss~1" # # Returns a String # diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index ac26d29ad19..63133ca285b 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -233,7 +233,7 @@ class MergeRequest < ApplicationRecord # Use this method whenever you need to make sure the head_pipeline is synced with the # branch head commit, for example checking if a merge request can be merged. - # For more information check: https://gitlab.com/gitlab-org/gitlab-ce/issues/40004 + # For more information check: https://gitlab.com/gitlab-org/gitlab-foss/issues/40004 def actual_head_pipeline head_pipeline&.matches_sha_or_source_sha?(diff_head_sha) ? head_pipeline : nil end @@ -691,7 +691,7 @@ class MergeRequest < ApplicationRecord def create_merge_request_diff fetch_ref! - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37435 + # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/37435 Gitlab::GitalyClient.allow_n_plus_1_calls do merge_request_diffs.create! reload_merge_request_diff @@ -1389,7 +1389,7 @@ class MergeRequest < ApplicationRecord end # TODO: remove once production database rename completes - # https://gitlab.com/gitlab-org/gitlab-ce/issues/47592 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/47592 alias_attribute :allow_collaboration, :allow_maintainer_to_push def allow_collaboration diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 4db2b7a74e5..8b5f10ce159 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -301,7 +301,7 @@ class MergeRequestDiff < ApplicationRecord if without_files? && comparison = diff_refs&.compare_in(project) # It should fetch the repository when diffs are cleaned by the system. # We don't keep these for storage overload purposes. - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/37639 + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/37639 comparison.diffs(diff_options) else diffs_collection(diff_options) @@ -357,7 +357,7 @@ class MergeRequestDiff < ApplicationRecord # use factories that rely on current code with an old schema. Without these # `has_attribute?` guards, they fail with a `MissingAttributeError`. # - # For more details, see: https://gitlab.com/gitlab-org/gitlab-ce/issues/44990 + # For more details, see: https://gitlab.com/gitlab-org/gitlab-foss/issues/44990 def write_uploader(column, identifier) carrierwave_write_uploader(column, identifier) if has_attribute?(column) diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 800c492e8e2..916c11a8d03 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -215,8 +215,8 @@ class Milestone < ApplicationRecord # # Milestone.first.to_reference # => "%1" # Milestone.first.to_reference(format: :name) # => "%\"goal\"" - # Milestone.first.to_reference(cross_namespace_project) # => "gitlab-org/gitlab-ce%1" - # Milestone.first.to_reference(same_namespace_project) # => "gitlab-ce%1" + # Milestone.first.to_reference(cross_namespace_project) # => "gitlab-org/gitlab-foss%1" + # Milestone.first.to_reference(same_namespace_project) # => "gitlab-foss%1" # def to_reference(from = nil, format: :name, full: false) format_reference = milestone_format_reference(format) diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index ecbeb24ee0a..6b5ea0fc3fc 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -40,7 +40,7 @@ module Network # Get commits from repository # def collect_commits - # https://gitlab.com/gitlab-org/gitlab-ce/issues/58013 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/58013 Gitlab::GitalyClient.allow_n_plus_1_calls do find_commits(count_to_display_commit_in_center).map do |commit| # Decorate with app/model/network/commit.rb diff --git a/app/models/note.rb b/app/models/note.rb index 7a62d70ca5d..b1829e71017 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -38,7 +38,7 @@ class Note < ApplicationRecord redact_field :note # Aliases to make application_helper#edited_time_ago_with_tooltip helper work properly with notes. - # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10392/diffs#note_28719102 + # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/10392/diffs#note_28719102 alias_attribute :last_edited_at, :updated_at alias_attribute :last_edited_by, :updated_by diff --git a/app/models/project.rb b/app/models/project.rb index 57f1ca98ee2..7c065db9829 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -784,7 +784,7 @@ class Project < ApplicationRecord if forked? RepositoryForkWorker.perform_async(id) elsif gitlab_project_import? - # Do not retry on Import/Export until https://gitlab.com/gitlab-org/gitlab-ce/issues/26189 is solved. + # Do not retry on Import/Export until https://gitlab.com/gitlab-org/gitlab-foss/issues/26189 is solved. RepositoryImportWorker.set(retry: false).perform_async(self.id) else RepositoryImportWorker.perform_async(self.id) @@ -1316,7 +1316,7 @@ class Project < ApplicationRecord result = self # TODO: Make this go to the fork_network root immeadiatly - # dependant on the discussion in: https://gitlab.com/gitlab-org/gitlab-ce/issues/39769 + # dependant on the discussion in: https://gitlab.com/gitlab-org/gitlab-foss/issues/39769 result = result.fork_source while result&.forked? result || self @@ -1328,7 +1328,7 @@ class Project < ApplicationRecord # network, or it is the base of the fork network. # # TODO: refactor this to get the correct lfs objects when implementing - # https://gitlab.com/gitlab-org/gitlab-ce/issues/39769 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/39769 def all_lfs_objects lfs_storage_project.lfs_objects end @@ -2329,7 +2329,7 @@ class Project < ApplicationRecord Gitlab::SafeRequestStore.fetch("project-#{id}:branch-#{branch_name}:user-#{user.id}:branch_allows_collaboration") do next false if empty_repo? - # Issue for N+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/49322 + # Issue for N+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/49322 Gitlab::GitalyClient.allow_n_plus_1_calls do merge_requests_allowing_collaboration(branch_name).any? do |merge_request| merge_request.can_be_merged_by?(user) diff --git a/app/models/project_services/data_fields.rb b/app/models/project_services/data_fields.rb index 0f5385f8ce2..46136556ade 100644 --- a/app/models/project_services/data_fields.rb +++ b/app/models/project_services/data_fields.rb @@ -5,7 +5,7 @@ module DataFields class_methods do # Provide convenient accessor methods for data fields. - # TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 def data_field(*args) args.each do |arg| self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index c201bd2ea18..3ecd5390d79 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -4,7 +4,7 @@ class IssueTrackerService < Service validate :one_issue_tracker, if: :activated?, on: :manual_change # TODO: we can probably just delegate as part of - # https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 data_field :project_url, :issues_url, :new_issue_url default_value_for :category, 'issue_tracker' @@ -25,7 +25,7 @@ class IssueTrackerService < Service end end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 def title if title_attribute = read_attribute(:title) title_attribute @@ -36,7 +36,7 @@ class IssueTrackerService < Service end end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 def description if description_attribute = read_attribute(:description) description_attribute @@ -49,7 +49,7 @@ class IssueTrackerService < Service def handle_properties # this has been moved from initialize_properties and should be improved - # as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 return unless properties @legacy_properties_data = properties.dup diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 61ae78a0b95..86139c62f68 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -16,10 +16,10 @@ class JiraService < IssueTrackerService # Jira Cloud version is deprecating authentication via username and password. # We should use username/password for Jira Server and email/api_token for Jira Cloud, - # for more information check: https://gitlab.com/gitlab-org/gitlab-ce/issues/49936. + # for more information check: https://gitlab.com/gitlab-org/gitlab-foss/issues/49936. # TODO: we can probably just delegate as part of - # https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 data_field :username, :password, :url, :api_url, :jira_issue_transition_id before_update :reset_password @@ -298,7 +298,7 @@ class JiraService < IssueTrackerService title: title, status: status, icon: { - title: 'GitLab', url16x16: asset_url(Gitlab::Favicon.main, host: gitlab_config.url) + title: 'GitLab', url16x16: asset_url(Gitlab::Favicon.main, host: gitlab_config.base_url) } } } diff --git a/app/models/repository.rb b/app/models/repository.rb index 9d6413c5991..f084a314392 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -260,28 +260,8 @@ class Repository raw_repository.languages(root_ref) end - # Makes sure a commit is kept around when Git garbage collection runs. - # Git GC will delete commits from the repository that are no longer in any - # branches or tags, but we want to keep some of these commits around, for - # example if they have comments or CI builds. - # - # For Geo's sake, pass in multiple shas rather than calling it multiple times, - # to avoid unnecessary syncing. def keep_around(*shas) - shas.each do |sha| - next unless sha.present? && commit_by(oid: sha) - - next if kept_around?(sha) - - # This will still fail if the file is corrupted (e.g. 0 bytes) - raw_repository.write_ref(keep_around_ref_name(sha), sha) - rescue Gitlab::Git::CommandError => ex - Rails.logger.error "Unable to create keep-around reference for repository #{disk_path}: #{ex}" # rubocop:disable Gitlab/RailsLogger - end - end - - def kept_around?(sha) - ref_exists?(keep_around_ref_name(sha)) + Gitlab::Git::KeepAround.execute(self, shas) end def archive_metadata(ref, storage_path, format = "tar.gz", append_sha:, path: nil) @@ -580,7 +560,7 @@ class Repository cache_method :has_visible_content?, fallback: false def avatar - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38327 + # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/38327 Gitlab::GitalyClient.allow_n_plus_1_calls do if tree = file_on_head(:avatar) tree.path @@ -1119,7 +1099,7 @@ class Repository private # TODO Generice finder, later split this on finders by Ref or Oid - # gitlab-org/gitlab-ce#39239 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/39239 def find_commit(oid_or_ref) commit = if oid_or_ref.is_a?(Gitlab::Git::Commit) oid_or_ref @@ -1157,10 +1137,6 @@ class Repository end end - def keep_around_ref_name(sha) - "refs/#{REF_KEEP_AROUND}/#{sha}" - end - def repository_event(event, tags = {}) Gitlab::Metrics.add_event(event, tags) end diff --git a/app/models/resource_label_event.rb b/app/models/resource_label_event.rb index a6aa9ce0e7a..93d0a37d186 100644 --- a/app/models/resource_label_event.rb +++ b/app/models/resource_label_event.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# This model is not used yet, it will be used for: -# https://gitlab.com/gitlab-org/gitlab-ce/issues/48483 class ResourceLabelEvent < ApplicationRecord include Importable include Gitlab::Utils::StrongMemoize diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 273a42e6034..1e84b9fa12e 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -22,7 +22,7 @@ class Snippet < ApplicationRecord redact_field :description # Aliases to make application_helper#edited_time_ago_with_tooltip helper work properly with snippets. - # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10392/diffs#note_28719102 + # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/10392/diffs#note_28719102 alias_attribute :last_edited_at, :updated_at alias_attribute :last_edited_by, :updated_by diff --git a/app/models/todo.rb b/app/models/todo.rb index aefd9d5ef28..6b71845856a 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -89,11 +89,12 @@ class Todo < ApplicationRecord ]) end - # Returns `true` if the current user has any todos for the given target. + # Returns `true` if the current user has any todos for the given target with the optional given state. # # target - The value of the `target_type` column, such as `Issue`. - def any_for_target?(target) - exists?(target: target) + # state - The value of the `state` column, such as `pending` or `done`. + def any_for_target?(target, state = nil) + state.nil? ? exists?(target: target) : exists?(target: target, state: state) end # Updates the state of a relation of todos to the new state. diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb index 772170a6b5b..e9f25d833d0 100644 --- a/app/models/user_callout_enums.rb +++ b/app/models/user_callout_enums.rb @@ -8,7 +8,7 @@ module UserCalloutEnums # extended by EE. # # If you are going to add new items to this hash, check that you're not going - # to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/app/models/ee/user_callout_enums.rb + # to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/ee/user_callout_enums.rb def self.feature_names { gke_cluster_integration: 1, diff --git a/app/policies/project_snippet_policy.rb b/app/policies/project_snippet_policy.rb index 424558be1fe..2a3e4ca174b 100644 --- a/app/policies/project_snippet_policy.rb +++ b/app/policies/project_snippet_policy.rb @@ -12,7 +12,7 @@ class ProjectSnippetPolicy < BasePolicy condition(:is_author) { @user && @subject.author == @user } # We have to check both project feature visibility and a snippet visibility and take the stricter one - # This will be simplified - check https://gitlab.com/gitlab-org/gitlab-ce/issues/27573 + # This will be simplified - check https://gitlab.com/gitlab-org/gitlab-foss/issues/27573 rule { ~can?(:read_project) }.policy do prevent :read_project_snippet prevent :update_project_snippet diff --git a/app/presenters/README.md b/app/presenters/README.md index a4d592b54d6..dc4173a880e 100644 --- a/app/presenters/README.md +++ b/app/presenters/README.md @@ -24,7 +24,7 @@ Presenters should be used for: - Data and logic methods that can be pulled & combined into single methods from view. This can include loops extracted from views too. A good example is - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7073/diffs. + https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/7073/diffs. - Data and logic methods that can be pulled from models. - Simple text output methods: it's ok if the method returns a string, but not a whole DOM element for which we'd need HAML, a view context, helpers etc. diff --git a/app/serializers/README.md b/app/serializers/README.md index bb94745b0b5..93b21786015 100644 --- a/app/serializers/README.md +++ b/app/serializers/README.md @@ -317,9 +317,9 @@ MyObjectSerializer.new.represent(object.present) [grape-entity-readme]: https://github.com/ruby-grape/grape-entity/blob/master/README.md [grape-entity-class]: https://github.com/ruby-grape/grape-entity/blob/master/lib/grape_entity/entity.rb [grape-entity-only]: https://github.com/ruby-grape/grape-entity/blob/master/README.md#returning-only-the-fields-you-want -[presenters-readme]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/presenters/README.md +[presenters-readme]: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/app/presenters/README.md [fluent-interface]: https://en.wikipedia.org/wiki/Fluent_interface [json-schema-gem]: https://github.com/ruby-json-schema/json-schema -[issue-20045]: https://gitlab.com/gitlab-org/gitlab-ce/issues/20045 -[issue-30898]: https://gitlab.com/gitlab-org/gitlab-ce/issues/30898 -[issue-27569]: https://gitlab.com/gitlab-org/gitlab-ce/issues/27569 +[issue-20045]: https://gitlab.com/gitlab-org/gitlab-foss/issues/20045 +[issue-30898]: https://gitlab.com/gitlab-org/gitlab-foss/issues/30898 +[issue-27569]: https://gitlab.com/gitlab-org/gitlab-foss/issues/27569 diff --git a/app/serializers/entity_date_helper.rb b/app/serializers/entity_date_helper.rb index d8f267d7183..7dadf0eb016 100644 --- a/app/serializers/entity_date_helper.rb +++ b/app/serializers/entity_date_helper.rb @@ -55,7 +55,7 @@ module EntityDateHelper is_upcoming = (due_date - Date.today).to_i > 0 time_ago = distance_of_time_in_words(due_date, Date.today) - # https://gitlab.com/gitlab-org/gitlab-ce/issues/49440 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/49440 # # Need to improve the i18n here and do a full translation # of the string instead of piecewise translations. diff --git a/app/serializers/merge_request_poll_cached_widget_entity.rb b/app/serializers/merge_request_poll_cached_widget_entity.rb index 005a3e47bbb..a3186ecbcdf 100644 --- a/app/serializers/merge_request_poll_cached_widget_entity.rb +++ b/app/serializers/merge_request_poll_cached_widget_entity.rb @@ -80,7 +80,7 @@ class MergeRequestPollCachedWidgetEntity < IssuableEntity # Once SchedulePopulateMergeRequestMetricsWithEventsData fully runs, # we can remove this method and just serialize MergeRequest#metrics - # instead. See https://gitlab.com/gitlab-org/gitlab-ce/issues/41587 + # instead. See https://gitlab.com/gitlab-org/gitlab-foss/issues/41587 def build_metrics(merge_request) # There's no need to query and serialize metrics data for merge requests that are not # merged or closed. diff --git a/app/services/access_token_validation_service.rb b/app/services/access_token_validation_service.rb index 40aa9250885..851d862c0cf 100644 --- a/app/services/access_token_validation_service.rb +++ b/app/services/access_token_validation_service.rb @@ -43,7 +43,7 @@ class AccessTokenValidationService # We're comparing each required_scope against all token scopes, which would # take quadratic time. This consideration is irrelevant here because of the # small number of records involved. - # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12300/#note_33689006 + # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/12300/#note_33689006 token_scopes = token.scopes.map(&:to_sym) required_scopes.any? do |scope| diff --git a/app/services/applications/create_service.rb b/app/services/applications/create_service.rb index d71174d1393..500db1e172a 100644 --- a/app/services/applications/create_service.rb +++ b/app/services/applications/create_service.rb @@ -6,7 +6,7 @@ module Applications def initialize(current_user, params) @current_user = current_user - @params = params.except(:ip_address) # rubocop: disable CodeReuse/ActiveRecord + @params = params.except(:ip_address) end # EE would override and use `request` arg diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index 9c210f3a1f5..09a84950755 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -177,7 +177,7 @@ module Auth # We still support legacy pipeline triggers which do not have associated # actor. New permissions model and new triggers are always associated with # an actor. So this should be improved once - # https://gitlab.com/gitlab-org/gitlab-ce/issues/37452 is resolved. + # https://gitlab.com/gitlab-org/gitlab-foss/issues/37452 is resolved. # def build_can_push?(requested_project) # Build can push only to the project from which it originates diff --git a/app/services/ci/archive_trace_service.rb b/app/services/ci/archive_trace_service.rb index 700d78361a4..8fad9e9c869 100644 --- a/app/services/ci/archive_trace_service.rb +++ b/app/services/ci/archive_trace_service.rb @@ -48,7 +48,7 @@ module Ci Gitlab::Sentry .track_exception(error, - issue_url: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/51502', + issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/51502', extra: { job_id: job.id }) end end diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 539576147f3..eb4176035d3 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -94,7 +94,7 @@ module Ci # rubocop: disable CodeReuse/ActiveRecord def auto_cancelable_pipelines - # TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23464 + # TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/23464 if Feature.enabled?(:ci_support_interruptible_pipelines, project, default_enabled: true) project.ci_pipelines .where(ref: pipeline.ref) diff --git a/app/services/ci/pipeline_schedule_service.rb b/app/services/ci/pipeline_schedule_service.rb index ef90d91c936..6028643489d 100644 --- a/app/services/ci/pipeline_schedule_service.rb +++ b/app/services/ci/pipeline_schedule_service.rb @@ -15,7 +15,7 @@ module Ci ensure ## # This is the temporary solution for avoiding the memory bloat. - # See more https://gitlab.com/gitlab-org/gitlab-ce/issues/61955 + # See more https://gitlab.com/gitlab-org/gitlab-foss/issues/61955 GC.start if Feature.enabled?(:ci_pipeline_schedule_force_gc, default_enabled: true) end end diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb index 9f9d12d6cf8..c633cff2822 100644 --- a/app/services/git/branch_hooks_service.rb +++ b/app/services/git/branch_hooks_service.rb @@ -115,7 +115,7 @@ module Git # It's not sufficient to just check for a blank SHA as it's possible for the # branch to be pushed, but for the `post-receive` hook to never run: - # https://gitlab.com/gitlab-org/gitlab-ce/issues/59257 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/59257 def creating_branch? strong_memoize(:creating_branch) do Gitlab::Git.blank_ref?(params[:oldrev]) || diff --git a/app/services/issuable/clone/attributes_rewriter.rb b/app/services/issuable/clone/attributes_rewriter.rb index 3c061d35558..10c89c62bf1 100644 --- a/app/services/issuable/clone/attributes_rewriter.rb +++ b/app/services/issuable/clone/attributes_rewriter.rb @@ -45,11 +45,9 @@ module Issuable original_entity.resource_label_events.find_in_batches do |batch| events = batch.map do |event| entity_key = new_entity.is_a?(Issue) ? 'issue_id' : 'epic_id' - # rubocop: disable CodeReuse/ActiveRecord event.attributes .except('id', 'reference', 'reference_html') .merge(entity_key => new_entity.id, 'action' => ResourceLabelEvent.actions[event.action]) - # rubocop: enable CodeReuse/ActiveRecord end Gitlab::Database.bulk_insert(ResourceLabelEvent.table_name, events) diff --git a/app/services/issuable/common_system_notes_service.rb b/app/services/issuable/common_system_notes_service.rb index 6329ba81e48..a170a4dcae2 100644 --- a/app/services/issuable/common_system_notes_service.rb +++ b/app/services/issuable/common_system_notes_service.rb @@ -41,7 +41,7 @@ module Issuable create_task_status_note else # TODO: Show this note if non-task content was modified. - # https://gitlab.com/gitlab-org/gitlab-ce/issues/33577 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/33577 create_description_change_note end end diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb index 9cbc9fef529..91984403db3 100644 --- a/app/services/labels/transfer_service.rb +++ b/app/services/labels/transfer_service.rb @@ -77,7 +77,7 @@ module Labels # in the project being transferred. # IDs are fetched in a separate query because MySQL doesn't # allow referring of 'label_links' table in UPDATE query: - # https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/62435068 + # https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/62435068 link_ids = labels.pluck('label_links.id') LabelLink.where(id: link_ids, label_id: old_label_id) diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index 9cd6f3959fd..214f145d09b 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -8,7 +8,7 @@ module MergeRequests @params_issue_iid = params.delete(:issue_iid) self.merge_request = MergeRequest.new # TODO: this should handle all quick actions that don't have side effects - # https://gitlab.com/gitlab-org/gitlab-ce/issues/53658 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/53658 merge_quick_actions_into_params!(merge_request, only: [:target_branch]) merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch) if params.has_key?(:force_remove_source_branch) diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index f54642d7bd9..edcfc3bf33f 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -14,7 +14,7 @@ module MergeRequests private def refresh_merge_requests! - # n + 1: https://gitlab.com/gitlab-org/gitlab-ce/issues/60289 + # n + 1: https://gitlab.com/gitlab-org/gitlab-foss/issues/60289 Gitlab::GitalyClient.allow_n_plus_1_calls(&method(:find_new_commits)) # Be sure to close outstanding MRs before reloading them to avoid generating an diff --git a/app/services/metrics/dashboard/base_service.rb b/app/services/metrics/dashboard/base_service.rb index 8a42675c66d..c51c88d776a 100644 --- a/app/services/metrics/dashboard/base_service.rb +++ b/app/services/metrics/dashboard/base_service.rb @@ -7,6 +7,13 @@ module Metrics class BaseService < ::BaseService include Gitlab::Metrics::Dashboard::Errors + STAGES = ::Gitlab::Metrics::Dashboard::Stages + SEQUENCE = [ + STAGES::CommonMetricsInserter, + STAGES::EndpointInserter, + STAGES::Sorter + ].freeze + def get_dashboard return error('Insufficient permissions.', :unauthorized) unless allowed? @@ -31,14 +38,20 @@ module Metrics # Determines whether users should be able to view # dashboards at all. def allowed? - Ability.allowed?(current_user, :read_environment, project) + if params[:environment] + Ability.allowed?(current_user, :read_environment, project) + elsif params[:cluster] + true # Authorization handled at controller level + else + false + end end # Returns a new dashboard Hash, supplemented with DB info def process_dashboard - Gitlab::Metrics::Dashboard::Processor - .new(project, params[:environment], raw_dashboard) - .process(insert_project_metrics: insert_project_metrics?) + ::Gitlab::Metrics::Dashboard::Processor + .new(project, raw_dashboard, sequence, params) + .process end # @return [String] Relative filepath of the dashboard yml @@ -56,12 +69,11 @@ module Metrics raise NotImplementedError end - # Determines whether custom metrics should be included - # in the processed output. - # @return [Boolean] - def insert_project_metrics? - false + def sequence + SEQUENCE end end end end + +Metrics::Dashboard::BaseService.prepend_if_ee('EE::Metrics::Dashboard::BaseService') diff --git a/app/services/metrics/dashboard/system_dashboard_service.rb b/app/services/metrics/dashboard/system_dashboard_service.rb index fcd71aadb03..ccfd9db8746 100644 --- a/app/services/metrics/dashboard/system_dashboard_service.rb +++ b/app/services/metrics/dashboard/system_dashboard_service.rb @@ -8,6 +8,13 @@ module Metrics SYSTEM_DASHBOARD_PATH = 'config/prometheus/common_metrics.yml' SYSTEM_DASHBOARD_NAME = 'Default' + SEQUENCE = [ + STAGES::CommonMetricsInserter, + STAGES::ProjectMetricsInserter, + STAGES::EndpointInserter, + STAGES::Sorter + ].freeze + class << self def all_dashboard_paths(_project) [{ @@ -24,6 +31,10 @@ module Metrics private + def cache_key + "metrics_dashboard_#{dashboard_path}" + end + def dashboard_path SYSTEM_DASHBOARD_PATH end @@ -35,13 +46,11 @@ module Metrics YAML.safe_load(yml) end - def cache_key - "metrics_dashboard_#{dashboard_path}" - end - - def insert_project_metrics? - true + def sequence + SEQUENCE end end end end + +Metrics::Dashboard::SystemDashboardService.prepend_if_ee('EE::Metrics::Dashboard::SystemDashboardService') diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb index c445c816554..782c6bc3e35 100644 --- a/app/services/milestones/update_service.rb +++ b/app/services/milestones/update_service.rb @@ -2,7 +2,6 @@ module Milestones class UpdateService < Milestones::BaseService - # rubocop: disable CodeReuse/ActiveRecord def execute(milestone) state = params[:state_event] @@ -19,7 +18,6 @@ module Milestones milestone end - # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index 248e81080cc..c136803ef3b 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -7,7 +7,7 @@ module Notes note = Notes::BuildService.new(project, current_user, params).execute - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37440 + # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/37440 note_valid = Gitlab::GitalyClient.allow_n_plus_1_calls do note.valid? end diff --git a/app/services/projects/auto_devops/disable_service.rb b/app/services/projects/auto_devops/disable_service.rb index 6608b3da1a8..c90510c581d 100644 --- a/app/services/projects/auto_devops/disable_service.rb +++ b/app/services/projects/auto_devops/disable_service.rb @@ -19,7 +19,7 @@ module Projects # We're using `limit` to optimize `auto_devops pipeline` query, # since we only care about the first element, and using only `.count` # is an expensive operation. See - # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21172#note_99037378 + # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/21172#note_99037378 # for more context. # rubocop: disable CodeReuse/ActiveRecord def first_pipeline_failure? diff --git a/app/services/projects/cleanup_service.rb b/app/services/projects/cleanup_service.rb index 9b4114ff42f..04624b96bf0 100644 --- a/app/services/projects/cleanup_service.rb +++ b/app/services/projects/cleanup_service.rb @@ -68,7 +68,7 @@ module Projects # TODO: ensure the highlight cache is removed immediately. It's too hard # to calculate the Redis keys at present. # - # https://gitlab.com/gitlab-org/gitlab-ce/issues/61115 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/61115 end def cleanup_note_diff_files(old_commit_shas) diff --git a/app/services/projects/container_repository/cleanup_tags_service.rb b/app/services/projects/container_repository/cleanup_tags_service.rb index 488290db824..d1d9b9f22e8 100644 --- a/app/services/projects/container_repository/cleanup_tags_service.rb +++ b/app/services/projects/container_repository/cleanup_tags_service.rb @@ -33,7 +33,7 @@ module Projects end def delete_tag_digest(digest, tags, other_tags) - # Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/21405 + # Issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/21405 # we have to remove all tags due # to Docker Distribution bug unable # to delete single tag diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb index d8fa9d37359..17686b45900 100644 --- a/app/services/projects/fork_service.rb +++ b/app/services/projects/fork_service.rb @@ -27,7 +27,7 @@ module Projects # the database so they'll get cleaned up. # # TODO: refactor this to get the correct lfs objects when implementing - # https://gitlab.com/gitlab-org/gitlab-ce/issues/39769 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/39769 fork_to_project.lfs_objects_projects.delete_all fork_to_project @@ -51,7 +51,8 @@ module Projects # been instantiated to avoid ActiveRecord trying to create it when # initializing the project, as that would cause a foreign key constraint # exception. - relations_block: -> (project) { build_fork_network_member(project) } + relations_block: -> (project) { build_fork_network_member(project) }, + skip_disk_validation: skip_disk_validation } if @project.avatar.present? && @project.avatar.image? @@ -110,6 +111,10 @@ module Projects @target_namespace ||= @params[:namespace] || current_user.namespace end + def skip_disk_validation + @skip_disk_validation ||= @params[:skip_disk_validation] || false + end + def allowed_visibility_level target_level = [@project.visibility_level, target_namespace.visibility_level].min diff --git a/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb b/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb index 4224b56c42c..d6e6480bdad 100644 --- a/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb +++ b/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb @@ -29,7 +29,7 @@ module Projects # Getting all Lfs pointers already in the database and linking them to the project linked_oids = LfsLinkService.new(project).execute(lfs_pointers_in_repository.keys) # Retrieving those oids not present in the database which we need to download - missing_oids = lfs_pointers_in_repository.except(*linked_oids) # rubocop: disable CodeReuse/ActiveRecord + missing_oids = lfs_pointers_in_repository.except(*linked_oids) # Downloading the required information and gathering it inside a LfsDownloadObject for each oid LfsDownloadLinkListService.new(project, remote_uri: current_endpoint_uri).execute(missing_oids) rescue LfsDownloadLinkListService::DownloadLinksError => e diff --git a/app/services/projects/open_issues_count_service.rb b/app/services/projects/open_issues_count_service.rb index bc8f7f342f7..82632d63e5b 100644 --- a/app/services/projects/open_issues_count_service.rb +++ b/app/services/projects/open_issues_count_service.rb @@ -65,7 +65,7 @@ module Projects # We only show total issues count for reporters # which are allowed to view confidential issues # This will still show a discrepancy on issues number but should be less than before. - # Check https://gitlab.com/gitlab-org/gitlab-ce/issues/38418 description. + # Check https://gitlab.com/gitlab-org/gitlab-foss/issues/38418 description. # rubocop: disable CodeReuse/ActiveRecord def self.query(projects, public_only: true) if public_only diff --git a/app/services/projects/propagate_service_template.rb b/app/services/projects/propagate_service_template.rb index 64f9b611c40..6013b00b8c6 100644 --- a/app/services/projects/propagate_service_template.rb +++ b/app/services/projects/propagate_service_template.rb @@ -70,7 +70,6 @@ module Projects ) end - # rubocop: disable CodeReuse/ActiveRecord def service_hash @service_hash ||= begin @@ -84,7 +83,6 @@ module Projects end end end - # rubocop: enable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord def run_callbacks(batch) diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb index 51a6f62e597..2dad1d05a2c 100644 --- a/app/services/projects/update_service.rb +++ b/app/services/projects/update_service.rb @@ -7,7 +7,6 @@ module Projects ValidationError = Class.new(StandardError) - # rubocop: disable CodeReuse/ActiveRecord def execute remove_unallowed_params validate! @@ -31,7 +30,6 @@ module Projects rescue ValidationError => e error(e.message) end - # rubocop: enable CodeReuse/ActiveRecord def run_auto_devops_pipeline? return false if project.repository.gitlab_ci_yml || !project.auto_devops&.previous_changes&.include?('enabled') diff --git a/app/services/releases/update_service.rb b/app/services/releases/update_service.rb index 7aa51c4a332..6ba8dac21f0 100644 --- a/app/services/releases/update_service.rb +++ b/app/services/releases/update_service.rb @@ -26,10 +26,8 @@ module Releases Ability.allowed?(current_user, :update_release, release) end - # rubocop: disable CodeReuse/ActiveRecord def empty_params? params.except(:tag).empty? end - # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index ad8acb26a2d..c01094bd689 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -242,7 +242,7 @@ module SystemNoteService ## # TODO: Abort message should be sent by the system, not a particular user. - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/63187. + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/63187. create_note(NoteSummary.new(noteable, project, author, body, action: 'merge')) end diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index b1b0fb641df..2299a02fea1 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -191,7 +191,7 @@ class TodoService end def todo_exist?(issuable, current_user) - TodosFinder.new(current_user).any_for_target?(issuable) + TodosFinder.new(current_user).any_for_target?(issuable, :pending) end private diff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rb index eea5ff6e5db..422c8ed6575 100644 --- a/app/services/users/update_service.rb +++ b/app/services/users/update_service.rb @@ -57,7 +57,7 @@ module Users params.reject! { |key, _| read_only.include?(key.to_sym) } end - @user.assign_attributes(params.except(*identity_attributes)) unless params.empty? # rubocop: disable CodeReuse/ActiveRecord + @user.assign_attributes(params.except(*identity_attributes)) unless params.empty? end def assign_identity diff --git a/app/validators/addressable_url_validator.rb b/app/validators/addressable_url_validator.rb index f292730441c..300bd01ed22 100644 --- a/app/validators/addressable_url_validator.rb +++ b/app/validators/addressable_url_validator.rb @@ -46,7 +46,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator # when saving/updating a record. Sometimes, the url # is not resolvable at that point, and some automated # tasks that uses that url won't work. - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/66723 + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/66723 BLOCKER_VALIDATE_OPTIONS = { schemes: %w(http https), ports: [], @@ -112,7 +112,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator # when Gitlab::CurrentSettings creates an ApplicationSetting which then # calls this validator. # - # See https://gitlab.com/gitlab-org/gitlab-ee/issues/9833 + # See https://gitlab.com/gitlab-org/gitlab/issues/9833 ApplicationSetting.current&.allow_local_requests_from_web_hooks_and_services? end end diff --git a/app/views/groups/runners/_group_runners.html.haml b/app/views/groups/runners/_group_runners.html.haml index 806a24e2bbc..fd40ec5a984 100644 --- a/app/views/groups/runners/_group_runners.html.haml +++ b/app/views/groups/runners/_group_runners.html.haml @@ -8,7 +8,7 @@ = _('They can be managed using the %{link}.').html_safe % { link: link } -# Proper policies should be implemented per --# https://gitlab.com/gitlab-org/gitlab-ce/issues/45894 +-# https://gitlab.com/gitlab-org/gitlab-foss/issues/45894 - if can?(current_user, :admin_pipeline, @group) = render partial: 'ci/runner/how_to_setup_runner', locals: { registration_token: @group.runners_token, diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 443a73f5cce..6cdb85456c3 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -17,4 +17,6 @@ %div{ class: "#{(container_class unless @no_container)} #{@content_class}" } .content{ id: "content-body" } = render "layouts/flash", extra_flash_class: 'limit-container-width' + - if Gitlab.com? + = render_if_exists "layouts/privacy_policy_update_callout" = yield diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index ff0c5b241b2..7b0824ae2af 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -1,5 +1,5 @@ -# WAIT! Before adding more items to the nav bar, please see --# https://gitlab.com/gitlab-org/gitlab-ce/issues/49713 for more information. +-# https://gitlab.com/gitlab-org/gitlab-foss/issues/49713 for more information. %ul.list-unstyled.navbar-sub-nav - if dashboard_nav_link?(:projects) = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: { id: 'nav-projects-dropdown', class: "home dropdown header-projects qa-projects-dropdown", data: { track_label: "projects_dropdown", track_event: "click_dropdown", track_value: "" } }) do diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index ffb90bbd354..0576f51fa83 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -72,7 +72,7 @@ %p= s_("Profiles|You can set your current timezone here") .col-lg-8 -# TODO: might need an entry in user/profile.md to describe some of these settings - -# https://gitlab.com/gitlab-org/gitlab-ce/issues/60070 + -# https://gitlab.com/gitlab-org/gitlab-foss/issues/60070 %h5= ("Time zone") = dropdown_tag(_("Select a timezone"), options: { toggle_class: 'btn js-timezone-dropdown input-lg', title: _("Select a timezone"), filter: true, placeholder: s_("OfSearchInADropdown|Filter"), data: { data: timezone_data } } ) %input.hidden{ :type => 'hidden', :id => 'user_timezone', :name => 'user[timezone]', value: @user.timezone } diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml index 56995ffbcee..8c3518e3a29 100644 --- a/app/views/projects/pipelines/_with_tabs.html.haml +++ b/app/views/projects/pipelines/_with_tabs.html.haml @@ -15,7 +15,7 @@ = render_if_exists "projects/pipelines/tabs_holder", pipeline: @pipeline, project: @project .tab-content - #js-tab-pipeline.tab-pane + #js-tab-pipeline.tab-pane.position-absolute.position-left-0.w-100 #js-pipeline-graph-vue #js-tab-builds.tab-pane diff --git a/app/views/shared/_promo.html.haml b/app/views/shared/_promo.html.haml index 09edf4000d5..0f31b60d8d3 100644 --- a/app/views/shared/_promo.html.haml +++ b/app/views/shared/_promo.html.haml @@ -2,4 +2,4 @@ = link_to 'Homepage', promo_url = link_to 'Blog', promo_url + '/blog/' = link_to '@gitlab', 'https://twitter.com/gitlab' - = link_to 'Requests', 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#feature-proposals' + = link_to 'Requests', 'https://gitlab.com/gitlab-org/gitlab-foss/blob/master/CONTRIBUTING.md#feature-proposals' diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index c9458475aa5..de994250649 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -6,7 +6,7 @@ .issues-filters{ class: ("w-100" if type == :boards_modal) } .issues-details-filters.filtered-search-block.d-flex.flex-column.flex-md-row{ class: block_css_class, "v-pre" => type == :boards_modal } - - if type == :boards + - if type == :boards && (multiple_boards_available? || current_board_parent.boards.size > 1) = render "shared/boards/switcher", board: board = form_tag page_filter_path, method: :get, class: 'filter-form js-filter-form w-100' do - if params[:search].present? diff --git a/app/workers/ci/archive_traces_cron_worker.rb b/app/workers/ci/archive_traces_cron_worker.rb index ef2da729705..ad7a29719ac 100644 --- a/app/workers/ci/archive_traces_cron_worker.rb +++ b/app/workers/ci/archive_traces_cron_worker.rb @@ -9,7 +9,7 @@ module Ci def perform # Archive stale live traces which still resides in redis or database # This could happen when ArchiveTraceWorker sidekiq jobs were lost by receiving SIGKILL - # More details in https://gitlab.com/gitlab-org/gitlab-ce/issues/36791 + # More details in https://gitlab.com/gitlab-org/gitlab-foss/issues/36791 Ci::Build.with_stale_live_trace.find_each(batch_size: 100) do |build| Ci::ArchiveTraceService.new.execute(build, worker_name: self.class.name) end diff --git a/app/workers/cluster_configure_worker.rb b/app/workers/cluster_configure_worker.rb index b0e551d4e03..e7a4797e68e 100644 --- a/app/workers/cluster_configure_worker.rb +++ b/app/workers/cluster_configure_worker.rb @@ -5,6 +5,6 @@ class ClusterConfigureWorker include ClusterQueue def perform(cluster_id) - # Scheduled for removal in https://gitlab.com/gitlab-org/gitlab-ce/issues/59319 + # Scheduled for removal in https://gitlab.com/gitlab-org/gitlab-foss/issues/59319 end end diff --git a/app/workers/cluster_project_configure_worker.rb b/app/workers/cluster_project_configure_worker.rb index 8f48eca4d86..ad2437a77e9 100644 --- a/app/workers/cluster_project_configure_worker.rb +++ b/app/workers/cluster_project_configure_worker.rb @@ -5,6 +5,6 @@ class ClusterProjectConfigureWorker include ClusterQueue def perform(project_id) - # Scheduled for removal in https://gitlab.com/gitlab-org/gitlab-ce/issues/59319 + # Scheduled for removal in https://gitlab.com/gitlab-org/gitlab-foss/issues/59319 end end diff --git a/app/workers/namespaces/schedule_aggregation_worker.rb b/app/workers/namespaces/schedule_aggregation_worker.rb index 983ce4bef4a..b7d580220d6 100644 --- a/app/workers/namespaces/schedule_aggregation_worker.rb +++ b/app/workers/namespaces/schedule_aggregation_worker.rb @@ -27,7 +27,7 @@ module Namespaces # # The migration and specs fails since NamespaceAggregationSchedule table # does not exist at that point. - # https://gitlab.com/gitlab-org/gitlab-ce/issues/50712 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/50712 def aggregation_schedules_table_exists? return true unless Rails.env.test? diff --git a/app/workers/run_pipeline_schedule_worker.rb b/app/workers/run_pipeline_schedule_worker.rb index 351850e53cb..659f8b80397 100644 --- a/app/workers/run_pipeline_schedule_worker.rb +++ b/app/workers/run_pipeline_schedule_worker.rb @@ -39,7 +39,7 @@ class RunPipelineScheduleWorker Gitlab::Sentry .track_exception(error, - issue_url: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/41231', + issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/41231', extra: { schedule_id: schedule.id }) end # rubocop:enable Gitlab/RailsLogger |