diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /app/models | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
30 files changed, 69 insertions, 77 deletions
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, |