Skip to content

Commit 3549f86

Browse files
committed
fix: skip redundant auth step in installation flow
1 parent 20845f6 commit 3549f86

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/algora/integrations/github/github.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ defmodule Algora.Github do
1313
def pat, do: Algora.config([:github, :pat])
1414
def pat_enabled, do: Algora.config([:github, :pat_enabled])
1515

16-
def install_url do
17-
"https://github.com/apps/#{app_handle()}/installations/new"
18-
end
16+
def install_url_base, do: "https://github.com/apps/#{app_handle()}/installations"
17+
def install_url_new, do: "#{install_url_base()}/new"
18+
def install_url_select_target, do: "#{install_url_base()}/select_target"
1919

2020
defp oauth_state_ttl, do: 600
2121
defp oauth_state_salt, do: "github-oauth-state"

lib/algora_web/live/org/settings_live.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ defmodule AlgoraWeb.Org.SettingsLive do
116116
end
117117

118118
def handle_info({:authenticated, user}, socket) do
119-
# TODO: skip auth step in installation flow
120-
{:noreply, socket |> assign(:current_user, user) |> redirect(external: Github.install_url())}
119+
{:noreply, socket |> assign(:current_user, user) |> redirect(external: Github.install_url_select_target())}
121120
end
122121

123122
def handle_event("install_app", _params, socket) do

lib/algora_web/live/user/installations_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ defmodule AlgoraWeb.User.InstallationsLive do
9999
<.link
100100
class="relative block w-full rounded-lg border-2 border-dashed border-gray-600 p-8 text-center hover:border-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
101101
rel="noopener"
102-
href={Github.install_url()}
102+
href={Github.install_url_new()}
103103
>
104104
<svg
105105
xmlns="http://www.w3.org/2000/svg"

0 commit comments

Comments
 (0)