Forum Discussion

stgray's avatar
stgray
Guide
3 years ago

LiQL query for User Drafts widget

We have a widget on our user profile page that shows users unsaved drafts, I believe this is an OOTB component.

It is on the ViewProfilePage.quilt.xml as 

<component id="users.widget.unsaved-drafts"/> 

I'd like to keep the content of the widget but make some substantial changes to the way the component works.

Can anyone suggest the LiQL query for the widget?

Thanks!

  • In case anyone comes across this discussion this is what I've found out so far:

    There are two types of drafts:

    1. Drafts for TKB and blog articles
    2. Auto-saved drafts covering replies and comments to blog posts, TKBs and discussion posts

     

    1. Drafts for TKB and blog articles

    As far as I can tell these drafts are manually saved by users, there is an API for this type (e.g. SELECT * FROM messages WHERE visibility_scope='draft' AND conversation.style='tkb' AND author.id = '45').

    These types of drafts do not appear in the drafts component <component id="users.widget.unsaved-drafts"/>

     

    2. Auto-saved drafts

    The component <component id="users.widget.unsaved-drafts"/> displays auto-saved drafts.  There is no API call to identify this type of drafts. 

    We had found that the drafts widget didn't match the loading functionality of other similar widgets that allow "Load More" rather than pagination, there was no way to get a total count for unsaved drafts and the pagination control did not allow users to keep track of their place in the pages.

    If you do want to customize the widget there is an - admittedly - very hacky solution where the code can intercept the ajax calls caused by the pagination and re-implement the widget using the responses from these calls:

    $(document).bind('ajaxComplete.draftsWidget', function() {
    // Access newly loaded content
    var $newDrafts = $('.custom-profile-activity-drafts')
    .find('.UnsavedDraftsTaplet')
    .find('.UnsavedDraftsTaplet')
    .find('.lia-inline-ajax-feedback')

    // jQuery magic to make your newDrafts looks and feel how you want...

    ...

    }

     

  • +1 - This would be awesome to know.  For folks who have 8 million drafts, the current interface is less than ideal.