Commit 11243fa7b0c225f3ca5216c2a799828f386605fb
1 parent
9be28046
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
api: set user when vote
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/noosfero/api/v1/articles.rb
... | ... | @@ -34,8 +34,8 @@ module Noosfero |
34 | 34 | # FIXME verify allowed values |
35 | 35 | render_api_error!('Vote value not allowed', 400) unless [-1, 1].include?(value) |
36 | 36 | article = find_article(environment.articles, params[:id]) |
37 | - Vote.create!(:voteable => article, :voter => nil, :vote => value) | |
38 | - {:vote => true} | |
37 | + vote = Vote.new(:voteable => article, :voter => current_person, :vote => value) | |
38 | + {:vote => vote.save} | |
39 | 39 | end |
40 | 40 | |
41 | 41 | get ':id/children' do | ... | ... |