From eced5f5bbce414d178f64eb1168841a9decfd54d Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 18 Jun 2015 10:29:09 -0300 Subject: [PATCH] api: validate follower --- lib/noosfero/api/v1/articles.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/noosfero/api/v1/articles.rb b/lib/noosfero/api/v1/articles.rb index 78120c3..0c7b31d 100644 --- a/lib/noosfero/api/v1/articles.rb +++ b/lib/noosfero/api/v1/articles.rb @@ -39,7 +39,7 @@ module Noosfero desc "Add a follower for the article" post ':id/follow' do article = find_article(environment.articles, params[:id]) - if article.article_followers.include?(current_person) + if article.article_followers.exists?(:person_id => current_person.id) {:success => false, :already_follow => true} else article_follower = ArticleFollower.new -- libgit2 0.21.2