Skip to content

Commit 6647bcd

Browse files
committed
[#3787] Remove API call to organisation_location after org creation
Closes #3787
1 parent 85ba64d commit 6647bcd

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

akvo/rsr/front-end/scripts-src/classic/jsx/project-editor.jsx

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4028,7 +4028,7 @@ function addOrgModal() {
40284028
// Get organisation ID
40294029
response = JSON.parse(request.responseText);
40304030
var organisation_id = response.id;
4031-
submitOrgLocation(organisation_id, form, form_data);
4031+
submitOrgLogo(organisation_id);
40324032

40334033
updateThisOrganisationTypeahead(organisation_id);
40344034
updateOrganisationTypeaheads(true);
@@ -4069,36 +4069,6 @@ function addOrgModal() {
40694069
}
40704070
}
40714071

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-
41024072
function submitOrgLogo(organisation_id) {
41034073
var org_logo_files = document.getElementById("org-logo").files;
41044074
if (org_logo_files === undefined) {

0 commit comments

Comments
 (0)