FIX: visual regression for new features (#29359)

Bug introduced in this PR https://github.com/discourse/discourse/pull/29244

When the experiment toggle button was introduced, new features did not look right when the toggle button was not available.

In addition, the plugin name can be an empty string. In that case, information about new features should be displayed.
This commit is contained in:
Krzysztof Kotlarek 2024-10-23 16:16:19 +11:00 committed by GitHub
parent 11b62847e7
commit cd077ef93b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 10 deletions

View File

@ -85,7 +85,6 @@ export default class DiscourseNewFeatureItem extends Component {
{{/if}} {{/if}}
</div> </div>
<div class="admin-new-feature-item__body">
{{#if @item.screenshot_url}} {{#if @item.screenshot_url}}
<img <img
src={{@item.screenshot_url}} src={{@item.screenshot_url}}
@ -94,6 +93,7 @@ export default class DiscourseNewFeatureItem extends Component {
/> />
{{/if}} {{/if}}
<div class="admin-new-feature-item__body">
<div class="admin-new-feature-item__feature-description"> <div class="admin-new-feature-item__feature-description">
<CookText @rawText={{@item.description}} /> <CookText @rawText={{@item.description}} />

View File

@ -662,6 +662,7 @@
.admin-new-feature-item__body { .admin-new-feature-item__body {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 1em;
.d-toggle-switch { .d-toggle-switch {
margin-left: 1em; margin-left: 1em;
align-items: flex-start; align-items: flex-start;
@ -670,6 +671,10 @@
margin-top: 0; margin-top: 0;
} }
} }
.admin-new-feature-item__screenshot {
margin-bottom: 1em;
}
.admin-new-feature-item__tooltip-header { .admin-new-feature-item__tooltip-header {
font-weight: bold; font-weight: bold;
} }

View File

@ -165,7 +165,7 @@ module DiscourseUpdates
Discourse.has_needed_version?(current_version, item["discourse_version"]) Discourse.has_needed_version?(current_version, item["discourse_version"])
valid_plugin_name = valid_plugin_name =
item["plugin_name"].nil? || Discourse.plugins_by_name[item["plugin_name"]].present? item["plugin_name"].blank? || Discourse.plugins_by_name[item["plugin_name"]].present?
valid_version && valid_plugin_name valid_version && valid_plugin_name
rescue StandardError rescue StandardError

View File

@ -291,6 +291,7 @@ RSpec.describe DiscourseUpdates do
"created_at" => 2.days.ago, "created_at" => 2.days.ago,
"plugin_name" => "discourse-ai", "plugin_name" => "discourse-ai",
}, },
{ "emoji" => "🙈", "title" => "Whistles", "created_at" => 3.days.ago, "plugin_name" => "" },
{ {
"emoji" => "🙈", "emoji" => "🙈",
"title" => "Confetti", "title" => "Confetti",
@ -303,8 +304,9 @@ RSpec.describe DiscourseUpdates do
DiscourseUpdates.last_installed_version = "2.7.0.beta2" DiscourseUpdates.last_installed_version = "2.7.0.beta2"
result = DiscourseUpdates.new_features result = DiscourseUpdates.new_features
expect(result.length).to eq(1) expect(result.length).to eq(2)
expect(result[0]["title"]).to eq("Bells") expect(result[0]["title"]).to eq("Bells")
expect(result[1]["title"]).to eq("Whistles")
end end
end end