Revert "FIX: Skip key consistency check when creating the topic."

Revert “FIX: Skip key consistency check when creating the topic.”

This reverts commit bcc0fe9d15f61ae7b60b2821dcf772ef5db6e9c5.

diff --git a/plugin.rb b/plugin.rb
index 5a4a4d4..0b44607 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -215,7 +215,7 @@ after_initialize do
 
   # Delete TopicAllowedUser records for users who do not have the key.
   on(:post_created) do |post, opts, user|
-    if post.post_number > 1 && post.topic&.is_encrypted? && !DiscourseEncrypt::Store.get("key_#{post.topic_id}_#{user.id}").present?
+    if post.topic&.is_encrypted? && !DiscourseEncrypt::Store.get("key_#{post.topic_id}_#{user.id}").present?
       TopicAllowedUser.find_by(user_id: user.id, topic_id: post.topic_id).delete
     end
   end

GitHub sha: 768206f6

1 Like