mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:45:26 +08:00
large refactor, ship a few columns from the user table into user_stats
This commit is contained in:
@ -39,9 +39,10 @@ describe BoostTrustLevel do
|
||||
context "for a user that has done the requisite things to attain their trust level" do
|
||||
|
||||
before do
|
||||
user.topics_entered = SiteSetting.basic_requires_topics_entered + 1
|
||||
user.posts_read_count = SiteSetting.basic_requires_read_posts + 1
|
||||
user.time_read = SiteSetting.basic_requires_time_spent_mins * 60
|
||||
stat = user.user_stat
|
||||
stat.topics_entered = SiteSetting.basic_requires_topics_entered + 1
|
||||
stat.posts_read_count = SiteSetting.basic_requires_read_posts + 1
|
||||
stat.time_read = SiteSetting.basic_requires_time_spent_mins * 60
|
||||
user.save!
|
||||
user.update_attributes(trust_level: TrustLevel.levels[:basic])
|
||||
end
|
||||
|
@ -163,12 +163,15 @@ describe PostCreator do
|
||||
topic_user.seen_post_count.should == first_post.post_number
|
||||
|
||||
user2 = Fabricate(:coding_horror)
|
||||
user2.topic_reply_count.should == 0
|
||||
first_post.user.reload.topic_reply_count.should == 0
|
||||
user2.user_stat.topic_reply_count.should == 0
|
||||
|
||||
first_post.user.user_stat.reload.topic_reply_count.should == 0
|
||||
|
||||
PostCreator.new(user2, topic_id: first_post.topic_id, raw: "this is my test post 123").create
|
||||
user2.reload.topic_reply_count.should == 1
|
||||
first_post.user.reload.topic_reply_count.should == 0
|
||||
|
||||
first_post.user.user_stat.reload.topic_reply_count.should == 0
|
||||
|
||||
user2.user_stat.reload.topic_reply_count.should == 1
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,9 +27,10 @@ describe Promotion do
|
||||
context "that has done the requisite things" do
|
||||
|
||||
before do
|
||||
user.topics_entered = SiteSetting.basic_requires_topics_entered
|
||||
user.posts_read_count = SiteSetting.basic_requires_read_posts
|
||||
user.time_read = SiteSetting.basic_requires_time_spent_mins * 60
|
||||
stat = user.user_stat
|
||||
stat.topics_entered = SiteSetting.basic_requires_topics_entered
|
||||
stat.posts_read_count = SiteSetting.basic_requires_read_posts
|
||||
stat.time_read = SiteSetting.basic_requires_time_spent_mins * 60
|
||||
@result = promotion.review
|
||||
end
|
||||
|
||||
@ -64,13 +65,14 @@ describe Promotion do
|
||||
context "that has done the requisite things" do
|
||||
|
||||
before do
|
||||
user.topics_entered = SiteSetting.regular_requires_topics_entered
|
||||
user.posts_read_count = SiteSetting.regular_requires_read_posts
|
||||
user.time_read = SiteSetting.regular_requires_time_spent_mins * 60
|
||||
user.days_visited = SiteSetting.regular_requires_days_visited * 60
|
||||
user.likes_received = SiteSetting.regular_requires_likes_received
|
||||
user.likes_given = SiteSetting.regular_requires_likes_given
|
||||
user.topic_reply_count = SiteSetting.regular_requires_topic_reply_count
|
||||
stat = user.user_stat
|
||||
stat.topics_entered = SiteSetting.regular_requires_topics_entered
|
||||
stat.posts_read_count = SiteSetting.regular_requires_read_posts
|
||||
stat.time_read = SiteSetting.regular_requires_time_spent_mins * 60
|
||||
stat.days_visited = SiteSetting.regular_requires_days_visited * 60
|
||||
stat.likes_received = SiteSetting.regular_requires_likes_received
|
||||
stat.likes_given = SiteSetting.regular_requires_likes_given
|
||||
stat.topic_reply_count = SiteSetting.regular_requires_topic_reply_count
|
||||
|
||||
@result = promotion.review
|
||||
end
|
||||
|
Reference in New Issue
Block a user