diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b3e826077..e7437c454 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index a3a71a297..246fca82e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 805464409..169bdda43 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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