FIX: expire assets when CSS changes FIX: missing translation on share page (#528)
* FIX: expire assets when CSS changes FIX: missing translation on share page Also add trivial image styling * oops not needed
This commit is contained in:
parent
9d92dd76fb
commit
ea5c38686e
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
module DiscourseAi
|
||||
module AiBot
|
||||
module SharedAiConversationsHelper
|
||||
# bump up version when assets change
|
||||
# long term we may want to change this cause it is hard to remember
|
||||
# to bump versions, but for now this does the job
|
||||
VERSION = "1"
|
||||
|
||||
def share_asset_url(short_path)
|
||||
::UrlHelper.local_cdn_url("/plugins/discourse-ai/ai-share/#{short_path}?#{VERSION}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,8 +10,8 @@
|
|||
<meta name="twitter:title" content="<%= @shared_conversation.title %>">
|
||||
<meta name="twitter:description" content="<%= @shared_conversation.formatted_excerpt %>">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="<%= ::UrlHelper.local_cdn_url("/plugins/discourse-ai/ai-share/share.css") %>">
|
||||
<link rel="stylesheet" href="<%= ::UrlHelper.local_cdn_url("/plugins/discourse-ai/ai-share/highlight.min.css") %>">
|
||||
<link rel="stylesheet" href="<%= share_asset_url("share.css") %>">
|
||||
<link rel="stylesheet" href="<%= share_asset_url("highlight.min.css") %>">
|
||||
<script>
|
||||
window.hljs_initHighlighting = function() {
|
||||
document.querySelectorAll('pre code').forEach((el) => {
|
||||
|
@ -19,7 +19,7 @@
|
|||
});
|
||||
};
|
||||
</script>
|
||||
<script async src="<%= ::UrlHelper.local_cdn_url("/plugins/discourse-ai/ai-share/highlight.min.js") %>" onload="window.hljs_initHighlighting()" ></script>
|
||||
<script async src="<%= share_asset_url("highlight.min.js") %>" onload="window.hljs_initHighlighting()" ></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
|
@ -42,7 +42,6 @@
|
|||
<span><%= @shared_conversation.llm_name %></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
<header class="page-header">
|
||||
<h1><%= @shared_conversation.title %></h1>
|
||||
|
|
|
@ -158,13 +158,13 @@ en:
|
|||
share_ai:
|
||||
read_more: "Read full transcript"
|
||||
onebox_title: "AI Conversation with %{llm_name}"
|
||||
formatted_excerpt: "AI Conversation with %{llm_name}:\n %{excerpt}"
|
||||
errors:
|
||||
not_allowed: "You are not allowed to share this topic"
|
||||
other_people_in_pm: "Personal messages with other humans cannot be shared publicly"
|
||||
other_content_in_pm: "Personal messages containing posts from other people cannot be shared publicly"
|
||||
failed_to_share: "Failed to share the conversation"
|
||||
conversation_deleted: "Conversation share deleted successfully"
|
||||
formatted_excerpt: "AI Conversation with %{llm_name}:\n %{excerpt}"
|
||||
ai_bot:
|
||||
personas:
|
||||
cannot_delete_system_persona: "System personas cannot be deleted, please disable it instead"
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
--font-up-4: 1.7511em;
|
||||
--font-up-3: 1.5157em;
|
||||
--font-up-2: 1.3195em;
|
||||
--font-up-1: 1.1487em;
|
||||
--font-up-1: 1.1487em;
|
||||
--font-0: 1em;
|
||||
--font-down-1: 0.8706em;
|
||||
--font-down-2: 0.7579em;
|
||||
--font-down-1: 0.8706em;
|
||||
--font-down-2: 0.7579em;
|
||||
--font-down-3: 0.6599em;
|
||||
--font-down-4: 0.5745em;
|
||||
--font-down-5: 0.5em;
|
||||
|
@ -216,7 +216,7 @@ article {
|
|||
}
|
||||
article:last-of-type:hover {
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pre, code {
|
||||
|
@ -290,7 +290,7 @@ h1 h2 h3 h4 h5 h6 {
|
|||
.post__content p:last-child {
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
|
||||
.post__date {
|
||||
color: var(--primary-500);
|
||||
margin-left: auto;
|
||||
|
@ -377,3 +377,13 @@ li, p {
|
|||
word-break: break-word;
|
||||
}
|
||||
|
||||
.lightbox-wrapper .meta svg, .lightbox-wrapper .meta .informations {
|
||||
display: none;
|
||||
}
|
||||
.lightbox-wrapper .meta .filename {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@ RSpec.describe DiscourseAi::AiBot::SharedAiConversationsController do
|
|||
expect(response).to have_http_status(:success)
|
||||
expect(response.headers["Cache-Control"]).to eq("max-age=60, public")
|
||||
expect(response.headers["X-Robots-Tag"]).to eq("noindex")
|
||||
expect(response.body).not_to include("Translation missing")
|
||||
end
|
||||
|
||||
it "is also able to render in json format" do
|
||||
|
|
Loading…
Reference in New Issue