Rende usabili i filtri destinatari e permette di eliminare le bozze email.
CI / scan_ruby (push) Failing after 12m54s
CI / scan_js (push) Successful in 12m34s
CI / lint (push) Failing after 13m10s

Le listbox non applicavano sport e altri criteri; ora i filtri sono checkbox, c'è «mai contattati» e dal cruscotto si cancellano le bozze. La lista organizzazioni allinea le colonne al foglio campagna.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-07 07:57:50 +02:00
co-authored by Cursor
parent e492c43bf8
commit 3e73e708e4
16 changed files with 1114 additions and 90 deletions
+3 -2
View File
@@ -91,7 +91,7 @@ module Mailings
end
def history_active?
history_kind.present?
history_kind.present? && history_kind != "never"
end
def organization_extra_active?
@@ -115,7 +115,7 @@ module Mailings
def history_summary
case history_kind
when "never" then "mai ricevuta una campagna"
when "never" then "mai contattati via email"
when "received" then "già ricevuta campagna ##{history_mailing_id}"
when "not_received" then "non ricevuta campagna ##{history_mailing_id}"
when "opened" then "aperta campagna ##{history_mailing_id}"
@@ -137,6 +137,7 @@ module Mailings
data["list_max"] = integer_or_nil(source["list_max"])
data["estimated_value"] = source["estimated_value"].presence_in(VALUE_MODES) || "any"
data["history_kind"] = source["history_kind"].presence_in(HISTORY_KINDS)
data["history_kind"] = "never" if ActiveModel::Type::Boolean.new.cast(source["never_contacted"])
data["history_mailing_id"] = integer_or_nil(source["history_mailing_id"])
data["history_days"] = integer_or_nil(source["history_days"])
data["exclude_customers"] = ActiveModel::Type::Boolean.new.cast(source["exclude_customers"]) || false
+5 -1
View File
@@ -84,7 +84,7 @@ module Mailings
def apply_history_filters(scope)
case @filters.history_kind
when "never"
scope.where.not(id: sent_org_ids)
scope.where.not(id: sent_org_ids).where.not(id: emailed_activity_org_ids)
when "received"
scope.where(id: sent_org_ids(mailing_id: @filters.history_mailing_id))
when "not_received"
@@ -127,6 +127,10 @@ module Mailings
Opportunity.where(project_id: @project.id)
end
def emailed_activity_org_ids
Activity.where(activity_type: "email_sent", organization_id: Organization.for_project(@project).select(:id)).select(:organization_id)
end
def sent_org_ids(mailing_id: nil, since: nil)
recips = history_recipients.where(status: "sent")
recips = recips.where(mailing_id: mailing_id) if mailing_id.present?