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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-27 06:10:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-27 06:10:19 +0300
commit0a0dcc392ca69b7f0567bff6bc1040ded035a11b (patch)
tree1a892633e20f593140612e700a31c4460b2a08c0 /app/models
parent272c39ac05e0d68444114aed58ef2b44e1af30d6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/abuse_report.rb4
-rw-r--r--app/models/users/in_product_marketing_email.rb34
2 files changed, 8 insertions, 30 deletions
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb
index adaa057098f..19e8a80c1f5 100644
--- a/app/models/abuse_report.rb
+++ b/app/models/abuse_report.rb
@@ -158,6 +158,10 @@ class AbuseReport < ApplicationRecord
Project.find_by_full_path(route_hash.values_at(:namespace_id, :project_id).join('/'))
end
+ def group
+ Group.find_by_full_path(route_hash[:group_id])
+ end
+
def route_hash
match = Rails.application.routes.recognize_path(reported_from_url)
return {} if match[:unmatched_route].present?
diff --git a/app/models/users/in_product_marketing_email.rb b/app/models/users/in_product_marketing_email.rb
index a62dfaf02c3..5b9255f93b1 100644
--- a/app/models/users/in_product_marketing_email.rb
+++ b/app/models/users/in_product_marketing_email.rb
@@ -3,30 +3,21 @@
module Users
class InProductMarketingEmail < ApplicationRecord
include BulkInsertSafe
+ include IgnorableColumns
- BUILD_IOS_APP_GUIDE = 'build_ios_app_guide'
- CAMPAIGNS = [BUILD_IOS_APP_GUIDE].freeze
+ ignore_column :campaign, remove_with: '16.7', remove_after: '2023-11-15'
belongs_to :user
validates :user, presence: true
-
- validates :track, :series, presence: true, if: -> { campaign.blank? }
- validates :campaign, presence: true, if: -> { track.blank? && series.blank? }
- validates :campaign, inclusion: { in: CAMPAIGNS }, allow_nil: true
+ validates :track, presence: true
+ validates :series, presence: true
validates :user_id, uniqueness: {
scope: [:track, :series],
message: 'track series email has already been sent'
}, if: -> { track.present? }
- validates :user_id, uniqueness: {
- scope: :campaign,
- message: 'campaign email has already been sent'
- }, if: -> { campaign.present? }
-
- validate :campaign_or_track_series
-
enum track: {
create: 0,
verify: 1,
@@ -53,11 +44,6 @@ module Users
users_without_records(join_condition)
end
- scope :without_campaign, ->(campaign) do
- join_condition = for_user.and(for_campaign(campaign))
- users_without_records(join_condition)
- end
-
def self.users_table
User.arel_table
end
@@ -78,10 +64,6 @@ module Users
arel_table[:user_id].eq(users_table[:id])
end
- def self.for_campaign(campaign)
- arel_table[:campaign].eq(campaign)
- end
-
def self.for_track_and_series(track, series)
arel_table[:track].eq(ACTIVE_TRACKS[track])
.and(arel_table[:series]).eq(series)
@@ -92,13 +74,5 @@ module Users
email.update(cta_clicked_at: Time.zone.now) if email && email.cta_clicked_at.blank?
end
-
- private
-
- def campaign_or_track_series
- if campaign.present? && (track.present? || series.present?)
- errors.add(:campaign, 'should be a campaign or a track and series but not both')
- end
- end
end
end