Fix pages after 1 on tag page
This commit is contained in:
parent
05d05046bb
commit
b4e36878fe
6 changed files with 27 additions and 5 deletions
|
|
@ -52,7 +52,11 @@ class TagsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@posts = @posts.tagged_with(params[:name])
|
@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)
|
@posts = PostsFake.new(@posts)
|
||||||
@commenting_disabled = true
|
@commenting_disabled = true
|
||||||
|
|
|
||||||
|
|
@ -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
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
|
||||||
9
app/helpers/tags_helper.rb
Normal file
9
app/helpers/tags_helper.rb
Normal file
|
|
@ -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
|
||||||
|
|
@ -96,7 +96,7 @@ class User < ActiveRecord::Base
|
||||||
contact = contact_for(person)
|
contact = contact_for(person)
|
||||||
|
|
||||||
add_contact_to_aspect(contact, to_aspect)
|
add_contact_to_aspect(contact, to_aspect)
|
||||||
|
|
||||||
membership = contact ? AspectMembership.where(:contact_id => contact.id, :aspect_id => from_aspect.id).first : nil
|
membership = contact ? AspectMembership.where(:contact_id => contact.id, :aspect_id => from_aspect.id).first : nil
|
||||||
return(membership && membership.destroy)
|
return(membership && membership.destroy)
|
||||||
end
|
end
|
||||||
|
|
@ -344,5 +344,4 @@ class User < ActiveRecord::Base
|
||||||
mentioned_person.delete
|
mentioned_person.delete
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
- if @posts.length > 0
|
- if @posts.length > 0
|
||||||
= render 'shared/stream', :posts => @posts
|
= render 'shared/stream', :posts => @posts
|
||||||
#pagination
|
#pagination
|
||||||
=link_to(t('more'), tag_path(params[:name], :page => next_page), :class => 'paginate')
|
=link_to(t('more'), next_page_path, :class => 'paginate')
|
||||||
- else
|
- else
|
||||||
= t('.nobody_talking', :tag => "##{params[:name]}")
|
= t('.nobody_talking', :tag => "##{params[:name]}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,13 @@ Feature: infinite scroll
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
Then I should see 30 posts
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue