Skip to content

Commit 0d7c283

Browse files
committed
mandate oauth for tip creation
1 parent e987be9 commit 0d7c283

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/algora/bounties/bounties.ex

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,12 @@ defmodule Algora.Bounties do
560560
) ::
561561
{:ok, String.t()} | {:error, atom()}
562562
def create_tip(%{creator: creator, owner: owner, recipient: recipient, amount: amount}, opts \\ []) do
563+
installation_id = opts[:installation_id]
564+
563565
token_res =
564-
if opts[:installation_id] do
565-
Github.get_installation_token(opts[:installation_id])
566-
else
567-
case Accounts.get_access_token(creator) do
568-
{:ok, token} -> {:ok, token}
569-
{:error, _reason} -> {:ok, nil}
570-
end
571-
end
566+
if installation_id,
567+
do: Github.get_installation_token(installation_id),
568+
else: Accounts.get_access_token(creator)
572569

573570
ticket_ref = opts[:ticket_ref]
574571

0 commit comments

Comments
 (0)