mmd-osm left a comment (openstreetmap/openstreetmap-website#6192)

So the button is set to disabled in the setTimeout function below.

```javascript
    $document.on('submit.rails', rails.formSubmitSelector, function(e) {
      var form = $(this),
        remote = rails.isRemote(form),
        blankRequiredInputs,
        nonBlankFileInputs;

[...]

      } else {
        // Slight timeout so that the submit button gets properly serialized
        setTimeout(function(){ rails.disableFormElements(form); }, 13);         
       // <<<<<
      }
    });
```
    
Re-enabling the button would work, if we were to use ajax:
    
```javascript
    $document.on('ajax:complete.rails', rails.formSubmitSelector, 
function(event) {
      if (this === event.target) rails.enableFormElements($(this));
    });    
```

However, in this scenario, it's a plain HTTP POST, followed by a 302 response 
and another HTTP GET on render.openstreetmap.org.

This event simply never fires, because it's not a "remote" call. The source 
code mentions a "data-remote" attribute to send the request as AJAX.

However, CSP doesn't allow render.openstreetmap.org, the render site isn't 
properly handling CORS preflight requests, and the required totp cookie would 
be lost as well.

Long story short, I don't see much alternatives at the moment to implement this.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6192#issuecomment-3074886052
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6192/c3074886...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to