Skip to content
Permalink
Browse files

[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.
  • Loading branch information...
jem-odoo authored and tde-banana-odoo committed Feb 20, 2019
1 parent acb7ecd commit 36f461d1a0ff04b5702afce3884f3c275676b66d
Showing with 5 additions and 2 deletions.
  1. +1 −1 addons/website_slides/controllers/main.py
  2. +4 −1 addons/website_slides/static/src/js/slides_like.js
@@ -538,7 +538,7 @@ def set_status_as_done(self, slide_id):
}

# 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);
},
});

0 comments on commit 36f461d

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.