DG IZ the group should view the posts for the group (and yourself) w

This commit is contained in:
ilya 2010-08-17 12:22:14 -07:00
parent 2af41a0ea9
commit 2a90e59f1e
3 changed files with 7 additions and 4 deletions

View file

@ -28,9 +28,12 @@ class GroupsController < ApplicationController
end
def show
@people_ids = @group.people.map {|p| p.id}
@posts = Post.paginate :person_id => @people_ids, :order => 'created_at DESC'
@people_ids = @group.person_ids
@group = Group.first(:id => params[:id])
@posts = current_user.posts_for( :group => @group ).paginate :order => 'created_at DESC'
#@posts = Post.paginate :person_id => @people_ids, :order => 'created_at DESC'
end
def edit

View file

@ -56,7 +56,7 @@ class User
def posts_for( opts = {} )
if opts[:group]
group = self.groups.find_by_id( opts[:group].id )
self.posts.find_all_by_person_id( group.person_ids )
self.posts.find_all_by_person_id( (group.person_ids + [self.person.id] ), :order => "created_at desc")
end
end

View file

@ -346,7 +346,7 @@ describe User do
it 'should not override userrefs on receive by another person' do
@user3 = Factory.create :user
@user3.activate_friend(@user2, @group3)
@user3.activate_friend(@user2.person, @group3)
status_message = @user2.post :status_message, :message => "hi"
@user.receive status_message.to_diaspora_xml