diff options
author | Struan Donald <struan@exo.org.uk> | 2013-07-23 12:38:21 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-07-23 12:38:21 +0100 |
commit | 824d64b179b3c49370d571b71f498eef7ed990d5 (patch) | |
tree | ddfc1ca1fce155b0216d2e0f30689ece2de594f7 /src | |
parent | 1cbe7e60df73bd03e2cc763ec6062b72a44f3fb3 (diff) |
If we pause the app then it seems to fire the report synced event on iOS
which means we change page. However, it does this outside the report
model so we set a success flag on the report and then check for that in
the sync event handler to make sure it's a genuine report sync event.
Fixes #59.
Diffstat (limited to 'src')
-rw-r--r-- | src/js/models/report.js | 2 | ||||
-rw-r--r-- | src/js/views/submit.js | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/js/models/report.js b/src/js/models/report.js index 477d16c..9ffb9c1 100644 --- a/src/js/models/report.js +++ b/src/js/models/report.js @@ -99,6 +99,7 @@ data = {}; } if ( data.success ) { + that.success = 1; that.trigger('sync', that, data, options); } else if ( data.errors ) { that.trigger('invalid', that, data, options); @@ -136,6 +137,7 @@ timeout: 30000, success: function(data) { if ( data.success ) { + that.success = 1; that.trigger('sync', that, data, options); } else { that.trigger('invalid', that, data, options); diff --git a/src/js/views/submit.js b/src/js/views/submit.js index ea36492..c98dbf3 100644 --- a/src/js/views/submit.js +++ b/src/js/views/submit.js @@ -52,6 +52,9 @@ }, onReportSync: function(model, resp, options) { + if ( model.success !== 1 ) { + return; + } this.stopListening(); this.afterSubmit(); if ( FMS.currentUser ) { |