diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 1c721888..a5de03be 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "line": 92.3 + "line": 92.45 } } diff --git a/lib/custom_wizard/notice.rb b/lib/custom_wizard/notice.rb index 335ccbd4..8d41d634 100644 --- a/lib/custom_wizard/notice.rb +++ b/lib/custom_wizard/notice.rb @@ -125,7 +125,7 @@ class CustomWizard::Notice if PLUGIN_STATUSES_TO_WARN.include?(plugin_status[:status]) notice = { - message: PrettyText.cook(I18n.t('wizard.notice.compatibility_issue', domain: plugin_status_domain)), + message: I18n.t('wizard.notice.compatibility_issue', domain: plugin_status_domain), type: types[:plugin_status_warning], created_at: plugin_status[:status_changed_at] } @@ -138,7 +138,7 @@ class CustomWizard::Notice def self.notify_connection_errors(connection_type_key) domain = self.send("#{connection_type_key.to_s}_domain") - message = PrettyText.cook(I18n.t("wizard.notice.#{connection_type_key.to_s}.connection_error_limit", domain: domain)) + message = I18n.t("wizard.notice.#{connection_type_key.to_s}.connection_error_limit", domain: domain) notices = list(type: types[:connection_error], message: message) if notices.any? @@ -221,7 +221,7 @@ class CustomWizard::Notice query = PluginStoreRow.where(plugin_name: namespace) query = query.where("(value::json->>'expired_at') IS NULL#{include_recently_expired ? " OR (value::json->>'expired_at')::date > now()::date - 1" : ""}") query = query.where("(value::json->>'type')::integer = ?", type) if type - query = query.where("(value::json->>'message') = ?", message) if message + query = query.where("(value::json->>'message')::text = ?", message) if message query.order("value::json->>'created_at' DESC") end diff --git a/serializers/custom_wizard/notice_serializer.rb b/serializers/custom_wizard/notice_serializer.rb index 48b7b381..5564de1f 100644 --- a/serializers/custom_wizard/notice_serializer.rb +++ b/serializers/custom_wizard/notice_serializer.rb @@ -18,4 +18,8 @@ class CustomWizard::NoticeSerializer < ApplicationSerializer def type CustomWizard::Notice.types.key(object.type) end + + def messsage + PrettyText.cook(object.message) + end end diff --git a/spec/components/custom_wizard/notice_spec.rb b/spec/components/custom_wizard/notice_spec.rb index ef29ea21..b51305e1 100644 --- a/spec/components/custom_wizard/notice_spec.rb +++ b/spec/components/custom_wizard/notice_spec.rb @@ -54,7 +54,7 @@ describe CustomWizard::Notice do it "converts warning into notice" do notice = described_class.list.first expect(notice.type).to eq(described_class.types[:plugin_status_warning]) - expect(notice.message).to eq(PrettyText.cook(I18n.t("wizard.notice.compatibility_issue", server: described_class.plugin_status_domain))) + expect(notice.message).to eq(I18n.t("wizard.notice.compatibility_issue", domain: described_class.plugin_status_domain)) expect(notice.created_at.to_datetime).to be_within(1.second).of (plugin_status[:status_changed_at].to_datetime) end