@@ -11,6 +11,7 @@ defmodule AlgoraWeb.CommunityLive do
11
11
alias Algora.Accounts
12
12
alias Algora.Accounts.User
13
13
alias Algora.Bounties
14
+ alias Algora.Payments
14
15
alias Algora.Payments.Transaction
15
16
alias Algora.Repo
16
17
alias Algora.Workspace
@@ -62,45 +63,6 @@ defmodule AlgoraWeb.CommunityLive do
62
63
featured_devs = Accounts . list_featured_developers ( )
63
64
featured_collabs = list_featured_collabs ( )
64
65
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
-
104
66
{ :ok ,
105
67
socket
106
68
|> assign ( :screenshot? , not is_nil ( params [ "screenshot" ] ) )
@@ -117,7 +79,7 @@ defmodule AlgoraWeb.CommunityLive do
117
79
|> assign ( :selected_developer , nil )
118
80
|> assign ( :share_drawer_type , nil )
119
81
|> assign ( :show_share_drawer , false )
120
- |> assign ( :transactions , transactions )
82
+ |> assign ( :transactions , Payments . list_featured_transactions ( ) )
121
83
|> assign_query_opts ( params [ "tech" ] )
122
84
|> assign_bounties ( ) }
123
85
end
@@ -1194,6 +1156,18 @@ defmodule AlgoraWeb.CommunityLive do
1194
1156
{ :noreply , assign_bounties ( socket ) }
1195
1157
end
1196
1158
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
+
1197
1171
@ impl true
1198
1172
def handle_event ( "load_more" , _params , socket ) do
1199
1173
% { bounties: bounties } = socket . assigns
0 commit comments