From 154cd202b29186ede9850f9807ac4dc76eda6e34 Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Fri, 19 Apr 2024 15:12:24 -0400 Subject: [PATCH] Add safe navigation to article.displayable_published_at.year (#20873) --- .../dashboards/_dashboard_article_row.html.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/dashboards/_dashboard_article_row.html.erb b/app/views/dashboards/_dashboard_article_row.html.erb index 29f777921..1863b6246 100644 --- a/app/views/dashboards/_dashboard_article_row.html.erb +++ b/app/views/dashboards/_dashboard_article_row.html.erb @@ -16,7 +16,7 @@ <% if article.published %>

<%= t("views.dashboard.article.#{article.scheduled? ? 'scheduled_at' : 'published'}") %> - <%= local_date(article.published_timestamp, show_year: article.displayable_published_at.year != Time.current.year) %> + <%= local_date(article.published_timestamp, show_year: article.displayable_published_at&.year != Time.current.year) %> <% if article.edited? %> <%= t("views.dashboard.article.edited") %> <%= local_date(article.edited_at, show_year: article.edited_at.year != Time.current.year) %> @@ -122,7 +122,7 @@

- <%= f.select :user_id, options_for_select(organization.users.pluck(:name, :id), article.user_id), {}, { class: "crayons-select #{article_series ? 'disabled': ''}", disabled: article_series } %> + <%= f.select :user_id, options_for_select(organization.users.pluck(:name, :id), article.user_id), {}, { class: "crayons-select #{article_series ? 'disabled' : ''}", disabled: article_series } %> <%= f.hidden_field :from_dashboard, value: 1 %> <% if article_series %>
@@ -137,11 +137,11 @@
<%= f.text_field :co_author_ids_list, - id: "article_#{article.id}_co_author_ids_list", - class: "article_org_co_author_ids_list", - data: { - fetch_users: organization_members_path(organization.username, format: "json") - } %> + id: "article_#{article.id}_co_author_ids_list", + class: "article_org_co_author_ids_list", + data: { + fetch_users: organization_members_path(organization.username, format: "json") + } %>
<%= f.hidden_field :from_dashboard, value: 1 %>