Skip to content

Commit

Permalink
update(Elixir/OTP): Updating elixir/otp to version 17/27 and depndenc…
Browse files Browse the repository at this point in the history
…ies (#2100)

* update(Elixir/OTP): Updating elixir/otp to version 17/27 and depndencies

* Update more dependencies and the docker container

* change docker base image in dev

* upgrade html sanitizer and fix issues with tests

* remove comment

* remove todo

* Fixed code

---------

Co-authored-by: Anthony Shull <[email protected]>
  • Loading branch information
kotva006 and anthonyshull authored Jun 21, 2024
1 parent cb16b84 commit 0f01196
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodejs 18.17.1
erlang 26.2.1
elixir 1.16.1-otp-26
erlang 27.0
elixir 1.17.0-otp-27
2 changes: 1 addition & 1 deletion deploy/dotcom/dev/1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hexpm/elixir:1.16.1-erlang-26.2.2-debian-buster-20240130
FROM hexpm/elixir:1.17.0-erlang-27.0-debian-buster-20240513-slim

RUN apt-get update && apt-get install -y curl git make build-essential inotify-tools
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
Expand Down
2 changes: 1 addition & 1 deletion deploy/dotcom/dev/2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hexpm/elixir:1.16.1-erlang-26.2.2-debian-buster-20240130
FROM hexpm/elixir:1.17.0-erlang-27.0-debian-buster-20240513-slim

RUN apt-get update && apt-get install -y curl git make build-essential inotify-tools
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
Expand Down
2 changes: 1 addition & 1 deletion deploy/dotcom/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
###

# 1.) Get the Elixir dependencies within an Elixir container
FROM hexpm/elixir:1.16.1-erlang-26.2.1-debian-buster-20231009-slim as elixir-builder
FROM hexpm/elixir:1.17.0-erlang-27.0-debian-buster-20240513-slim as elixir-builder

ENV LANG="C.UTF-8" MIX_ENV="prod"

Expand Down
14 changes: 7 additions & 7 deletions lib/cms/custom_html5_scrubber.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule CMS.CustomHTML5Scrubber do
"""

require HtmlSanitizeEx.Scrubber.Meta
alias HtmlSanitizeEx.Scrubber.{CSS, Meta}
alias HtmlSanitizeEx.Scrubber.Meta

# Removes any CDATA tags before the traverser/scrubber runs.
Meta.remove_cdata_sections_before_scrub()
Expand All @@ -18,8 +18,6 @@ defmodule CMS.CustomHTML5Scrubber do

@valid_schemes ["http", "https", "mailto", "tel"]

Meta.allow_tag_with_uri_attributes("a", ["href"], @valid_schemes)

Meta.allow_tag_with_these_attributes("a", [
"accesskey",
"class",
Expand Down Expand Up @@ -50,6 +48,12 @@ defmodule CMS.CustomHTML5Scrubber do
"type"
])

def scrub_attribute("a", {"href", "tel:" <> _ = number}) do
{"href", number}
end

Meta.allow_tag_with_uri_attributes("a", ["href"], @valid_schemes)

Meta.allow_tag_with_these_attributes("b", [
"accesskey",
"class",
Expand Down Expand Up @@ -2125,8 +2129,4 @@ defmodule CMS.CustomHTML5Scrubber do
def html5(html) do
html |> HtmlSanitizeEx.Scrubber.scrub(__MODULE__)
end

defp scrub_css(text) do
CSS.scrub(text)
end
end
6 changes: 3 additions & 3 deletions lib/dotcom_web/templates/event/_calendar.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<%= for event <- todays_events do %>
<% event_ended = ended?(event) %>
<button class="m-event-calendar__event" data-a11y-dialog-show="<%= event.id %>">
<i class="fa fa-circle <%= if event_ended, do: 'ended' %>" aria-hidden="true"></i>
<i class="fa fa-circle <%= if event_ended, do: "ended" %>" aria-hidden="true"></i>
<%= if !event_ended do%>
<div class='m-event-calendar__event-time'><%= format_time(event.date) %></div>
<% end %>
Expand All @@ -41,9 +41,9 @@

<noscript>
<%= link to: cms_static_page_path(@conn, event.path), class: "m-event-calendar__event m-event-calendar__event-title", title: event.title do %>
<i class="fa fa-circle <%= if event_ended, do: 'ended' %>" aria-hidden="true"></i>
<i class="fa fa-circle <%= if event_ended, do: "ended" %>" aria-hidden="true"></i>
<%= if !event_ended do%>
<div class='m-event-calendar__event-time'><%= format_time(event.date) %></div>
<div class="m-event-calendar__event-time"><%= format_time(event.date) %></div>
<% end %>
<%= event.title %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/event/_event_teaser.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- If date is upcoming, display on init -->
<!-- Otherwise, add a 'hidden' class. On previous-button click, this class is removed -->
<li class="list-group-item u-flex-container m-event <%= if event_is_hidden, do: 'hidden' %>" data-group="<%= render_event_month_slug(@month_number, @year) %>">
<li class="list-group-item u-flex-container m-event <%= if event_is_hidden, do: "hidden" %>" data-group="<%= render_event_month_slug(@month_number, @year) %>">
<div class="m-event__date-circle">
<div class="u-bold m-event__month"><%= pretty_date(event_start, "{Mshort}") %></div>
<div class="u-bold m-event__day"><%= pretty_date(event_start, "{D}") %></div>
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/event/_expandable_month.html.eex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section id="<%= @month_number %>-<%= @year %>" class="m-event-list__month <%= if @month_number == @month, do: 'm-event-list__month--active' %>">
<section id="<%= @month_number %>-<%= @year %>" class="m-event-list__month <%= if @month_number == @month, do: "m-event-list__month--active" %>">
<% header_id = "header-#{@month_number}" %>
<% panel_id = "panel-#{@month_number}" %>

Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/partial/_checkbox.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ checked_value = assigns[:checked_value] || "on"
<div class="c-checkbox">
<%= checkbox(@form, @field, id: id, class: "c-checkbox__input", checked: assigns[:checked],
checked_value: checked_value, required: assigns[:required]) %>
<label id="<%= [id, '_label'] %>" for="<%= id %>" class="c-checkbox__label"><%= @label_text %></label>
<label id="<%= [id, "_label"] %>" for="<%= id %>" class="c-checkbox__label"><%= @label_text %></label>
</div>
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/schedule/_line.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<%= if branchesEmpty? do%>
<div class="col-md-12 m-schedule-page__main-content">
<div class="m-schedule-line__main-content <%= if Routes.Route.type_atom(@route.type) == :ferry, do: 'ferry' %>">
<div class="m-schedule-line__main-content <%= if Routes.Route.type_atom(@route.type) == :ferry, do: "ferry" %>">
<%= render "_empty.html", date: @date, direction: Routes.Route.direction_name(@route, @direction_id), origin: nil, destination: nil, conn: @conn, error: assigns[:schedule_error] %>
</div>
</div>
Expand Down
19 changes: 9 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ defmodule DotCom.Mixfile do
# latest version 1.0.7; cannot upgrade because of server_sent_event_stage expects castore < 1
{:castore, "0.1.22"},
{:crc, "0.10.5"},
{:credo, "1.7.6", only: [:dev, :test]},
{:credo, "1.7.7", only: [:dev, :test]},
{:csv, "3.2.1"},
{:decorator, "1.4.0"},
{:dialyxir, "1.4.3", [only: [:test, :dev], runtime: false]},
{:diskusage_logger, "0.2.0"},
{:eflame, "1.0.1", only: :dev},
{:ehmon, [github: "mbta/ehmon", only: :prod]},
{:ex_aws, "2.5.3"},
{:ex_aws, "2.5.4"},
{:ex_aws_s3, "2.5.3"},
{:ex_aws_ses, "2.4.1"},
{:ex_doc, "0.32.2", only: :dev},
{:ex_doc, "0.34.0", only: :dev},
{:ex_machina, "2.7.0", only: :test},
{:ex_unit_summary, "0.1.0", only: [:dev, :test]},
# latest version 0.18.1; cannot upgrade because expects castore >= 1
Expand All @@ -92,8 +92,7 @@ defmodule DotCom.Mixfile do
{:gettext, "0.24.0"},
{:hackney, "1.20.1"},
{:hammer, "6.2.1"},
# latest version 1.4.3; cannot upgrade because it changes how we handle telephone links
{:html_sanitize_ex, "1.3.0"},
{:html_sanitize_ex, "1.4.3"},
# latest version 2.2.1; cannot upgrade because api has changed
{:httpoison, "1.8.2"},
{:inflex, "2.1.0"},
Expand All @@ -118,7 +117,7 @@ defmodule DotCom.Mixfile do
{:phoenix_live_reload, "1.5.3", [only: :dev]},
{:phoenix_live_view, "0.20.14"},
{:phoenix_pubsub, "2.1.3"},
{:plug, "1.15.3"},
{:plug, "1.16.0"},
{:plug_cowboy, "2.7.1"},
# latest version is 5.0.0; cannot upgrade because we use Poison.Parser.parse!
{:poison, "3.1.0"},
Expand All @@ -133,10 +132,10 @@ defmodule DotCom.Mixfile do
github: "samueljseay/recaptcha",
ref: "8ea13f63990ca18725ac006d30e55d42c3a58457"
]},
{:recase, "0.7.0"},
{:recase, "0.8.0"},
{:recon, "2.5.5", [only: :prod]},
{:redix, "1.5.1"},
{:req, "0.4.14", override: true},
{:req, "0.5.0", override: true},
{:rstar, github: "armon/erl-rstar"},
# latest version 10.1.0; cannot upgrade because setup appears to have changed
{:sentry, "7.2.5"},
Expand All @@ -145,14 +144,14 @@ defmodule DotCom.Mixfile do
{:sweet_xml, "0.7.4", only: [:prod, :dev]},
{:telemetry, "1.2.1", override: true},
{:telemetry_metrics, "1.0.0", override: true},
{:telemetry_metrics_splunk, "0.0.5-alpha"},
{:telemetry_metrics_splunk, "0.0.6-alpha"},
{:telemetry_poller, "1.1.0"},
{:telemetry_test, "0.1.2", only: [:test]},
# latest version is 3.7.11; cannot upgrade because tests fail
{:timex, "3.1.24"},
{:unrooted_polytree, "0.1.1"},
{:uuid, "1.1.8"},
{:wallaby, "0.30.6", [runtime: false, only: [:test, :dev]]}
{:wallaby, "0.30.9", [runtime: false, only: [:test, :dev]]}
]
end
end
Loading

0 comments on commit 0f01196

Please sign in to comment.