Forum Discussion

VincentGabou's avatar
11 years ago

Replicate Me Too component, or any ID-required non-contract component to a custom component

Hello,

 

I am currently trying to integrate a Q&A page that will be extensively customized. One of the "customization" I was trying to implement was to be able to have "Me Too" button on the Q&A main page (listing recent open and resolved questions) for every listed question.

 

I have found in the Studio the name of the "Me Too" component ( <component id="ratings.widget.rating-enum-display" ratingSystemRef="conv:question_metoo"/> ). However, it makes sense that I have to send the ID of every question I want the "Me Too" button for (as of now the button is not rendered for any question on the main page) to this widget. So far I have not been able to find a way to do that.

 

Do you know how we can get access to the actual code of the "non-contract components" of Lithium, so we can figure out how to create "ID-required non-contract" components outside of their designated Pages ? If not, do you think we can recreate the behaviour of the "Me Too" button from scratch (including the logging in part if the user is anonymous, etc.) ?

 

Thank you very much for your help !

 

Best regards

13 Replies

  • VincentGabou's avatar
    VincentGabou
    Guide
    11 years ago

    Thanks clemlith , glad to see I'm not the only one with this issue !

     

    Unfortunately I'm still experiencing this suprising "Denied Access" error (even though other API write calls all proceed successfully). I checked all possible permissions and they seem to be set correctly, I am logged in as Admin but still can't get to add a Me Too to a Question programatically.

     

    Do you have any idea what could be the reason, AdamA , by any chance ? 

     

    Thank you for any feedback you can give, I'm sure this can be solved :)

  • AdamA's avatar
    AdamA
    Khoros Oracle
    11 years ago

    VincentGabou &clemlith 

     

    Sorry for the delayed response, I was on vacation and out of the office.

     

    I realize now that the rating.value I advised initially was incorrect, instead of 1 it should be 0. I apologize for the confusion!

     

    /messages/id/<message-id>/ratings/key/question_metoo/ratings/add?rating.value=0

     

    I had the value confused with what you would want to use for our helpfulness feature, where a value of 1 means "helpful" and a value of -1 means "Not helpful". In the case of Me Too, since there is no negative variant (as in: "Not me too") the system uses a value of 0.

  • sakkaoui's avatar
    sakkaoui
    Mentor
    11 years ago

    Hi AdamA 

     

    Sorry to come back to you after such a long time.

    We have tested this new value and the good news is : it works !

    The issue, now, is that I manage to add a metoo to a message programmatically, using a certain user of our test plateform. But I can find out how to reproduce this with other users.

    I tried to apply the same level of permissions the working user has to the others, even giving all permissions, but it seams to have no impact on the API metoo rating ability.

    This is what I get using both users (and a custom Ruby Lithium API Wrapper, but the result is the same in Javascript) : 

     

    l = Lithium.new
    => #<Lithium:0x007ff1b3daf758 @data={"basic_auth_login"=>"***", "basic_auth_password"=>"***", "domain"=>"***.fr", "login"=>"SmartPereNoel", "password"=>"***"}, @session_key=nil>
    l.get_session_key
    => "***"
    l.request('/messages/id/1123/ratings/key/question_metoo/ratings/add?rating.value=0', :post)
    => {"status"=>"success"}
    
    l = Lithium.new
    => #<Lithium:0x007ff1b3f5fa30 @data={"basic_auth_login"=>"***", "basic_auth_password"=>"***", "domain"=>"***.fr", "login"=>"APIUser", "password"=>"***"}, @session_key=nil>
    l.get_session_key
    => "***"
    l.request('/messages/id/2657/ratings/key/question_metoo/ratings/add?rating.value=0', :post)
    Lithium::LithiumError: [303: Forbidden]

     

    Do you know of a special permission or setting to apply to users, so that they become able to add metto via APIs ?

    Thanks !

    -- 

    Stéphane Akkaoui