Browse Source

Improved signature identifier.

Martin Edenhofer 10 years ago
parent
commit
5346e2c400

+ 1 - 1
app/assets/javascripts/app/lib/app_post/utils.js.coffee

@@ -352,7 +352,7 @@ class App.Utils
     # gmail
     # <div class="ecxgmail_quote">
     if !markers || !markers[0]
-      regex = new RegExp( "(<blockquote class=\"ecxgmail_quote\">)" )
+      regex = new RegExp( "(<blockquote class=\"(ecxgmail_quote|gmail_quote)\">)" )
       if message.match( regex )
         return message.replace( regex, "#{markerTemplate}\$1" )
 

+ 5 - 0
public/assets/tests/html-utils.js

@@ -653,6 +653,11 @@ test( "identify signature", function() {
   result  = App.Utils.signatureIdentify( message, true )
   equal( result, should )
 
+  message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><blockquote class=\"gmail_quote\">lalala</blockquote></div>"
+  should  = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span><blockquote class=\"gmail_quote\">lalala</blockquote></div>"
+  result  = App.Utils.signatureIdentify( message, true )
+  equal( result, should )
+
   message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Am 24. Dezember 2015 um 07:45 schrieb kathrine &lt;kathrine@example.com&gt;:<br/>lalala</div>"
   should = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span>Am 24. Dezember 2015 um 07:45 schrieb kathrine &lt;kathrine@example.com&gt;:<br/>lalala</div>"
   result  = App.Utils.signatureIdentify( message, true )