From c23b0b04f62437438f41db607b0b363b1ef41b0e Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 14 Jan 2016 18:28:44 -0800 Subject: [PATCH] Always sync a specfically queried change If a change is opened by id and already exists locally, perform a high-priority background sync of the change to make sure it's up to date. This should help avoid the problem where a user returns to a change in an unsubscribed project and it appears out of date. If the change doesn't exist locally, it is synced in the foreground so that case is already covered. Change-Id: Idb5daa4309b712e39eb7cde56afcb94fdb41f179 --- gertty/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gertty/app.py b/gertty/app.py index e64fc40..1edaa0d 100644 --- a/gertty/app.py +++ b/gertty/app.py @@ -450,7 +450,7 @@ class App(object): self.popup(dialog, min_width=76, min_height=len(lines)+4) def _syncOneChangeFromQuery(self, query): - number = changeid = None + number = changeid = restid = None if query.startswith("change:"): number = query.split(':')[1].strip() try: @@ -466,6 +466,7 @@ class App(object): elif changeid: change = session.getChangeByChangeID(changeid) change_key = change and change.key or None + restid = change and change.id or None if change_key is None: if self.sync.offline: raise Exception('Can not sync change while offline.') @@ -491,6 +492,9 @@ class App(object): elif changeid: change = session.getChangeByChangeID(changeid) change_key = change and change.key or None + elif restid: + task = sync.SyncChangeTask(restid, sync.HIGH_PRIORITY) + self.sync.submitTask(task) if change_key is None: raise Exception('Change is not in local database.')