mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 22:08:01 +08:00
Work in Progress: Reply By Email:
- Add support classes and settings to enable reply by email - Split out Email builder to be more OO, add many specs
This commit is contained in:
30
lib/email/receiver.rb
Normal file
30
lib/email/receiver.rb
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Handles an incoming message
|
||||
#
|
||||
require_dependency 'email/incoming_message'
|
||||
|
||||
module Email
|
||||
class Receiver
|
||||
|
||||
def self.results
|
||||
@results ||= Enum.new(:unprocessable)
|
||||
end
|
||||
|
||||
def initialize(incoming_message)
|
||||
@incoming_message = incoming_message
|
||||
end
|
||||
|
||||
def process
|
||||
|
||||
if @incoming_message.blank? || @incoming_message.reply_key.blank?
|
||||
return Email::Receiver.results[:unprocessable]
|
||||
end
|
||||
|
||||
log = EmailLog.where(reply_key: @incoming_message.reply_key).first
|
||||
return Email::Receiver.results[:unprocessable] if log.blank?
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user