From 4df77067cc7d9004aea8f54ca005a39f7e5a06ff Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 9 Jul 2015 13:37:16 +0200 Subject: [PATCH] Fixed bug: Missing 'in_reply_to' attribute in case of status replies. --- lib/tweet.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/tweet.rb b/lib/tweet.rb index ffead1269..8c75b3a6b 100644 --- a/lib/tweet.rb +++ b/lib/tweet.rb @@ -141,15 +141,21 @@ class Tweet article_type = 'twitter direct-message' end + in_reply_to = nil + if tweet.respond_to?('in_reply_to_status_id') && tweet.in_reply_to_status_id && tweet.in_reply_to_status_id.to_s != '' + in_reply_to = tweet.in_reply_to_status_id + end + Ticket::Article.create( - from: user.login, - to: to, - body: tweet.text, - message_id: tweet.id, - ticket_id: ticket.id, - type: Ticket::Article::Type.find_by( name: article_type ), - sender: Ticket::Article::Sender.find_by( name: 'Customer' ), - internal: false, + from: user.login, + to: to, + body: tweet.text, + message_id: tweet.id, + ticket_id: ticket.id, + in_reply_to: in_reply_to, + type: Ticket::Article::Type.find_by( name: article_type ), + sender: Ticket::Article::Sender.find_by( name: 'Customer' ), + internal: false, ) end