Commit 3cca23edb983de2c10d87bc3a1b93fb70d5c956d
1 parent
02cbe113
Exists in
staging
and in
1 other branch
fix merge conflit
Showing
3 changed files
with
4 additions
and
15 deletions
Show diff stats
lib/noosfero/api/entities.rb
... | ... | @@ -205,14 +205,15 @@ module Noosfero |
205 | 205 | class User < Entity |
206 | 206 | root 'users', 'user' |
207 | 207 | |
208 | - attrs = [:id,:login,:email] | |
208 | + attrs = [:id,:login,:email,:activated?] | |
209 | + aliases = {:activated? => :activated} | |
209 | 210 | |
210 | 211 | attrs.each do |attribute| |
211 | - expose attribute, :if => lambda{|user,options| Entities.can_display?(user.person, options, attribute)} | |
212 | + name = aliases.has_key?(attribute) ? aliases[attribute] : attribute | |
213 | + expose attribute, :as => name, :if => lambda{|user,options| Entities.can_display?(user.person, options, attribute)} | |
212 | 214 | end |
213 | 215 | |
214 | 216 | expose :person, :using => Person |
215 | - expose :activated?, as: :activated | |
216 | 217 | expose :permissions, :if => lambda{|user,options| Entities.can_display?(user.person, options, :permissions, :self)} do |user, options| |
217 | 218 | output = {} |
218 | 219 | user.person.role_assignments.map do |role_assigment| | ... | ... |
test/api/articles_test.rb
... | ... | @@ -207,14 +207,6 @@ class ArticlesTest < ActiveSupport::TestCase |
207 | 207 | end |
208 | 208 | end |
209 | 209 | |
210 | - should 'not update hit attribute of a specific child if a article is archived' do | |
211 | - folder = fast_create(Folder, :profile_id => user.person.id, :archived => true) | |
212 | - article = fast_create(Article, :parent_id => folder.id, :profile_id => user.person.id) | |
213 | - get "/api/v1/articles/#{folder.id}/children/#{article.id}?#{params.to_query}" | |
214 | - json = JSON.parse(last_response.body) | |
215 | - assert_equal 0, json['article']['hits'] | |
216 | - end | |
217 | - | |
218 | 210 | should 'find archived articles' do |
219 | 211 | article1 = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") |
220 | 212 | article2 = fast_create(Article, :profile_id => user.person.id, :name => "Some thing", :archived => true) | ... | ... |
test/api/helpers_test.rb
... | ... | @@ -140,10 +140,6 @@ class APIHelpersTest < ActiveSupport::TestCase |
140 | 140 | assert_not_nil make_conditions_with_parameter('until' => '2010-10-10')[:created_at] |
141 | 141 | end |
142 | 142 | |
143 | - should 'make_conditions_with_parameter return archived parameter if archived was defined' do | |
144 | - assert_not_nil make_conditions_with_parameter('archived' => true)[:archived] | |
145 | - end | |
146 | - | |
147 | 143 | should 'make_conditions_with_parameter return created_at as the first existent date as parameter if only until is defined' do |
148 | 144 | assert_equal Time.at(0).to_datetime, make_conditions_with_parameter(:until => '2010-10-10')[:created_at].min |
149 | 145 | end | ... | ... |