6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/concerns/collavre/comments/conversion.rb', line 6
def convert
unless
render json: { error: I18n.t("collavre.comments.convert_not_allowed") }, status: :forbidden and return
end
created_creatives = ::MarkdownImporter.import(
@comment.content,
parent: @creative,
user: @creative.user,
create_root: true
)
primary_creative = created_creatives.first
system_message = build_convert_system_message(primary_creative) if primary_creative
@comment.destroy
if system_message.present?
Current.set(session: nil) do
@creative..create!(content: system_message, user: nil)
end
end
head :no_content
end
|