diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-22 21:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-22 21:10:13 +0300 |
commit | 0a5e00b6914944295b31ce10ffd5429cbe9fae89 (patch) | |
tree | 580508961eaa268b13df3eafe6f373b5b500d8c5 /app/models | |
parent | 5f5f492fe278f3322e9533b617522321e2ccafcc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/members_preloader.rb | 7 | ||||
-rw-r--r-- | app/models/packages/package.rb | 9 | ||||
-rw-r--r-- | app/models/project_services/flowdock_service.rb | 10 | ||||
-rw-r--r-- | app/models/project_services/hangouts_chat_service.rb | 17 | ||||
-rw-r--r-- | app/models/user_callout.rb | 3 |
5 files changed, 22 insertions, 24 deletions
diff --git a/app/models/members_preloader.rb b/app/models/members_preloader.rb index 88db7f63bd9..a079aec76f2 100644 --- a/app/models/members_preloader.rb +++ b/app/models/members_preloader.rb @@ -10,9 +10,10 @@ class MembersPreloader def preload_all ActiveRecord::Associations::Preloader.new.preload(members, :user) ActiveRecord::Associations::Preloader.new.preload(members, :source) - ActiveRecord::Associations::Preloader.new.preload(members.map(&:user), :status) - ActiveRecord::Associations::Preloader.new.preload(members.map(&:user), :u2f_registrations) - ActiveRecord::Associations::Preloader.new.preload(members.map(&:user), :webauthn_registrations) + ActiveRecord::Associations::Preloader.new.preload(members, :created_by) + ActiveRecord::Associations::Preloader.new.preload(members, user: :status) + ActiveRecord::Associations::Preloader.new.preload(members, user: :u2f_registrations) + ActiveRecord::Associations::Preloader.new.preload(members, user: :webauthn_registrations) end end diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb index e510432be8f..98c5db99b12 100644 --- a/app/models/packages/package.rb +++ b/app/models/packages/package.rb @@ -74,6 +74,7 @@ class Packages::Package < ApplicationRecord enum status: { default: 0, hidden: 1, processing: 2, error: 3 } + scope :for_projects, ->(project_ids) { where(project_id: project_ids) } scope :with_name, ->(name) { where(name: name) } scope :with_name_like, ->(name) { where(arel_table[:name].matches(name)) } scope :with_normalized_pypi_name, ->(name) { where("LOWER(regexp_replace(name, '[-_.]+', '-', 'g')) = ?", name.downcase) } @@ -137,14 +138,6 @@ class Packages::Package < ApplicationRecord after_commit :update_composer_cache, on: :destroy, if: -> { composer? } - def self.for_projects(projects) - unless Feature.enabled?(:maven_packages_group_level_improvements, default_enabled: :yaml) - return none unless projects.any? - end - - where(project_id: projects) - end - def self.only_maven_packages_with_path(path, use_cte: false) if use_cte && Feature.enabled?(:maven_metadata_by_path_with_optimization_fence, default_enabled: :yaml) # This is an optimization fence which assumes that looking up the Metadatum record by path (globally) diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb index e721fded1d9..ce55d757b30 100644 --- a/app/models/project_services/flowdock_service.rb +++ b/app/models/project_services/flowdock_service.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class FlowdockService < Service + include ActionView::Helpers::UrlHelper prop_accessor :token validates :token, presence: true, if: :activated? @@ -9,7 +10,12 @@ class FlowdockService < Service end def description - s_('FlowdockService|Flowdock is a collaboration web app for technical teams.') + s_('FlowdockService|Send event notifications from GitLab to Flowdock flows.') + end + + def help + docs_link = link_to _('Learn more.'), Rails.application.routes.url_helpers.help_page_url('api/services', anchor: 'flowdock'), target: '_blank', rel: 'noopener noreferrer' + s_('FlowdockService|Send event notifications from GitLab to Flowdock flows. %{docs_link}').html_safe % { docs_link: docs_link.html_safe } end def self.to_param @@ -18,7 +24,7 @@ class FlowdockService < Service def fields [ - { type: 'text', name: 'token', placeholder: s_('FlowdockService|Flowdock Git source token'), required: true } + { type: 'text', name: 'token', placeholder: s_('FlowdockService|1b609b52537...'), required: true, help: 'Enter your Flowdock token.' } ] end diff --git a/app/models/project_services/hangouts_chat_service.rb b/app/models/project_services/hangouts_chat_service.rb index 299a306add7..6e7708a169f 100644 --- a/app/models/project_services/hangouts_chat_service.rb +++ b/app/models/project_services/hangouts_chat_service.rb @@ -3,12 +3,14 @@ require 'hangouts_chat' class HangoutsChatService < ChatNotificationService + include ActionView::Helpers::UrlHelper + def title - 'Hangouts Chat' + 'Google Chat' end def description - 'Receive event notifications in Google Hangouts Chat' + 'Send notifications from GitLab to a room in Google Chat.' end def self.to_param @@ -16,13 +18,8 @@ class HangoutsChatService < ChatNotificationService end def help - 'This service sends notifications about projects events to Google Hangouts Chat room.<br /> - To set up this service: - <ol> - <li><a href="https://developers.google.com/hangouts/chat/how-tos/webhooks">Set up an incoming webhook for your room</a>. All notifications will come to this room.</li> - <li>Paste the <strong>Webhook URL</strong> into the field below.</li> - <li>Select events below to enable notifications.</li> - </ol>' + docs_link = link_to _('How do I set up a Google Chat webhook?'), Rails.application.routes.url_helpers.help_page_url('user/project/integrations/hangouts_chat'), target: '_blank', rel: 'noopener noreferrer' + s_('Before enabling this integration, create a webhook for the room in Google Chat where you want to receive notifications from this project. %{docs_link}').html_safe % { docs_link: docs_link.html_safe } end def event_field(event) @@ -42,7 +39,7 @@ class HangoutsChatService < ChatNotificationService def default_fields [ - { type: 'text', name: 'webhook', placeholder: "e.g. #{webhook_placeholder}" }, + { type: 'text', name: 'webhook', placeholder: "#{webhook_placeholder}" }, { type: 'checkbox', name: 'notify_only_broken_pipelines' }, { type: 'select', name: 'branches_to_be_notified', choices: branch_choices } ] diff --git a/app/models/user_callout.rb b/app/models/user_callout.rb index 0a4db707be6..852ea05b77f 100644 --- a/app/models/user_callout.rb +++ b/app/models/user_callout.rb @@ -30,7 +30,8 @@ class UserCallout < ApplicationRecord new_user_signups_cap_reached: 26, # EE-only unfinished_tag_cleanup_callout: 27, eoa_bronze_plan_banner: 28, # EE-only - pipeline_needs_banner: 29 + pipeline_needs_banner: 29, + pipeline_needs_hover_tip: 30 } validates :user, presence: true |