0 Replies Latest reply on Jan 25, 2016 1:23 PM by msbrocca

    Recent Content Widget Issue

    msbrocca

      Hello everyone,

       

           Today I found an issue with the RecentContentWidget. In our configuration, we use this widget and some custom widgets that inherit for it. If you used this widget, you know that you can set the number of items you want to see displayed by the widget (numResults).

       

            QA reported to us that one of our custom the widgets was not displaying the correct # of results (you always get one less element that you set). Making a deep research, I found that method loadProperties from RecentContentWidget has the following code:

       

             if (isShowFollowedPlaces()) {

                  PeekingIterator<? extends JiveContentObject> contentObjectIterator = Iterators.peekingIterator(getRecentContent(widgetContext.getUser()));

                  if (contentObjectIterator.hasNext()) {

                      JiveContentObject contentObject = contentObjectIterator.next();

                      properties.put("zeroItem",contentObject.getID()+"-"+contentObject.getObjectType());

                  }

                  else {

                      properties.put("zeroItem","");

                  }

                  properties.put("content", contentObjectIterator);

       

       

             Once you get the first element of the iterator, it remains pointing to the second one. So, you have 2 problems here:

      1.- You'll get one less element in your widget

      2.- You'll lose the first element (that maybe is the last published content)

       

             An this, is just to create the zeroItem string, that is not used in any place.

             This is in Jive 6.

       

             I decided to create my own abstract class and remove the creation of this zeroItem element.

         

      Regards,

      Maxi