Reactions reset entropy

This commit is contained in:
Jorge Manrubia
2025-06-05 16:07:19 +02:00
parent ae6813ba0a
commit 0cb5b9ecd6
3 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ module Mentions
end
def mentionable_content_changed?
rich_text_associations.any? { send(it.name).body_previously_changed? }
rich_text_associations.any? { send(it.name)&.body_previously_changed? }
end
def create_mentions_later
+7
View File
@@ -4,7 +4,14 @@ class Reaction < ApplicationRecord
scope :ordered, -> { order(:created_at) }
after_create :register_card_activity
def all_emoji?
content.match? /\A(\p{Emoji_Presentation}|\p{Extended_Pictographic}|\uFE0F)+\z/u
end
private
def register_card_activity
comment.card.touch_last_active_at
end
end
+13
View File
@@ -0,0 +1,13 @@
require "test_helper"
class ReactionTest < ActiveSupport::TestCase
setup do
Current.session = sessions(:david)
end
test "creating a reaction touches the card activity" do
assert_changes -> { cards(:logo).reload.last_active_at } do
comments(:logo_1).reactions.create!(content: "Nice!")
end
end
end