Fix broken sorting by activity
This commit is contained in:
parent
989d178987
commit
160e01f7bd
5 changed files with 45 additions and 5 deletions
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
module ApplicationHelper
|
||||
@@youtube_title_cache = Hash.new("no-title")
|
||||
def time_for_sort post
|
||||
post.created_at
|
||||
end
|
||||
|
||||
def timeago(time, options={})
|
||||
options[:class] ||= "timeago"
|
||||
|
|
@ -285,7 +288,7 @@ module ApplicationHelper
|
|||
"(r)" => "®",
|
||||
"(c)" => "©"
|
||||
}
|
||||
|
||||
|
||||
map.each do |search, replace|
|
||||
message.gsub!(search, replace)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ module AspectsHelper
|
|||
aspects_path(:max_time => @posts.last.send(session[:sort_order].to_sym).to_i, :a_ids => params[:a_ids])
|
||||
end
|
||||
|
||||
def time_for_sort post
|
||||
post.send(session[:sort_order].to_sym)
|
||||
end
|
||||
|
||||
def remove_link(aspect)
|
||||
if aspect.contacts.size == 0
|
||||
link_to I18n.t('aspects.helper.remove'), aspect, :method => :delete, :confirm => I18n.t('aspects.helper.are_you_sure')
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
.content
|
||||
.from
|
||||
= person_link(post.author, :class => 'author')
|
||||
%time.time.timeago{:datetime => post.created_at, :integer => post.created_at.to_i}
|
||||
%time.time.timeago{:datetime => post.created_at, :integer => time_for_sort(post).to_i}
|
||||
= render 'status_messages/status_message', :post => post, :photos => post.photos
|
||||
|
||||
.info
|
||||
|
|
|
|||
|
|
@ -8,7 +8,39 @@ Feature: infinite scroll
|
|||
Given many posts from alice for bob
|
||||
When I sign in as "bob@bob.bob"
|
||||
|
||||
Scenario: on the main stream
|
||||
Scenario: on the main stream by activity
|
||||
Then I should see 15 posts
|
||||
And I should see "alice - 26 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 30 posts
|
||||
And I should see "alice - 11 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 40 posts
|
||||
And I should see "alice - 1 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see "No more"
|
||||
|
||||
When I follow "generic"
|
||||
And I wait for the ajax to finish
|
||||
Then I should see 15 posts
|
||||
And I should see "alice - 26 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 30 posts
|
||||
And I should see "alice - 11 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 40 posts
|
||||
And I should see "alice - 1 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see "No more"
|
||||
|
||||
Scenario: on the main stream post created time
|
||||
When I follow "post time"
|
||||
Then I should see 15 posts
|
||||
And I should see "alice - 15 - #seeded"
|
||||
|
||||
|
|
|
|||
|
|
@ -144,11 +144,12 @@ Given /^many posts from alice for bob$/ do
|
|||
alice = Factory(:user_with_aspect, :username => 'alice', :email => 'alice@alice.alice', :password => 'password', :getting_started => false)
|
||||
bob = Factory(:user_with_aspect, :username => 'bob', :email => 'bob@bob.bob', :password => 'password', :getting_started => false)
|
||||
connect_users_with_aspects(alice, bob)
|
||||
time_fulcrum = Time.now - 40000
|
||||
time_interval = 1000
|
||||
(1..40).each do |n|
|
||||
post = alice.post :status_message, :text => "#{alice.username} - #{n} - #seeded", :to => alice.aspects.first.id
|
||||
post.created_at = post.created_at - time_interval
|
||||
post.updated_at = post.updated_at - time_interval
|
||||
post.created_at = time_fulcrum - time_interval
|
||||
post.updated_at = time_fulcrum + time_interval
|
||||
post.save
|
||||
time_interval += 1000
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue