A platform for community discussion. Free, open, simple.
FIX: Email Send post has already been taken error (#16992)
Blake Erickson35e17ce115f9
diff --git a/app/models/post_reply_key.rb b/app/models/post_reply_key.rbindex 996f18a66aa..83686df18ba 100644--- a/app/models/post_reply_key.rb+++ b/app/models/post_reply_key.rb@@ -6,7 +6,7 @@ class PostReplyKey < ActiveRecord::Basebefore_validation { self.reply_key ||= self.class.generate_reply_key }- validates :post_id, presence: true, uniqueness: { scope: :user_id }+ validates :post_id, presence: truevalidates :user_id, presence: truevalidates :reply_key, presence: truediff --git a/spec/lib/email/sender_spec.rb b/spec/lib/email/sender_spec.rbindex 255753263ef..8045995edb9 100644--- a/spec/lib/email/sender_spec.rb+++ b/spec/lib/email/sender_spec.rb@@ -767,6 +767,14 @@ describe Email::Sender doexpect(post_reply_key.post_id).to eq(post.id)expect { email_sender.send }.to change { PostReplyKey.count }.by(0)end++ it 'should find existing key' do+ existing_post_reply_key = PostReplyKey.create(post_id: post.id, user_id: user.id)+ expect { email_sender.send }.to change { PostReplyKey.count }.by(0)+ post_reply_key = PostReplyKey.last+ expect(post_reply_key).to eq(existing_post_reply_key)+ end+endendend