Skip to content

Commit

Permalink
User#timeline and User#at_replies don't use the arguments they're bei…
Browse files Browse the repository at this point in the history
…ng passed anymore
  • Loading branch information
carols10cents committed Nov 21, 2012
1 parent 23a3c05 commit adacf3c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/controllers/updates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def index

def timeline
@list_class = "friends"
render_index(current_user.timeline(params))
render_index(current_user.timeline)
end

def replies
@list_class = "mentions"
render_index(current_user.at_replies(params))
render_index(current_user.at_replies)
end

def export
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ def following_url?(feed_url)
timestamps!

# Retrieve the list of Updates in the user's timeline
def timeline(params = nil)
def timeline
following_plus_me = following.map(&:author_id)
following_plus_me << self.author.id
Update.where(:author_id => following_plus_me).order(['created_at', 'descending'])
end

# Retrieve the list of Updates that are replies to this user
def at_replies(params)
def at_replies
Update.where(:text => /^@#{Regexp.quote(username)}\b/).order(['created_at', 'descending'])
end

Expand Down
8 changes: 4 additions & 4 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ def stub_superfeedr_request_for_user(user)
update = Fabricate(:update, :text => "@steve oh hai!")
Fabricate(:update, :text => "just some other update")

assert_equal 1, u.at_replies({}).count
assert_equal update.id, u.at_replies({}).first.id
assert_equal 1, u.at_replies.count
assert_equal update.id, u.at_replies.first.id
end

it "returns all at_replies for a username containing ." do
u = Fabricate(:user, :username => "hello.there")
u1 = Fabricate(:user, :username => "helloothere")
update = Fabricate(:update, :text => "@hello.there how _you_ doin'?")

assert_equal 1, u.at_replies({}).count
assert_equal 0, u1.at_replies({}).count
assert_equal 1, u.at_replies.count
assert_equal 0, u1.at_replies.count
end
end

Expand Down

0 comments on commit adacf3c

Please sign in to comment.