@@ -45,44 +45,48 @@ defmodule AlgoraWeb.Org.JobLive do
4545 def mount ( % { "org_handle" => handle , "id" => id , "tab" => tab } , _session , socket ) do
4646 case Jobs . get_job_posting ( id ) do
4747 { :ok , job } ->
48- if connected? ( socket ) , do: subscribe ( job )
49-
50- { :ok ,
51- socket
52- |> assign ( :share_url , url ( ~p" /#{ handle } /jobs/" ) )
53- |> assign ( :page_title , job . title )
54- |> assign ( :job , job )
55- |> assign ( :show_import_drawer , false )
56- |> assign ( :show_share_drawer , false )
57- |> assign ( :show_payment_drawer , false )
58- |> assign ( :payment_form , to_form ( % { "payment_type" => "stripe" } , as: :payment ) )
59- |> assign ( :current_tab , tab )
60- |> assign ( :bounty_form , to_form ( BountyForm . changeset ( % BountyForm { } , % { } ) ) )
61- |> assign ( :tip_form , to_form ( TipForm . changeset ( % TipForm { } , % { } ) ) )
62- |> assign ( :contract_form , to_form ( ContractForm . changeset ( % ContractForm { } , % { } ) ) )
63- |> assign ( :share_drawer_type , nil )
64- |> assign ( :selected_developer , nil )
65- |> assign ( :import_form , to_form ( % { "github_urls" => "" } , as: :import ) )
66- |> assign ( :github_urls , "" )
67- # Map of github_handle => %{status: :loading/:done, user: nil/User}
68- |> assign ( :importing_users , % { } )
69- |> assign ( :loading_contribution_handle , nil )
70- |> assign (
71- :wire_form ,
72- to_form (
73- WirePaymentForm . changeset (
74- % WirePaymentForm {
75- payment_date: Date . utc_today ( ) ,
76- billing_name: socket . assigns . current_org . billing_name ,
77- billing_address: socket . assigns . current_org . billing_address ,
78- executive_name: socket . assigns . current_org . executive_name ,
79- executive_role: socket . assigns . current_org . executive_role
80- } ,
81- % { }
48+ if job . user_id == socket . assigns . current_org . id do
49+ if connected? ( socket ) , do: subscribe ( job )
50+
51+ { :ok ,
52+ socket
53+ |> assign ( :share_url , url ( ~p" /#{ handle } /jobs/" ) )
54+ |> assign ( :page_title , job . title )
55+ |> assign ( :job , job )
56+ |> assign ( :show_import_drawer , false )
57+ |> assign ( :show_share_drawer , false )
58+ |> assign ( :show_payment_drawer , false )
59+ |> assign ( :payment_form , to_form ( % { "payment_type" => "stripe" } , as: :payment ) )
60+ |> assign ( :current_tab , tab )
61+ |> assign ( :bounty_form , to_form ( BountyForm . changeset ( % BountyForm { } , % { } ) ) )
62+ |> assign ( :tip_form , to_form ( TipForm . changeset ( % TipForm { } , % { } ) ) )
63+ |> assign ( :contract_form , to_form ( ContractForm . changeset ( % ContractForm { } , % { } ) ) )
64+ |> assign ( :share_drawer_type , nil )
65+ |> assign ( :selected_developer , nil )
66+ |> assign ( :import_form , to_form ( % { "github_urls" => "" } , as: :import ) )
67+ |> assign ( :github_urls , "" )
68+ # Map of github_handle => %{status: :loading/:done, user: nil/User}
69+ |> assign ( :importing_users , % { } )
70+ |> assign ( :loading_contribution_handle , nil )
71+ |> assign (
72+ :wire_form ,
73+ to_form (
74+ WirePaymentForm . changeset (
75+ % WirePaymentForm {
76+ payment_date: Date . utc_today ( ) ,
77+ billing_name: socket . assigns . current_org . billing_name ,
78+ billing_address: socket . assigns . current_org . billing_address ,
79+ executive_name: socket . assigns . current_org . executive_name ,
80+ executive_role: socket . assigns . current_org . executive_role
81+ } ,
82+ % { }
83+ )
8284 )
8385 )
84- )
85- |> assign_applicants ( ) }
86+ |> assign_applicants ( ) }
87+ else
88+ raise AlgoraWeb.NotFoundError
89+ end
8690
8791 _ ->
8892 { :ok , push_navigate ( socket , to: ~p" /#{ handle } /home" ) }
0 commit comments