Forum Discussion

Claudius's avatar
13 years ago

Looking for a thread equivalent to forums.widget.message-list-panel

Currently working on a custom component to show unanswered threads older than x days. The discussion on "Threads with no replies" has proven really helpful by supplying a hint on the builtin component to output a list of message:

<#assign rest_query = "/boards/id/" + pid + "/search/messages?openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size />
<@component id="forums.widget.message-list-panel" messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size />

 Is there an equivalent builtin widget to do the same for a list of threads, e.g. like this (non-working code):

 

<#assign rest_query = "/boards/id/" + pid + "/threads/recent?openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size />
<@component id="forums.widget.thread-list-panel" threads="rest_v1:"+rest_query style="wide" numThreads="conv:"+results_list_size />

 

  • AdamN's avatar
    AdamN
    Khoros Oracle

    Hi Claudius,

     

    I'd suggest just tweaking the search query to return only root messages. You can do this by adding "is_root:true" to the q parameter for the search.

     

    For example:

    <#assign rest_query = "/boards/id/" + pid + "/search/messages?q=is_root:true&openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size />
    <@component id="forums.widget.message-list-panel" messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size />

    Hopefully this helps. Let me know if I misunderstood what you're trying to do.

     

    Regards,

     

    Adam

    • Hi Adam,
      thanks for your reply. I want to list all threads that have replies, but no solutions yet. My original call didn't do that as I was postprocessing the data via 

      <#if thread.solutions?size == 0 || thread.solutions.solution?size == 0>

       Obviously because of my misleading example your's doesn't do that either. Is there any URL parameter you can think of that would allow me to return only messages in a thread without a solution? Searching Lithosphere and digging through the JavaDoc I could only find ways to pull threads with solutions. Yet for Moderators it's much more interesting to find those without.

      • AdamN's avatar
        AdamN
        Khoros Oracle

        Oh, I see now... You want unsolved (no solution) posts. Let's try this instead:

         

        <#assign rest_query = "/boards/id/" + pid + "/search/messages?q=is_root%3Atrue%20AND%20!(solved%3Atrue)&sort_by=-topicPostDate&page_size=" + results_list_size />
        <@component id="forums.widget.message-list-panel" messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size />

         

        Decoded, the query (q) portion of the rest call looks like this:

        is_root:true AND !(solved:true)

         

        So this gives us root messages that are not solved. You may ask why I didn't do "solved:false", and that's because the solved field isn't necessarily an actual boolean value (only true or false). It doesn't have a value unless the thread is actually solved, in which case it's set to "true". So to get the cases where it's not solved, we just negate it instead.

         

        I hope this helps!

         

        Regards,

         

        Adam