Omit incoming body instead of emitting empty string

Amolith created

Use same body_text abstraction in both event emitting and stanza sending
code

Change summary

lib/event_emitter.rb | 2 +-
lib/incoming_mms.rb  | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

Detailed changes

lib/event_emitter.rb 🔗

@@ -23,7 +23,7 @@ module EventEmitter
 	)
 		jid_to_owner(owner_jid) { |(tel, *)|
 			MessageEvent::In.new(
-				owner: tel, from: from, to: [tel], body: body.to_s,
+				owner: tel, from: from, to: [tel], body: body,
 				endstream_id: endstream_id, media_urls: media_urls
 			).emit(REDIS)
 		}.catch do |e|

lib/incoming_mms.rb 🔗

@@ -37,7 +37,7 @@ class IncomingMMS
 
 	# MMS text parts are separate fetched .txt files; join with paragraph breaks
 	def body_text
-		@txt.empty? ? "" : @txt.join("\n\n")
+		@txt.empty? ? nil : @txt.join("\n\n")
 	end
 
 	def media_urls
@@ -64,7 +64,7 @@ class IncomingMMS
 	def to_stanza
 		Blather::Stanza::Message.new(
 			addresses ? unproxied_to.domain : unproxied_to,
-			@txt.empty? ? nil : @txt.join("\n\n")
+			body_text
 		).tap do |m|
 			oobs.each { |oob| m << oob }
 			m << addresses if addresses