From 7e873f4a774e33d3fab0954f99b4665a88efbb1d Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Mon, 9 Jun 2025 16:22:28 +1000 Subject: [PATCH] might as well use the local format when in the share dialog --- app/models/ai_artifact.rb | 10 +++++++++- .../components/modal/share-full-topic-modal.gjs | 9 +++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/models/ai_artifact.rb b/app/models/ai_artifact.rb index 8de09602..8abc8421 100644 --- a/app/models/ai_artifact.rb +++ b/app/models/ai_artifact.rb @@ -18,13 +18,21 @@ class AiArtifact < ActiveRecord::Base https://code.jquery.com ] + def self.artifact_version_attribute(version) + if version + "data-artifact-version='#{version}'" + else + "" + end + end + def self.iframe_for(id, version = nil) <<~HTML
HTML diff --git a/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs b/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs index b0bf2c02..73c1b8cf 100644 --- a/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs +++ b/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs @@ -96,9 +96,14 @@ export default class ShareModal extends Component { } event.stopPropagation(); event.preventDefault(); - const iframeEmbed = ``; + + let version = ""; + if (event.target.dataset.artifactVersion) { + version = `data-ai-artifact-version="${event.target.dataset.artifactVersion}"`; + } + const artifactEmbed = `
`; const promise = new Promise((resolve) => { - resolve(iframeEmbed); + resolve(artifactEmbed); }); await clipboardCopyAsync(() => promise);