@@ -4028,7 +4028,7 @@ function addOrgModal() {
4028
4028
// Get organisation ID
4029
4029
response = JSON . parse ( request . responseText ) ;
4030
4030
var organisation_id = response . id ;
4031
- submitOrgLocation ( organisation_id , form , form_data ) ;
4031
+ submitOrgLogo ( organisation_id ) ;
4032
4032
4033
4033
updateThisOrganisationTypeahead ( organisation_id ) ;
4034
4034
updateOrganisationTypeaheads ( true ) ;
@@ -4069,36 +4069,6 @@ function addOrgModal() {
4069
4069
}
4070
4070
}
4071
4071
4072
- /* Submits the organisation location, and also calls the submitOrgLogo
4073
- method at the appropriate time - immediately, if there is no location update
4074
- to be made, or after the request finishes if a location update request has
4075
- been sent.
4076
-
4077
- NOTE: The two requests cannot be made asynchronously since the server method
4078
- doesn't handle updates correctly. It seems to be losing the logo data, or
4079
- the location data, based on the order in which it is handling these
4080
- requests.
4081
- */
4082
- function submitOrgLocation ( organisation_id , form , form_data ) {
4083
- var latitude = form . querySelector ( "#latitude" ) . value ,
4084
- longitude = form . querySelector ( "#longitude" ) . value ;
4085
-
4086
- if ( latitude !== "" && longitude !== "" ) {
4087
- var api_url = "/rest/v1/organisation_location/?format=json" ,
4088
- request_loc = new XMLHttpRequest ( ) ;
4089
-
4090
- // Making a synchronous request, since org!
4091
- request_loc . open ( "POST" , api_url , false ) ;
4092
- request_loc . setRequestHeader ( "X-CSRFToken" , csrftoken ) ;
4093
- request_loc . setRequestHeader ( "Content-type" , "application/x-www-form-urlencoded" ) ;
4094
- request_loc . send ( form_data + "&location_target=" + organisation_id ) ;
4095
- }
4096
-
4097
- // Call sendOrgLogo after updating location is done. The update location
4098
- // request is synchronous
4099
- submitOrgLogo ( organisation_id ) ;
4100
- }
4101
-
4102
4072
function submitOrgLogo ( organisation_id ) {
4103
4073
var org_logo_files = document . getElementById ( "org-logo" ) . files ;
4104
4074
if ( org_logo_files === undefined ) {
0 commit comments