@@ -11,6 +11,7 @@ defmodule AlgoraWeb.CommunityLive do
1111 alias Algora.Accounts
1212 alias Algora.Accounts.User
1313 alias Algora.Bounties
14+ alias Algora.Payments
1415 alias Algora.Payments.Transaction
1516 alias Algora.Repo
1617 alias Algora.Workspace
@@ -62,45 +63,6 @@ defmodule AlgoraWeb.CommunityLive do
6263 featured_devs = Accounts . list_featured_developers ( )
6364 featured_collabs = list_featured_collabs ( )
6465
65- tx_query =
66- from ( tx in Transaction ,
67- where: tx . type == :credit ,
68- where: not is_nil ( tx . succeeded_at ) ,
69- join: u in assoc ( tx , :user ) ,
70- left_join: b in assoc ( tx , :bounty ) ,
71- left_join: tip in assoc ( tx , :tip ) ,
72- join: t in Ticket ,
73- on: t . id == b . ticket_id or t . id == tip . ticket_id ,
74- join: r in assoc ( t , :repository ) ,
75- join: o in assoc ( r , :user ) ,
76- join: ltx in assoc ( tx , :linked_transaction ) ,
77- join: ltx_user in assoc ( ltx , :user ) ,
78- select: % {
79- id: tx . id ,
80- succeeded_at: tx . succeeded_at ,
81- net_amount: tx . net_amount ,
82- bounty_id: b . id ,
83- tip_id: tip . id ,
84- user: u ,
85- ticket: % { t | repository: % { r | user: o } } ,
86- linked_transaction: % { ltx | user: ltx_user }
87- }
88- )
89-
90- tx_query =
91- case Algora.Settings . get_featured_transactions ( ) do
92- ids when is_list ( ids ) and ids != [ ] ->
93- where ( tx_query , [ tx ] , tx . id in ^ ids )
94-
95- _ ->
96- tx_query
97- |> where ( [ tx ] , tx . succeeded_at > ago ( 1 , "week" ) )
98- |> order_by ( [ tx ] , desc: tx . net_amount )
99- |> limit ( 5 )
100- end
101-
102- transactions = tx_query |> Repo . all ( ) |> Enum . sort_by ( & & 1 . succeeded_at , { :desc , DateTime } )
103-
10466 { :ok ,
10567 socket
10668 |> assign ( :screenshot? , not is_nil ( params [ "screenshot" ] ) )
@@ -117,7 +79,7 @@ defmodule AlgoraWeb.CommunityLive do
11779 |> assign ( :selected_developer , nil )
11880 |> assign ( :share_drawer_type , nil )
11981 |> assign ( :show_share_drawer , false )
120- |> assign ( :transactions , transactions )
82+ |> assign ( :transactions , Payments . list_featured_transactions ( ) )
12183 |> assign_query_opts ( params [ "tech" ] )
12284 |> assign_bounties ( ) }
12385 end
@@ -1194,6 +1156,18 @@ defmodule AlgoraWeb.CommunityLive do
11941156 { :noreply , assign_bounties ( socket ) }
11951157 end
11961158
1159+ @ impl true
1160+ def handle_event ( "create_bounty" , % { "bounty_form" => params } , socket ) do
1161+ Algora.Admin . alert ( "Bounty intent: #{ inspect ( params ) } " , :critical )
1162+ { :noreply , redirect ( socket , to: ~p" /auth/signup" ) }
1163+ end
1164+
1165+ @ impl true
1166+ def handle_event ( "create_tip" , % { "tip_form" => params } , socket ) do
1167+ Algora.Admin . alert ( "Tip intent: #{ inspect ( params ) } " , :critical )
1168+ { :noreply , redirect ( socket , to: ~p" /auth/signup" ) }
1169+ end
1170+
11971171 @ impl true
11981172 def handle_event ( "load_more" , _params , socket ) do
11991173 % { bounties: bounties } = socket . assigns
0 commit comments