[FIX] website_slides: fix vote widget
Fix route of vote widget. Set it to auth=public so that instead of a crash we have correct popup asking to login. Better than a SessionException, which will not be displayed. Another fix is done to avoid having one widget for all displayed like / dislike buttons. Each slide should have its own vote widget. Commit linked to task ID 1941250 and PR #31317.
This commit is contained in:
committed by
Thibault Delavallée
parent
fdc36c5c37
commit
039df4a79e
@@ -538,7 +538,7 @@ class WebsiteSlides(WebsiteProfile):
|
||||
}
|
||||
|
||||
# JSONRPC
|
||||
@http.route('/slides/slide/like', type='json', auth="user", website=True)
|
||||
@http.route('/slides/slide/like', type='json', auth="public", website=True)
|
||||
def slide_like(self, slide_id, upvote):
|
||||
if request.website.is_public_user():
|
||||
return {'error': 'public_user'}
|
||||
|
||||
@@ -86,8 +86,11 @@ sAnimations.registry.websiteSlidesLike = sAnimations.Class.extend({
|
||||
* @param {Object} parent
|
||||
*/
|
||||
start: function () {
|
||||
var self = this;
|
||||
var defs = [this._super.apply(this, arguments)];
|
||||
defs.push(new LikeButton(this).attachTo($('.o_wslides_like')));
|
||||
$('.o_wslides_like').each(function () {
|
||||
defs.push(new LikeButton(self).attachTo($(this)));
|
||||
});
|
||||
return $.when.apply($, defs);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user