Skip to content

Commit

Permalink
Removed long-deprecated features
Browse files Browse the repository at this point in the history
* Message#register_for_delivery_notification,
* #has_transfer_encoding?,
* #add_transfer_encoding,
* #transfer_encoding,
* #message_content_type,
* #mime_parameters,
* #encode!, and
* Part#inline_content_id.
  • Loading branch information
jeremy committed Nov 2, 2017
1 parent 7ef5694 commit ca76e1e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 48 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Breaking changes:
* Passing unparsed headers to Mail::Field.new is no longer supported. Use Mail::Field.parse. (jeremy)
* Removed long-deprecated features: Message#register_for_delivery_notification, #has_transfer_encoding?, #add_transfer_encoding, #transfer_encoding, #message_content_type, #mime_parameters, #encode!, and Part#inline_content_id. (jeremy)


== Version 2.7.0 (2017-10-31)
Expand Down
36 changes: 0 additions & 36 deletions lib/mail/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,6 @@ def self.default_charset; @@default_charset; end
def self.default_charset=(charset); @@default_charset = charset; end
self.default_charset = 'UTF-8'

def register_for_delivery_notification(observer)
warn("Message#register_for_delivery_notification is deprecated, please call Mail.register_observer instead")
Mail.register_observer(observer)
end

def inform_observers
Mail.inform_observers(self)
end
Expand Down Expand Up @@ -1434,11 +1429,6 @@ def has_content_transfer_encoding?
header[:content_transfer_encoding] && Utilities.blank?(header[:content_transfer_encoding].errors)
end

def has_transfer_encoding? # :nodoc:
warn(":has_transfer_encoding? is deprecated in Mail 1.4.3. Please use has_content_transfer_encoding?\n#{caller}")
has_content_transfer_encoding?
end

# Creates a new empty Message-ID field and inserts it in the correct order
# into the Header. The MessageIdField object will automatically generate
# a unique message ID if you try and encode it or output it to_s without
Expand Down Expand Up @@ -1496,26 +1486,11 @@ def add_content_transfer_encoding
header[:content_transfer_encoding] ||= body.default_encoding
end

def add_transfer_encoding # :nodoc:
warn(":add_transfer_encoding is deprecated in Mail 1.4.3. Please use add_content_transfer_encoding\n#{caller}")
add_content_transfer_encoding
end

def transfer_encoding # :nodoc:
warn(":transfer_encoding is deprecated in Mail 1.4.3. Please use content_transfer_encoding\n#{caller}")
content_transfer_encoding
end

# Returns the MIME media type of part we are on, this is taken from the content-type header
def mime_type
has_content_type? ? header[:content_type].string : nil rescue nil
end

def message_content_type
warn(":message_content_type is deprecated in Mail 1.4.3. Please use mime_type\n#{caller}")
mime_type
end

# Returns the character set defined in the content type field
def charset
if @header
Expand All @@ -1542,12 +1517,6 @@ def sub_type
has_content_type? ? header[:content_type].sub_type : nil rescue nil
end

# Returns the content type parameters
def mime_parameters
warn(':mime_parameters is deprecated in Mail 1.4.3, please use :content_type_parameters instead')
content_type_parameters
end

# Returns the content type parameters
def content_type_parameters
has_content_type? ? header[:content_type].parameters : nil rescue nil
Expand Down Expand Up @@ -1816,11 +1785,6 @@ def ready_to_send!
add_required_fields
end

def encode!
warn("Deprecated in 1.1.0 in favour of :ready_to_send! as it is less confusing with encoding and decoding.")
ready_to_send!
end

# Outputs an encoded string representation of the mail message including
# all headers, attachments, etc. This is an encoded email in US-ASCII,
# so it is able to be directly sent to an email server.
Expand Down
6 changes: 0 additions & 6 deletions lib/mail/part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ def has_content_id?
header.has_content_id?
end

def inline_content_id
# TODO: Deprecated in 2.2.2 - Remove in 2.3
warn("Part#inline_content_id is deprecated, please call Part#cid instead")
cid
end

def cid
add_content_id unless has_content_id?
Utilities.uri_escape(Utilities.unbracket(content_id))
Expand Down
6 changes: 0 additions & 6 deletions spec/mail/part_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
body "This is Text"
end
expect(part.cid).to eq "thisis@acontentid"
expect($stderr).to receive(:puts).with("Part#inline_content_id is deprecated, please call Part#cid instead")
expect(part.inline_content_id).to eq "thisis@acontentid"
end


Expand All @@ -54,15 +52,11 @@
body "This is Text"
end
expect(part.cid).to eq "thi%25%25sis@acontentid"
expect($stderr).to receive(:puts).with("Part#inline_content_id is deprecated, please call Part#cid instead")
expect(part.inline_content_id).to eq "thi%25%25sis@acontentid"
end

it "should add a content_id if there is none and is asked for an inline_content_id" do
part = Mail::Part.new
expect(part.cid).not_to be_nil
expect($stderr).to receive(:puts).with("Part#inline_content_id is deprecated, please call Part#cid instead")
expect(part.inline_content_id).not_to be_nil
end

it "should respond correctly to inline?" do
Expand Down

0 comments on commit ca76e1e

Please sign in to comment.