Skip to content
Extraits de code Groupes Projets
Valider b2b60af8 rédigé par Daniel Vincent Grippi's avatar Daniel Vincent Grippi
Parcourir les fichiers

Albums_by_aspect now takes :all

parent 1b92bcd1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -24,7 +24,7 @@ class AlbumsController < ApplicationController ...@@ -24,7 +24,7 @@ class AlbumsController < ApplicationController
respond_to :json, :only => [:index, :show] respond_to :json, :only => [:index, :show]
def index def index
@albums = Album.mine_or_friends(params[:friends], current_user).paginate :page => params[:page], :order => 'created_at DESC' @albums = current_user.albums_by_aspect(@aspect)
respond_with @albums respond_with @albums
end end
......
...@@ -79,7 +79,7 @@ module Diaspora ...@@ -79,7 +79,7 @@ module Diaspora
end end
def albums_by_aspect aspect def albums_by_aspect aspect
aspect.posts.find_all_by__type("Album") aspect == :all ? raw_visible_posts.find_all_by__type("Album") : aspect.posts.find_all_by__type("Album")
end end
end end
end end
......
...@@ -77,6 +77,10 @@ describe User do ...@@ -77,6 +77,10 @@ describe User do
@user.reload @user.reload
end end
it 'should find all albums if passed :all' do
@user.albums_by_aspect(:all).size.should == 3
end
it 'should return the right number of albums' do it 'should return the right number of albums' do
@user.albums_by_aspect(@aspect).size.should == 2 @user.albums_by_aspect(@aspect).size.should == 2
@user.albums_by_aspect(@aspect2).size.should == 1 @user.albums_by_aspect(@aspect2).size.should == 1
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter