Fix "Save and Submit" button

This button was not working because we sync the change before sending
a review, which reset the pending state.  Determine whether we are
intending to submit the change before performing that sync, and
remember it after the sync is done.

Change-Id: I8c85c2a8fec50b50fb92037f6dcbcc7917c3baff
This commit is contained in:
James E. Blair 2020-02-24 14:31:42 -08:00
parent 055b11624b
commit e0515e7480
1 changed files with 3 additions and 3 deletions

View File

@ -1317,6 +1317,7 @@ class UploadReviewTask(Task):
def run(self, sync):
app = sync.app
submit = False
with app.db.getSession() as session:
message = session.getMessage(self.message_key)
if message is None:
@ -1324,12 +1325,13 @@ class UploadReviewTask(Task):
self.message_key))
return
change = message.revision.change
if change.pending_status and change.status == 'SUBMITTED':
submit = True
if not change.held:
self.log.debug("Syncing %s to find out if it should be held" % (change.id,))
t = SyncChangeTask(change.id)
t.run(sync)
self.results += t.results
submit = False
change_id = None
with app.db.getSession() as session:
message = session.getMessage(self.message_key)
@ -1341,8 +1343,6 @@ class UploadReviewTask(Task):
return
change_id = change.id
current_revision = change.revisions[-1]
if change.pending_status and change.status == 'SUBMITTED':
submit = True
data = dict(message=message.message,
strict_labels=False)
if revision == current_revision: