From 75312ab9ab237bd3e6e09b531252b40a0f46c6b7 Mon Sep 17 00:00:00 2001 From: Stuart Corbishley Date: Fri, 4 Aug 2023 08:40:16 +0200 Subject: [PATCH] Formatting --- lib/lightning_web/live/project_live/settings.ex | 14 ++++---------- test/lightning_web/live/profile_live_test.exs | 12 ++---------- test/lightning_web/live/project_live_test.exs | 5 +---- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/lib/lightning_web/live/project_live/settings.ex b/lib/lightning_web/live/project_live/settings.ex index 990065e568..abf7f36cb3 100644 --- a/lib/lightning_web/live/project_live/settings.ex +++ b/lib/lightning_web/live/project_live/settings.ex @@ -119,7 +119,10 @@ defmodule LightningWeb.ProjectLive.Settings do def handle_event("toggle-mfa", _params, socket) do if can_edit_project(socket.assigns) do - project = toggle_project_mfa(socket) + project = socket.assigns.project + + {:ok, project} = + Projects.update_project(project, %{requires_mfa: !project.requires_mfa}) {:noreply, socket @@ -293,13 +296,4 @@ defmodule LightningWeb.ProjectLive.Settings do {:noreply, assign(socket, :project_changeset, changeset)} end end - - defp toggle_project_mfa(socket) do - project = socket.assigns.project - - {:ok, project} = - Projects.update_project(project, %{requires_mfa: !project.requires_mfa}) - - project - end end diff --git a/test/lightning_web/live/profile_live_test.exs b/test/lightning_web/live/profile_live_test.exs index d9955c7704..75ea5105d7 100644 --- a/test/lightning_web/live/profile_live_test.exs +++ b/test/lightning_web/live/profile_live_test.exs @@ -240,11 +240,7 @@ defmodule LightningWeb.ProfileLiveTest do end test "user can successfully add MFA to their account", %{conn: conn} do - Application.put_env( - :lightning, - :totp_client, - LightningTest.TOTP - ) + Application.put_env(:lightning, :totp_client, LightningTest.TOTP) {:ok, view, _html} = live(conn, Routes.profile_edit_path(conn, :edit)) @@ -314,11 +310,7 @@ defmodule LightningWeb.ProfileLiveTest do end test "user can successfully setup another device", %{conn: conn} do - Application.put_env( - :lightning, - :totp_client, - LightningTest.TOTP - ) + Application.put_env(:lightning, :totp_client, LightningTest.TOTP) {:ok, view, _html} = live(conn, Routes.profile_edit_path(conn, :edit)) diff --git a/test/lightning_web/live/project_live_test.exs b/test/lightning_web/live/project_live_test.exs index 2163eed2b5..ca2735c32e 100644 --- a/test/lightning_web/live/project_live_test.exs +++ b/test/lightning_web/live/project_live_test.exs @@ -491,10 +491,7 @@ defmodule LightningWeb.ProjectLiveTest do conn: conn, user: user } do - project = - insert(:project, - project_users: [%{user: user, role: :admin}] - ) + project = insert(:project, project_users: [%{user: user, role: :admin}]) {:ok, _view, html} = live(