diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 05f2cc886..444c5627b 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -52,7 +52,11 @@ class TagsController < ApplicationController end @posts = @posts.tagged_with(params[:name]) - @posts = @posts.includes(:comments, :photos).order('created_at DESC').limit(15).offset(15*(params[:page]-1)) + + max_time = params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + @posts = @posts.where(StatusMessage.arel_table[:created_at].lt(max_time)) + + @posts = @posts.includes(:comments, :photos).order('posts.created_at DESC').limit(15) @posts = PostsFake.new(@posts) @commenting_disabled = true diff --git a/app/helpers/aspects_helper.rb b/app/helpers/aspects_helper.rb index 8461d633d..c495464f3 100644 --- a/app/helpers/aspects_helper.rb +++ b/app/helpers/aspects_helper.rb @@ -1,4 +1,4 @@ -#/ Copyright (c) 2010, Diaspora Inc. This file is +# Copyright (c) 2010, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb new file mode 100644 index 000000000..5e205fc55 --- /dev/null +++ b/app/helpers/tags_helper.rb @@ -0,0 +1,9 @@ +# Copyright (c) 2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + +module TagsHelper + def next_page_path + tag_path(@tag, :max_time => @posts.last.send(session[:sort_order].to_sym).to_i) + end +end diff --git a/app/models/user.rb b/app/models/user.rb index 2c01cca4a..93e0cce1b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -96,7 +96,7 @@ class User < ActiveRecord::Base contact = contact_for(person) add_contact_to_aspect(contact, to_aspect) - + membership = contact ? AspectMembership.where(:contact_id => contact.id, :aspect_id => from_aspect.id).first : nil return(membership && membership.destroy) end @@ -344,5 +344,4 @@ class User < ActiveRecord::Base mentioned_person.delete end end - end diff --git a/app/views/tags/show.haml b/app/views/tags/show.haml index 4b16d4476..fd6777f23 100644 --- a/app/views/tags/show.haml +++ b/app/views/tags/show.haml @@ -23,7 +23,7 @@ - if @posts.length > 0 = render 'shared/stream', :posts => @posts #pagination - =link_to(t('more'), tag_path(params[:name], :page => next_page), :class => 'paginate') + =link_to(t('more'), next_page_path, :class => 'paginate') - else = t('.nobody_talking', :tag => "##{params[:name]}") diff --git a/features/infinite_scroll.feature b/features/infinite_scroll.feature index ccc25d1aa..fa65f29e5 100644 --- a/features/infinite_scroll.feature +++ b/features/infinite_scroll.feature @@ -25,3 +25,13 @@ Feature: infinite scroll And I wait for the ajax to finish And I wait for the ajax to finish Then I should see 30 posts + + Scenario: On a tag page + When I sign in as "bob@bob.bob" + And I am on the tag page for "seeded" + Then I should see 15 posts + + When I scroll down + And I wait for the ajax to finish + And I wait for the ajax to finish + Then I should see 30 posts