Reactions reset entropy
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user