Revert "Replace House with Lexical"
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ class Card < ApplicationRecord
|
||||
has_many :comments, dependent: :destroy
|
||||
has_one_attached :image, dependent: :purge_later
|
||||
|
||||
has_rich_text :description
|
||||
has_markdown :description
|
||||
|
||||
before_save :set_default_title, if: :published?
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class Comment < ApplicationRecord
|
||||
belongs_to :creator, class_name: "User", default: -> { Current.user }
|
||||
has_many :reactions, dependent: :delete_all
|
||||
|
||||
has_rich_text :body
|
||||
has_markdown :body
|
||||
searchable_by :body_plain_text, using: :comments_search_index, as: :body
|
||||
|
||||
scope :chronologically, -> { order created_at: :asc, id: :desc }
|
||||
@@ -19,10 +19,6 @@ class Comment < ApplicationRecord
|
||||
end
|
||||
|
||||
private
|
||||
def body_plain_text
|
||||
body.to_plain_text
|
||||
end
|
||||
|
||||
def watch_card_by_creator
|
||||
card.watch_by creator
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ module Mentions
|
||||
end
|
||||
|
||||
def mentionable_content
|
||||
rich_text_associations.collect { send(it.name)&.to_plain_text }.compact.join(" ")
|
||||
markdown_associations.collect { send(it.name)&.to_plain_text }.compact.join(" ")
|
||||
end
|
||||
|
||||
private
|
||||
@@ -32,12 +32,12 @@ module Mentions
|
||||
collection.users
|
||||
end
|
||||
|
||||
def rich_text_associations
|
||||
self.class.reflect_on_all_associations(:has_one).filter { it.klass == ActionText::RichText }
|
||||
def markdown_associations
|
||||
self.class.reflect_on_all_associations(:has_one).filter { it.klass == ActionText::Markdown }
|
||||
end
|
||||
|
||||
def mentionable_content_changed?
|
||||
rich_text_associations.any? { send(it.name).body_previously_changed? }
|
||||
markdown_associations.any? { send(it.name).content_previously_changed? }
|
||||
end
|
||||
|
||||
def create_mentions_later
|
||||
|
||||
Reference in New Issue
Block a user