mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:27:52 +08:00
FIX: Change default for IncomingEmail#created_via to 0 (unknown) and make NOT NULL (#11782)
Follow up to https://review.discourse.org/t/dev-add-created-via-column-to-incomingemail-pr-11751/18366/6
This commit is contained in:
@ -6,6 +6,8 @@ class IncomingEmail < ActiveRecord::Base
|
||||
belongs_to :post
|
||||
belongs_to :group, foreign_key: :imap_group_id, class_name: 'Group'
|
||||
|
||||
validates :created_via, presence: true
|
||||
|
||||
scope :errored, -> { where("NOT is_bounce AND error IS NOT NULL") }
|
||||
|
||||
scope :addressed_to, -> (email) do
|
||||
@ -33,6 +35,7 @@ class IncomingEmail < ActiveRecord::Base
|
||||
|
||||
def self.created_via_types
|
||||
@types ||= Enum.new(
|
||||
unknown: 0,
|
||||
handle_mail: 1,
|
||||
pop3_poll: 2,
|
||||
imap: 3,
|
||||
@ -106,7 +109,7 @@ end
|
||||
# imap_uid :integer
|
||||
# imap_sync :boolean
|
||||
# imap_group_id :bigint
|
||||
# created_via :integer
|
||||
# created_via :integer default(0), not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
|
Reference in New Issue
Block a user