mirror of
https://github.com/diaspora/diaspora.git
synced 2026-04-29 03:01:03 -04:00
Albums_by_aspect now takes :all
This commit is contained in:
@@ -24,7 +24,7 @@ class AlbumsController < ApplicationController
|
||||
respond_to :json, :only => [:index, :show]
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ module Diaspora
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@@ -77,6 +77,10 @@ describe User do
|
||||
@user.reload
|
||||
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
|
||||
@user.albums_by_aspect(@aspect).size.should == 2
|
||||
@user.albums_by_aspect(@aspect2).size.should == 1
|
||||
|
||||
Reference in New Issue
Block a user