Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-16 15:07:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-16 15:07:22 +0300
commit77ded523f119396c72e4bcbcd008ff6b84134ef4 (patch)
treef9fc698ab476ab8b0e1d0b879ebc48560583fce3 /app
parent34a59635a9f25499193aa71a2cae3581f9892cbb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/diffs/components/merge_conflict_warning.vue62
-rw-r--r--app/assets/javascripts/main.js2
-rw-r--r--app/assets/javascripts/pages/shared/nav/sidebar_tracking.js44
-rw-r--r--app/finders/projects_finder.rb6
-rw-r--r--app/models/event.rb25
-rw-r--r--app/models/project.rb2
-rw-r--r--app/models/user.rb2
7 files changed, 25 insertions, 118 deletions
diff --git a/app/assets/javascripts/diffs/components/merge_conflict_warning.vue b/app/assets/javascripts/diffs/components/merge_conflict_warning.vue
deleted file mode 100644
index 6cb1ed4cbcf..00000000000
--- a/app/assets/javascripts/diffs/components/merge_conflict_warning.vue
+++ /dev/null
@@ -1,62 +0,0 @@
-<script>
-import { GlButton, GlAlert, GlModalDirective } from '@gitlab/ui';
-
-export default {
- components: {
- GlAlert,
- GlButton,
- },
- directives: {
- GlModalDirective,
- },
- props: {
- mergeable: {
- type: Boolean,
- required: true,
- },
- resolutionPath: {
- type: String,
- required: true,
- },
- },
-};
-</script>
-
-<template>
- <div>
- <gl-alert
- :dismissible="false"
- :title="__('There are merge conflicts')"
- variant="warning"
- class="gl-mb-5"
- >
- <p class="gl-mb-2">
- {{ __('The comparison view may be inaccurate due to merge conflicts.') }}
- </p>
- <p class="gl-mb-0">
- {{
- __(
- 'Resolve these conflicts, or ask someone with write access to this repository to resolve them locally.',
- )
- }}
- </p>
- <template #actions>
- <gl-button
- v-if="resolutionPath"
- :href="resolutionPath"
- variant="confirm"
- class="gl-mr-3 gl-alert-action"
- >
- {{ __('Resolve conflicts') }}
- </gl-button>
- <gl-button
- v-if="mergeable"
- v-gl-modal-directive="'modal-merge-info'"
- class="gl-alert-action"
- >
- {{ __('Resolve locally') }}
- </gl-button>
- </template>
- </gl-alert>
- </div>
-</template>
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 29189e3ac2f..b41f306eabd 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -28,7 +28,6 @@ import initLogoAnimation from './logo';
import initBreadcrumbs from './breadcrumb';
import initPersistentUserCallouts from './persistent_user_callouts';
import { initUserTracking, initDefaultTrackers } from './tracking';
-import { initSidebarTracking } from './pages/shared/nav/sidebar_tracking';
import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
import initBroadcastNotifications from './broadcast_notification';
@@ -96,7 +95,6 @@ function deferredInitialisation() {
initBroadcastNotifications();
initPersistentUserCallouts();
initDefaultTrackers();
- initSidebarTracking();
initFeatureHighlight();
initCopyCodeButton();
initGitlabVersionCheck();
diff --git a/app/assets/javascripts/pages/shared/nav/sidebar_tracking.js b/app/assets/javascripts/pages/shared/nav/sidebar_tracking.js
deleted file mode 100644
index 47aae36ecbb..00000000000
--- a/app/assets/javascripts/pages/shared/nav/sidebar_tracking.js
+++ /dev/null
@@ -1,44 +0,0 @@
-function onSidebarLinkClick() {
- const setDataTrackAction = (element, action) => {
- element.dataset.trackAction = action;
- };
-
- const setDataTrackExtra = (element, value) => {
- const SIDEBAR_COLLAPSED = 'Collapsed';
- const SIDEBAR_EXPANDED = 'Expanded';
- const sidebarCollapsed = document
- .querySelector('.nav-sidebar')
- .classList.contains('js-sidebar-collapsed')
- ? SIDEBAR_COLLAPSED
- : SIDEBAR_EXPANDED;
-
- element.dataset.trackExtra = JSON.stringify({
- sidebar_display: sidebarCollapsed,
- menu_display: value,
- });
- };
-
- const EXPANDED = 'Expanded';
- const FLY_OUT = 'Fly out';
- const CLICK_MENU_ACTION = 'click_menu';
- const CLICK_MENU_ITEM_ACTION = 'click_menu_item';
- const parentElement = this.parentNode;
- const subMenuList = parentElement.closest('.sidebar-sub-level-items');
-
- if (subMenuList) {
- const isFlyOut = subMenuList.classList.contains('fly-out-list') ? FLY_OUT : EXPANDED;
-
- setDataTrackExtra(parentElement, isFlyOut);
- setDataTrackAction(parentElement, CLICK_MENU_ITEM_ACTION);
- } else {
- const isFlyOut = parentElement.classList.contains('is-showing-fly-out') ? FLY_OUT : EXPANDED;
-
- setDataTrackExtra(parentElement, isFlyOut);
- setDataTrackAction(parentElement, CLICK_MENU_ACTION);
- }
-}
-export const initSidebarTracking = () => {
- document.querySelectorAll('.nav-sidebar li[data-track-label] > a').forEach((link) => {
- link.addEventListener('click', onSidebarLinkClick);
- });
-};
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index 1aa5245590e..2a781c037f6 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -29,6 +29,7 @@
# repository_storage: string
# not_aimed_for_deletion: boolean
# full_paths: string[]
+# organization_id: int
#
class ProjectsFinder < UnionFinder
include CustomAttributesFilter
@@ -95,6 +96,7 @@ class ProjectsFinder < UnionFinder
collection = by_language(collection)
collection = by_feature_availability(collection)
collection = by_updated_at(collection)
+ collection = by_organization_id(collection)
by_repository_storage(collection)
end
@@ -293,6 +295,10 @@ class ProjectsFinder < UnionFinder
items
end
+ def by_organization_id(items)
+ params[:organization_id].present? ? items.in_organization(params[:organization_id]) : items
+ end
+
def finder_params
return {} unless min_access_level?
diff --git a/app/models/event.rb b/app/models/event.rb
index 7de7ad8ccd6..3ff5a46f2d9 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -89,10 +89,26 @@ class Event < ApplicationRecord
scope :for_wiki_page, -> { where(target_type: 'WikiPage::Meta') }
scope :for_design, -> { where(target_type: 'DesignManagement::Design') }
scope :for_issue, -> { where(target_type: ISSUE_TYPES) }
+ scope :for_merge_request, -> { where(target_type: 'MergeRequest') }
scope :for_fingerprint, ->(fingerprint) do
fingerprint.present? ? where(fingerprint: fingerprint) : none
end
scope :for_action, ->(action) { where(action: action) }
+ scope :created_between, ->(start_time, end_time) { where(created_at: start_time..end_time) }
+ scope :count_by_dates, ->(date_interval) { group("DATE(created_at + #{date_interval})").count }
+
+ scope :contributions, -> do
+ contribution_actions = [actions[:pushed], actions[:commented]]
+
+ contributable_target_types = %w[MergeRequest Issue WorkItem]
+ target_contribution_actions = [actions[:created], actions[:closed], actions[:merged], actions[:approved]]
+
+ where(
+ 'action IN (?) OR (target_type IN (?) AND action IN (?))',
+ contribution_actions,
+ contributable_target_types, target_contribution_actions
+ )
+ end
scope :with_associations, -> do
# We're using preload for "push_event_payload" as otherwise the association
@@ -133,15 +149,6 @@ class Event < ApplicationRecord
end
end
- # Update Gitlab::ContributionsCalendar#activity_dates if this changes
- def contributions
- where(
- 'action IN (?) OR (target_type IN (?) AND action IN (?))',
- [actions[:pushed], actions[:commented]],
- %w[MergeRequest Issue WorkItem], [actions[:created], actions[:closed], actions[:merged]]
- )
- end
-
def limit_recent(limit = 20, offset = nil)
recent.limit(limit).offset(offset)
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 4aec4207ece..37e86df9b7c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -781,6 +781,8 @@ class Project < ApplicationRecord
.order(id: :desc)
end
+ scope :in_organization, -> (organization) { where(organization: organization) }
+
enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 }
chronic_duration_attr :build_timeout_human_readable, :build_timeout,
diff --git a/app/models/user.rb b/app/models/user.rb
index fbdaa110435..109b0506648 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1767,7 +1767,7 @@ class User < MainClusterwide::ApplicationRecord
def contributed_projects
events = Event.select(:project_id)
.contributions.where(author_id: self)
- .where("created_at > ?", Time.current - 1.year)
+ .created_after(Time.current - 1.year)
.distinct
.reorder(nil)