Revert "FIX: Create post notices only for public posts (#8708)"

This reverts commit c2d051315d.
This commit is contained in:
Dan Ungureanu 2020-01-30 14:24:56 +02:00
parent 33abd68bdf
commit bf50087d72
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
2 changed files with 1 additions and 11 deletions

View File

@ -542,12 +542,8 @@ class PostCreator
def create_post_notice def create_post_notice
return if @opts[:import_mode] || @user.anonymous? || @user.bot? || @user.staged return if @opts[:import_mode] || @user.anonymous? || @user.bot? || @user.staged
return if @post.topic.archetype != Archetype.default
last_post_time = Post last_post_time = Post.where(user_id: @user.id)
.joins("JOIN topics ON topics.id = posts.topic_id")
.where(user_id: @user.id)
.where(topics: { archetype: Archetype.default })
.order(created_at: :desc) .order(created_at: :desc)
.limit(1) .limit(1)
.pluck(:created_at) .pluck(:created_at)

View File

@ -1359,9 +1359,6 @@ describe PostCreator do
fab!(:anonymous) { Fabricate(:anonymous) } fab!(:anonymous) { Fabricate(:anonymous) }
it "generates post notices for new users" do it "generates post notices for new users" do
post = PostCreator.create!(user, title: "private message topic", raw: "private message post", archetype: Archetype.private_message, target_usernames: user.username)
expect(post.custom_fields[Post::NOTICE_TYPE]).to eq(nil)
post = PostCreator.create!(user, title: "one of my first topics", raw: "one of my first posts") post = PostCreator.create!(user, title: "one of my first topics", raw: "one of my first posts")
expect(post.custom_fields[Post::NOTICE_TYPE]).to eq(Post.notices[:new_user]) expect(post.custom_fields[Post::NOTICE_TYPE]).to eq(Post.notices[:new_user])
@ -1373,9 +1370,6 @@ describe PostCreator do
SiteSetting.returning_users_days = 30 SiteSetting.returning_users_days = 30
old_post = Fabricate(:post, user: user, created_at: 31.days.ago) old_post = Fabricate(:post, user: user, created_at: 31.days.ago)
post = PostCreator.create!(user, title: "private message topic", raw: "private message post", archetype: Archetype.private_message, target_usernames: user.username)
expect(post.custom_fields[Post::NOTICE_TYPE]).to eq(nil)
post = PostCreator.create!(user, title: "this is a returning topic", raw: "this is a post") post = PostCreator.create!(user, title: "this is a returning topic", raw: "this is a post")
expect(post.custom_fields[Post::NOTICE_TYPE]).to eq(Post.notices[:returning_user]) expect(post.custom_fields[Post::NOTICE_TYPE]).to eq(Post.notices[:returning_user])
expect(post.custom_fields[Post::NOTICE_ARGS]).to eq(old_post.created_at.iso8601) expect(post.custom_fields[Post::NOTICE_ARGS]).to eq(old_post.created_at.iso8601)