From 093ac1ac40e55fa83a13b4370f63a73604d5fa36 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Mon, 16 Oct 2017 09:32:52 +0200
Subject: [PATCH] Make middle-click instant quote work with reply-account
 plugin

---
 Resources/Plugins/reply-account/.meta      |  4 ++--
 Resources/Plugins/reply-account/browser.js |  2 +-
 Resources/Scripts/code.js                  | 10 +++++++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Resources/Plugins/reply-account/.meta b/Resources/Plugins/reply-account/.meta
index aec8ecfb..d1d2865e 100644
--- a/Resources/Plugins/reply-account/.meta
+++ b/Resources/Plugins/reply-account/.meta
@@ -8,7 +8,7 @@ Custom reply account
 chylex
 
 [version]
-1.2.3
+1.2.4
 
 [website]
 https://tweetduck.chylex.com
@@ -20,4 +20,4 @@ configuration.js
 configuration.default.js
 
 [requires]
-1.8
\ No newline at end of file
+1.10.3
\ No newline at end of file
diff --git a/Resources/Plugins/reply-account/browser.js b/Resources/Plugins/reply-account/browser.js
index 009d231a..23838269 100644
--- a/Resources/Plugins/reply-account/browser.js
+++ b/Resources/Plugins/reply-account/browser.js
@@ -6,7 +6,7 @@ enabled(){
   this.lastSelectedAccount = null;
   
   this.uiComposeTweetEvent = (e, data) => {
-    return if data.type !== "reply" || data.popFromInline || !("element" in data);
+    return if !(data.type === "reply" || (data.type === "tweet" && "quotedTweet" in data)) || data.popFromInline || !("element" in data);
     
     var query;
     
diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index e7cd6458..80d38719 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -853,7 +853,15 @@
         break;
         
       case "retweet":
-        tweet.quoteTo([ tweet.account.getKey() ]); // TODO fix "from" to accept reply-account plugin
+        TD.controller.stats.quoteTweet();
+        
+        $(document).trigger("uiComposeTweet", {
+          type: "tweet",
+          from: [ tweet.account.getKey() ],
+          quotedTweet: tweet.getMainTweet(),
+          element: ele // triggers reply-account plugin
+        });
+        
         break;
       
       default: