Forum Discussion

lorseau's avatar
13 years ago

Format for displaying posts

Hello,   Is there a way (an option in the Admin) to show what is the father of a message in a topic page?   I saw the "Linear option", but in this mode we can't see the difference between a reply...
  • AdamN's avatar
    13 years ago

    Hi Laurent,

     

    A few of our customers have customizations to show information about the "parent" message. You can see one example on the Autodesk Community:

    http://forums.autodesk.com/t5/AutoCAD-Express-Tools/PDF-to-DWG-converter/td-p/2658285/page/2

     

    For a custom component like this, you would add it to the "Forum Message" page. Inside the component, you would take advantage of the "env" custom context object. On the "Forum Message" page, this custom context object can give you details about the individual message that you're displaying. For example, to get the unique id of the message, you can use:

     

    env.context.message.uniqueId

     With this information, you can make a REST API call to get the details of the parent message. For example:

    /messages/id/${env.context.message.uniqueId?c}/parent

    Once you have the details of the parent message, you can output any of the information you'd like. Autodesk, for example, outputs "in reply to: <author>"; however, you could add a link to the parent message or other details as you'd like.

     

    I hope this helps!

     

    -Adam

     

     

  • AdamN's avatar
    AdamN
    13 years ago

    Hmmm...

     

    When you're making the REST API call in your custom component, are you using

    rest(...)

     or

    restadmin(...)

     The latter allows you to make the REST API call as an Administrator. I normally reccomend trying to avoid it when possible, but there shouldn't be any harm in using it with the call to get the parent message information. That should allow you to avoid having to grant the REST API permission for all users.

     

    I wouldn't say it's dangerous to grant the permission to all users, but typically it's not necessary. The REST API respects the permissions established in the community admin. So even if you did grant REST API permission to other users, they could still only access information they already have permission to access. 

     

    -Adam