Forum Discussion

b_poplin's avatar
b_poplin
Expert
11 years ago

message level kudos enabled setting

We are currently using the following to determine if kudos is enabled at node level:

<#assign kudosEnabled = restadmin("/boards/id/${nodeId}/settings/name/config.enable_kudos").value />

 

The problem is that when a blog article disables kudos (edit article/Do not allow anyone to give likes to this post [checkbox on right side of page]) kudosEnabled node level is true, but making the following call fails as "303 permission denied" which crashes our endpoint:

restadmin("/messages/id/${article.id}/kudos/for/users/self/count").value />

 

What is the API call to check whether kudos has been disabled at a message/article/topic level?

 

Thanks!

4 Replies

  • b_poplin's avatar
    b_poplin
    Expert
    11 years ago

    Hmm...  We are already making that call to see if the message belongs to the member logged in, the api call returning permission denied is being used to check whether the member has already submitted a kudos for the message because the API call you suggest has the note:

    "Note that this ignores whether the user has already kudoed the message, in which a kudo can be given again but will have no effect."

     

    So our logic is a combination of the 2 API's to enable/disable the button.  I guess I will have to make the call to "/kudos/for/users/self/count" conditional based upon "kudos/give/allowed", meaning, if "kudos/give/allowed" is false, then don't make the API call that is crashing due to permission denied.

  • b_poplin's avatar
    b_poplin
    Expert
    11 years ago

    The problem is that "/kudos/give/allowed" returns false for the members own message, but in this case I still want to display the kudos count on the message with the kudos button grayed out.

     

    I believe that I need access to the actual setting to correctly determine:

    1. Are kudos / like enabled, if so then show the kudos button (got community and board settings accounted for, but not the article level ***missing)

    2.  does this message belong to me, if so then disable the kudos button but show counts (/kudos/give/allowed)

    3.  have I already given this message that doesn't belong to me kudoes, if so disable, if not allow to give kudos (/kudos/for/users/self/count)

     

    Moving "/kudos/for/users/self/count" into a condition based upon "/kudos/give/allowed" does prevent the permission denied error bombing the endpoint, but it doesn't tell me whether the counts should be shown for my own message.