Class: Collavre::Comment
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ApplicationRecord
- Collavre::Comment
- Includes:
- Approvable, Broadcastable, Notifiable
- Defined in:
- app/models/collavre/comment.rb,
app/models/collavre/comment/approvable.rb,
app/models/collavre/comment/notifiable.rb,
app/models/collavre/comment/broadcastable.rb
Defined Under Namespace
Modules: Approvable, Broadcastable, Notifiable
Constant Summary collapse
- STREAMING_PLACEHOLDER_CONTENT =
"..."
Instance Method Summary collapse
-
#creative_snippet ⇒ Object
public for db migration.
-
#dispatch_payload ⇒ Object
Build the dispatch payload for comment_created events.
- #next_version_number ⇒ Object
- #review_message? ⇒ Boolean
-
#to_partial_path ⇒ Object
Use non-namespaced partial path for backward compatibility.
Methods included from Approvable
#approval_status, #can_be_approved_by?, #parsed_action_tool_name
Methods included from Notifiable
#mentioned_users, #notify_ai_completion
Instance Method Details
#creative_snippet ⇒ Object
public for db migration
75 76 77 |
# File 'app/models/collavre/comment.rb', line 75 def creative_snippet creative.creative_snippet end |
#dispatch_payload ⇒ Object
Build the dispatch payload for comment_created events. Used by both after_create_commit callback and DropTriggerJob to ensure a single source of truth (no payload drift).
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'app/models/collavre/comment.rb', line 82 def dispatch_payload { comment: { id: id, content: content, user_id: user_id, from_ai: user&.searchable? || false, quoted_comment_id: quoted_comment_id }.compact, creative: { id: creative_id, description: creative&.description }, topic: { id: topic_id }, chat: { content: content } } end |
#next_version_number ⇒ Object
66 67 68 |
# File 'app/models/collavre/comment.rb', line 66 def next_version_number (comment_versions.maximum(:version_number) || 0) + 1 end |
#review_message? ⇒ Boolean
70 71 72 |
# File 'app/models/collavre/comment.rb', line 70 def quoted_comment_id.present? && !review_type_question? end |
#to_partial_path ⇒ Object
Use non-namespaced partial path for backward compatibility
8 9 10 |
# File 'app/models/collavre/comment.rb', line 8 def to_partial_path "comments/comment" end |