From 86fe11b27776b6a65acda7a5bfec0a458675b45d Mon Sep 17 00:00:00 2001 From: riking Date: Sat, 29 Mar 2014 15:26:13 -0700 Subject: [PATCH 1/2] Fix the 'posted' view Now is actually topics that you have posted in - previously, it was all topics you had tracked, starred, posted, read, .... No clue how that came about. --- lib/topic_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 9bdf3ffdfc1..8112bea0341 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -81,7 +81,7 @@ class TopicQuery end def list_posted - create_list(:posted) {|l| l.where('tu.user_id IS NOT NULL') } + create_list(:posted) {|l| l.where('tu.posted') } end def list_top_for(period) From df5229a39906e83b035bc87734a68c9ee5617f1a Mon Sep 17 00:00:00 2001 From: riking Date: Sun, 30 Mar 2014 14:13:06 -0700 Subject: [PATCH 2/2] Add spec for posted list The test fails on 956b14a and passes on this branch --- spec/components/topic_query_spec.rb | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rb index c7ed2d501d6..daa46de6b10 100644 --- a/spec/components/topic_query_spec.rb +++ b/spec/components/topic_query_spec.rb @@ -352,7 +352,40 @@ describe TopicQuery do it "includes the posted topic" do topics.include?(other_users_topic).should be_true end + end + context "topic you haven't posted in" do + let(:other_users_topic) { create_post(user: creator).topic } + + it "does not include the topic" do + topics.should be_blank + end + + context "but interacted with" do + it "is not included if starred" do + other_users_topic.toggle_star(user, true) + + topics.should be_blank + end + + it "is not included if read" do + TopicUser.update_last_read(user, other_users_topic.id, 0, 0) + + topics.should be_blank + end + + it "is not included if muted" do + other_users_topic.notify_muted!(user) + + topics.should be_blank + end + + it "is not included if tracking" do + other_users_topic.notify_tracking!(user) + + topics.should be_blank + end + end end end