chore(portal): bump phoenix to 1.8 (#10510)

Bumps Phoenix to 1.8 and Phoenix LiveView to 1.1. As part of the bump a
number of issues had to be addressed. Comments inline provide more
context.

Supersedes #10475 
Supersedes #10448
This commit is contained in:
Jamil
2025-10-10 11:08:50 -04:00
committed by GitHub
parent 5b60d9d64d
commit bb089846d7
15 changed files with 49 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
defmodule API.FallbackController do
use Phoenix.Controller
use API, :controller
def call(conn, {:error, :not_found}) do
conn

View File

@@ -43,7 +43,7 @@ defmodule API.MixProject do
{:domain, in_umbrella: true},
# Phoenix deps
{:phoenix, "~> 1.7.0"},
{:phoenix, "~> 1.8"},
{:phoenix_ecto, "~> 4.4"},
{:plug_cowboy, "~> 2.7"},

View File

@@ -2,17 +2,14 @@ defmodule Domain.Mailer.Notifications do
import Swoosh.Email
import Domain.Mailer
import Phoenix.Template, only: [embed_templates: 2]
import Phoenix.VerifiedRoutes
@endpoint Web.Endpoint
@router Web.Router
embed_templates "notifications/*.html", suffix: "_html"
embed_templates "notifications/*.text", suffix: "_text"
def outdated_gateway_email(account, gateways, incompatible_client_count, email) do
outdated_clients_url =
url(~p"/#{account.id}/clients?#{[clients_order_by: "clients:asc:last_seen_version"]}")
url_generator = Application.fetch_env!(:domain, :url_generator)
outdated_clients_url = url_generator.outdated_clients_url(account.id)
default_email()
|> subject("Firezone Gateway Upgrade Available")

View File

@@ -48,7 +48,7 @@ defmodule Domain.MixProject do
{:ecto_sql, "~> 3.7"},
# PubSub and Presence
{:phoenix, "~> 1.7"},
{:phoenix, "~> 1.8"},
{:phoenix_pubsub, "~> 2.0"},
# Auth-related deps

View File

@@ -109,9 +109,7 @@ defmodule Web.Clients.Components do
This component is up to date.
</p>
<p :if={@outdated?}>
A newer version
<.website_link path="/changelog">{@latest}</.website_link>
is available.
A newer version <.website_link path="/changelog">{@latest}</.website_link> is available.
</p>
</:content>
</.popover>

View File

@@ -203,8 +203,7 @@ defmodule Web.RelayGroups.NewToken do
<div id="connection-status" class="flex justify-between items-center">
<p class="text-sm">
Relay not connecting? See our
<.website_link path="/kb/administer/troubleshooting">
Relay not connecting? See our <.website_link path="/kb/administer/troubleshooting">
relay troubleshooting guide
</.website_link>.
</p>

View File

@@ -38,8 +38,7 @@ defmodule Web.Settings.IdentityProviders.New do
Set up SSO authentication using your own identity provider. Directory sync
also available for certain providers. <br /> Learn more about
<.website_link path="/kb/authenticate/oidc">SSO authentication</.website_link>
and
<.website_link path="/kb/authenticate/directory-sync">directory sync</.website_link>
and <.website_link path="/kb/authenticate/directory-sync">directory sync</.website_link>
in our docs.
</:help>
<:content>

View File

@@ -273,7 +273,6 @@ defmodule Web.Router do
live "/new", New
live "/:provider_id", Show
live "/:provider_id/edit", Edit
live "/:provider_id/sync", Sync
# OpenID Connection
get "/:provider_id/redirect", Connect, :redirect_to_idp

View File

@@ -0,0 +1,17 @@
defmodule Web.UrlGenerator do
@moduledoc """
Generates URLs for use in emails and other domain-layer notifications.
This breaks the circular dependency between Web and Domain apps.
"""
use Phoenix.VerifiedRoutes,
endpoint: Web.Endpoint,
router: Web.Router
@doc """
Generates URL for the clients page with outdated clients filter.
"""
def outdated_clients_url(account_id) do
url(~p"/#{account_id}/clients?#{[clients_order_by: "clients:asc:last_seen_version"]}")
end
end

View File

@@ -37,11 +37,11 @@ defmodule Web.MixProject do
{:domain, in_umbrella: true},
# Phoenix/Plug deps
{:phoenix, "~> 1.7.0"},
{:phoenix, "~> 1.8"},
{:phoenix_live_view, "~> 1.1"},
{:phoenix_html, "~> 4.0"},
{:phoenix_ecto, "~> 4.4"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 1.0.0-rc.0"},
{:plug_cowboy, "~> 2.7"},
{:gettext, "~> 0.20"},
{:remote_ip, "~> 1.0"},

View File

@@ -95,7 +95,7 @@ defmodule Web.Live.Policies.NewTest do
html = render(form)
disabled_input = Floki.find(html, "input[name='policy[actor_group_id]_name']")
assert Floki.attribute(disabled_input, "disabled") == ["disabled"]
assert Floki.attribute(disabled_input, "disabled") == [""]
assert Floki.attribute(disabled_input, "value") == [actor_group.name]
value_input = Floki.find(html, "input[name='policy[actor_group_id]']")
@@ -151,7 +151,7 @@ defmodule Web.Live.Policies.NewTest do
html = render(form)
disabled_input = Floki.find(html, "input[name='policy[resource_id]_name']")
assert Floki.attribute(disabled_input, "disabled") == ["disabled"]
assert Floki.attribute(disabled_input, "disabled") == [""]
assert Floki.attribute(disabled_input, "value") == [resource.name]
value_input = Floki.find(html, "input[name='policy[resource_id]']")

View File

@@ -169,10 +169,16 @@ defmodule Web.Live.Settings.IdentityProviders.GoogleWorkspace.EditTest do
}
)
adapter_config =
Map.merge(provider_attrs.adapter_config, %{
"client_id" => "",
"service_account_json_key" => nil
})
changed_values = %{
provider: %{
name: String.duplicate("a", 256),
adapter_config: %{provider_attrs.adapter_config | "client_id" => ""}
adapter_config: adapter_config
}
}