You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/07/27 01:45:09 UTC

svn commit: r425910 - /incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/FeedModel.java

Author: agilliland
Date: Wed Jul 26 16:45:09 2006
New Revision: 425910

URL: http://svn.apache.org/viewvc?rev=425910&view=rev
Log:
comments for feeds should be restricted by same entry count rules as entries.


Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/FeedModel.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/FeedModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/FeedModel.java?rev=425910&r1=425909&r2=425910&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/FeedModel.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/FeedModel.java Wed Jul 26 16:45:09 2006
@@ -40,7 +40,7 @@
 
 
 /**
- * Model provides information needed to render a feed.
+ * Model which provides information needed to render a feed.
  */
 public class FeedModel implements Model {
     
@@ -91,6 +91,7 @@
         return feedRequest.isExcerpts();
     }
     
+    
     /**
      * Get category path or name specified by request.
      */
@@ -98,11 +99,13 @@
         return feedRequest.getWeblogCategoryName();
     }
     
+    
     /**
      * Gets most recent entries limited by: weblog and category specified in 
      * request plus the weblog.entryDisplayCount.
      */
     public List getWeblogEntries() {
+        
         // Display same number of entries in feed as displayed on page
         int entryCount = weblog.getEntryDisplayCount();
         
@@ -138,11 +141,24 @@
         return results;
     }
     
+    
     /**
-     * Gets most recent entries limited by: weblog specified in request and 
+     * Gets most recent comments limited by: weblog specified in request and 
      * the weblog.entryDisplayCount.
      */
-    public List getComments() {        
+    public List getComments() {
+        
+        // Display same number of entries in feed as displayed on page
+        int entryCount = weblog.getEntryDisplayCount();
+        
+        // But don't exceed installation-wide maxEntries settings
+        int maxEntries =
+                RollerRuntimeConfig.getIntProperty("site.newsfeeds.maxEntries");
+        int defaultEntries =
+                RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries");
+        if (entryCount < 1) entryCount = defaultEntries;
+        if (entryCount > maxEntries) entryCount = maxEntries;
+        
         List recentComments = new ArrayList();
         try {
             WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
@@ -157,7 +173,7 @@
                     Boolean.FALSE, // no spam
                     true,          // we want reverse chrono order
                     0,             // offset
-                    weblog.getEntryDisplayCount()); // length
+                    entryCount); // length
             
             // wrap pojos
             recentComments = new ArrayList(recent.size());