FIX: keep unique post checks separate for PMs vs topics (#17272)

This allows for people to use PMs for drafting and then post them on topics.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
Sam
2022-06-29 15:35:07 +10:00
committed by GitHub
parent 644e05cd4d
commit 6ecfdc8f55
2 changed files with 39 additions and 5 deletions

View File

@@ -248,7 +248,7 @@ class Post < ActiveRecord::Base
# The key we use in redis to ensure unique posts
def unique_post_key
"unique-post-#{user_id}:#{raw_hash}"
"unique#{topic&.private_message? ? "-pm" : ""}-post-#{user_id}:#{raw_hash}"
end
def store_unique_post_key