incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r736230 - in /incubator/esme/trunk/server/src/main/scala/us/esme: external/RssFeed.scala model/Action.scala
Date Wed, 21 Jan 2009 05:51:10 GMT
Author: vdichev
Date: Tue Jan 20 21:51:09 2009
New Revision: 736230

URL: http://svn.apache.org/viewvc?rev=736230&view=rev
Log:
ESME-22 - Fix duplicate entries in RSS feed when pubDate element is missing.

Modified:
    incubator/esme/trunk/server/src/main/scala/us/esme/external/RssFeed.scala
    incubator/esme/trunk/server/src/main/scala/us/esme/model/Action.scala

Modified: incubator/esme/trunk/server/src/main/scala/us/esme/external/RssFeed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/us/esme/external/RssFeed.scala?rev=736230&r1=736229&r2=736230&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/us/esme/external/RssFeed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/us/esme/external/RssFeed.scala Tue Jan 20 21:51:09
2009
@@ -20,6 +20,10 @@
 import java.util.Locale.US
 
 import us.esme.model.User
+import us.esme.model.Message
+import us.esme.actor.Distributor.{UserCreatedMessage=>Msg}
+
+import net.liftweb.util.Empty
 
 object RssFeed {
   val dateFormats = List(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", US))
@@ -60,5 +64,17 @@
       parseInternetDate(date text).getTime
   }
   
+  // need to compare by text since a pubDate is not mandatory and indeed, often is missing
+  override def getLastSortedMessages(msgs: List[Msg], lastMessage: Option[Msg]): List[Msg]
= {
+    lastMessage match {
+      case Some(message: Msg) =>
+        msgs.reverse.takeWhile{ msg =>
+          // a hack to format text identically- difference in urls & trailing whitespace
+          Message.setTextAndTags(msg.text, Nil, Empty).get.getText !=
+          Message.setTextAndTags(message.text, Nil, Empty).get.getText
+        }
+      case None => msgs
+    }
+  }.reverse
 }
 

Modified: incubator/esme/trunk/server/src/main/scala/us/esme/model/Action.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/us/esme/model/Action.scala?rev=736230&r1=736229&r2=736230&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/us/esme/model/Action.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/us/esme/model/Action.scala Tue Jan 20 21:51:09
2009
@@ -151,7 +151,7 @@
             val lastMsg = if (msgList.isEmpty) None 
               else {
                 val m = msgList.first
-                Some(Distributor.UserCreatedMessage(user, m.text, m.tags, m.when, Empty,
m.source, Full(m.replyTo)))
+                Some(Distributor.UserCreatedMessage(user, m.getText, m.tags, m.when, Empty,
m.source, Full(m.replyTo)))
               }
 
             val feed = a match {



Mime
View raw message