Skip to content
Snippets Groups Projects
  • David Beguin's avatar
    12fd6a01
    [REF-FIX] website_slides : review and fix access, vote, comment and rating · 12fd6a01
    David Beguin authored
    Commit 5798ca28 was assuming the vote and
    comment access on slide was related to is_preview mode and was, consequently,
    depending on each slide separately.
    
    In fact, it's not because a slide is in preview mode that the user has the right
    to vote for this slide. He must be course member to interact with this preview
    slide, even if he has the right to read it.
    
    So the vote and comment right are now computed at the level of the course,
    and apply to all the slides of this course.
    
    This commit also reviews and apply fixes on review - rating access.
    
    Here are the applied rules regarding vote, comment and rating on course and slides:
    
    A user can review a course:
    - If allow_comment is activated on the course AND
    - If the user is publisher OR
    - If the user has enough karma AND is member of the course.
    
    Note : if the rating is not allowed on the course, not only the button
    to review must be hidden but also the entire rating composer.
    
    A user can vote and comment a slide:
    - If allow_comment is activated on the course AND
    - If the user is publisher OR
    - If the user has enough karma AND is member of the course.
    
    Other fix applied is this commit :
    - Avoid crash when no promoted slide : When going on course homepage
    (documentation type), if no promoted slide, we got a internal server error.
    
    Task ID: 1941250
    Partial revert of commit 5798ca28
    PR #31567
    12fd6a01
    History
    [REF-FIX] website_slides : review and fix access, vote, comment and rating
    David Beguin authored
    Commit 5798ca28 was assuming the vote and
    comment access on slide was related to is_preview mode and was, consequently,
    depending on each slide separately.
    
    In fact, it's not because a slide is in preview mode that the user has the right
    to vote for this slide. He must be course member to interact with this preview
    slide, even if he has the right to read it.
    
    So the vote and comment right are now computed at the level of the course,
    and apply to all the slides of this course.
    
    This commit also reviews and apply fixes on review - rating access.
    
    Here are the applied rules regarding vote, comment and rating on course and slides:
    
    A user can review a course:
    - If allow_comment is activated on the course AND
    - If the user is publisher OR
    - If the user has enough karma AND is member of the course.
    
    Note : if the rating is not allowed on the course, not only the button
    to review must be hidden but also the entire rating composer.
    
    A user can vote and comment a slide:
    - If allow_comment is activated on the course AND
    - If the user is publisher OR
    - If the user has enough karma AND is member of the course.
    
    Other fix applied is this commit :
    - Avoid crash when no promoted slide : When going on course homepage
    (documentation type), if no promoted slide, we got a internal server error.
    
    Task ID: 1941250
    Partial revert of commit 5798ca28
    PR #31567