Commit 80ff6c430c49464c08a12977205c3433554f9f6d

Authored by Victor Costa
2 parents 0b3f5d25 791be590

Merge branch 'production' of gitlab.com:participa/noosfero into production

@@ -30,6 +30,7 @@ gem 'rack-cors' @@ -30,6 +30,7 @@ gem 'rack-cors'
30 gem 'rack-contrib' 30 gem 'rack-contrib'
31 gem 'liquid', '~> 3.0.3' 31 gem 'liquid', '~> 3.0.3'
32 #gem 'grape-swagger-rails' 32 #gem 'grape-swagger-rails'
  33 +gem 'rubyzip'
33 34
34 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 35 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
35 # with their GEM names (not the Debian package names) 36 # with their GEM names (not the Debian package names)
app/models/person.rb
@@ -4,7 +4,7 @@ class Person < Profile @@ -4,7 +4,7 @@ class Person < Profile
4 attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, 4 attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone,
5 :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, 5 :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference,
6 :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, 6 :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study,
7 - :custom_area_of_study, :professional_activity, :organization_website, :following_articiles 7 + :custom_area_of_study, :professional_activity, :organization_website, :following_articles
8 8
9 SEARCH_FILTERS = { 9 SEARCH_FILTERS = {
10 :order => %w[more_recent more_popular more_active], 10 :order => %w[more_recent more_popular more_active],
@@ -89,7 +89,7 @@ class Person < Profile @@ -89,7 +89,7 @@ class Person < Profile
89 89
90 #Article followers relation 90 #Article followers relation
91 has_many :article_followers, :dependent => :destroy 91 has_many :article_followers, :dependent => :destroy
92 - has_many :following_articiles, :class_name => 'Article', :through => :article_followers, :source => :article 92 + has_many :following_articles, :class_name => 'Article', :through => :article_followers, :source => :article
93 93
94 has_many :friendships, :dependent => :destroy 94 has_many :friendships, :dependent => :destroy
95 has_many :friends, :class_name => 'Person', :through => :friendships 95 has_many :friends, :class_name => 'Person', :through => :friendships
lib/noosfero/api/helpers.rb
@@ -97,8 +97,8 @@ require 'grape' @@ -97,8 +97,8 @@ require 'grape'
97 present article, :with => Entities::Article, :fields => params[:fields] 97 present article, :with => Entities::Article, :fields => params[:fields]
98 end 98 end
99 99
100 - def present_articles(asset)  
101 - articles = find_articles(asset) 100 + def present_articles(asset, method = 'articles')
  101 + articles = find_articles(asset, method)
102 articles = paginate articles 102 articles = paginate articles
103 present articles, :with => Entities::Article, :fields => params[:fields] 103 present articles, :with => Entities::Article, :fields => params[:fields]
104 end 104 end
lib/noosfero/api/v1/articles.rb
@@ -25,6 +25,11 @@ module Noosfero @@ -25,6 +25,11 @@ module Noosfero
25 present_articles(environment) 25 present_articles(environment)
26 end 26 end
27 27
  28 + desc "Return the articles followed by me"
  29 + get 'followed_by_me' do
  30 + present_articles(current_person, 'following_articles')
  31 + end
  32 +
28 desc "Return the article id" 33 desc "Return the article id"
29 get ':id' do 34 get ':id' do
30 present_article(environment) 35 present_article(environment)
plugins/dialoga
1 -Subproject commit f2c1a6f92d8aa578a5427e5ca9dc500196ee3c19 1 +Subproject commit c11ebee2bbba65cea6a6e37bbc1614aa23988655
plugins/gamification
1 -Subproject commit 3707356af458d05624d3029b5829802f346bb3ae 1 +Subproject commit 2e1af6c93a27dbfd5c7f40e5f5d1acbe8ad5439a
test/unit/article_follower_test.rb
@@ -72,7 +72,7 @@ class ArticleFollowerTest < ActiveSupport::TestCase @@ -72,7 +72,7 @@ class ArticleFollowerTest < ActiveSupport::TestCase
72 article_follower.person = p1 72 article_follower.person = p1
73 article_follower.save! 73 article_follower.save!
74 74
75 - assert_equal p1.following_articiles.size, 2 75 + assert_equal p1.following_articles.size, 2
76 end 76 end
77 77
78 78