diff --git a/Gemfile b/Gemfile index 2ef940e03..e03f34389 100755 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ gem "rollbar" gem "scenic" gem "secure_headers" gem "tzinfo" # For validation of user selected timezone names +gem "tzinfo-data" # For validation of user selected timezone names gem "valid_url" gem "thwait" gem "lograge" # Used to filter repetitive RabbitMQ logs. diff --git a/Gemfile.lock b/Gemfile.lock index 9a7d7c5bd..2bfa6a17d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -364,6 +364,8 @@ GEM trailblazer-option (0.1.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + tzinfo-data (1.2024.2) + tzinfo (>= 1.0.0) uber (0.1.0) uri (0.13.1) valid_url (0.0.4) @@ -424,6 +426,7 @@ DEPENDENCIES simplecov-cobertura thwait tzinfo + tzinfo-data valid_url webmock diff --git a/config/application.rb b/config/application.rb index d5a8a1dfd..a4638908c 100755 --- a/config/application.rb +++ b/config/application.rb @@ -102,7 +102,7 @@ class Application < Rails::Application ), form_action: %w('self'), frame_src: %w(*), # We need "*" to support webcam users. - frame_ancestors: %w('none'), + frame_ancestors: %w('self' https://farm.bot), img_src: %w(* data:), # We need "*" to support webcam users. manifest_src: %w('self'), media_src: %w(), diff --git a/frontend/css/farm_designer/farm_designer_panels.scss b/frontend/css/farm_designer/farm_designer_panels.scss index 05dc93c2e..bcfb8cbb6 100644 --- a/frontend/css/farm_designer/farm_designer_panels.scss +++ b/frontend/css/farm_designer/farm_designer_panels.scss @@ -129,7 +129,7 @@ height: 24rem; .location-info-panel { .panel-content { - max-height: calc(100vh - 47rem); + max-height: 19rem; } } } diff --git a/frontend/messages/__tests__/cards_test.tsx b/frontend/messages/__tests__/cards_test.tsx index fd6137aa4..fd926b059 100644 --- a/frontend/messages/__tests__/cards_test.tsx +++ b/frontend/messages/__tests__/cards_test.tsx @@ -47,6 +47,7 @@ import { buildResourceIndex } from "../../__test_support__/resource_index_builde import { fakeWizardStepResult } from "../../__test_support__/fake_state/resources"; import { Path } from "../../internal_urls"; import { API } from "../../api"; +import moment from "moment"; API.setBaseUrl(""); @@ -83,6 +84,7 @@ describe("", () => { expect(wrapper.text()).toContain("Your device has no firmware"); expect(wrapper.find(".fa-times").length).toEqual(0); expect(wrapper.text()).toContain("Apr"); + expect(wrapper.text()).toContain("2019"); expect(wrapper.text()).toContain("Select one"); }); @@ -237,6 +239,17 @@ describe("", () => { const wrapper = mount(); expect(wrapper.text()).not.toContain("Jan 1, 12:00am"); }); + + it("doesn't show current year", () => { + const p = fakeProps(); + p.alert.problem_tag = "farmbot_os.firmware.missing"; + p.alert.created_at = Date.now().valueOf() / 1000; + p.timeSettings.hour24 = false; + p.timeSettings.utcOffset = 0; + const wrapper = mount(); + const currentYear = moment().format("YYYY"); + expect(wrapper.text()).not.toContain(currentYear); + }); }); describe("changeFirmwareHardware()", () => { diff --git a/frontend/messages/cards.tsx b/frontend/messages/cards.tsx index 0dfef738d..90e2e4019 100644 --- a/frontend/messages/cards.tsx +++ b/frontend/messages/cards.tsx @@ -71,6 +71,8 @@ const timeOk = (timestamp: number) => timestamp > 1550000000; const AlertCardTemplate = (props: AlertCardTemplateProps) => { const { alert, findApiAlertById, dispatch, timeSettings } = props; + const thisYear = moment.unix(alert.created_at).year() == moment().year(); + const timeFormat = thisYear ? "MMM D" : "MMM D, YYYY"; return
@@ -78,7 +80,7 @@ const AlertCardTemplate = (props: AlertCardTemplateProps) => {

{t(props.title)}

{timeOk(alert.created_at) &&

- {formatTime(moment.unix(alert.created_at), timeSettings, "MMM D")} + {formatTime(moment.unix(alert.created_at), timeSettings, timeFormat)}

}
{alert.id && !props.noDismiss &&