diff options
author | Magnus Hagander | 2015-02-04 20:08:32 +0000 |
---|---|---|
committer | Magnus Hagander | 2015-02-04 20:08:32 +0000 |
commit | 5ec1b2a727eba4e3f4a70028a975d12dffc03ccb (patch) | |
tree | 2adae3514781688e2a6dac65b9e4064031e7818a /pgcommitfest/commitfest/ajax.py | |
parent | 12de0f70e0bd94b2ffccc347df2420cd5cf5ecb4 (diff) |
Show a message when a thread is re-added to the same message
Diffstat (limited to 'pgcommitfest/commitfest/ajax.py')
-rw-r--r-- | pgcommitfest/commitfest/ajax.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/pgcommitfest/commitfest/ajax.py b/pgcommitfest/commitfest/ajax.py index d1d8bcb..f489d12 100644 --- a/pgcommitfest/commitfest/ajax.py +++ b/pgcommitfest/commitfest/ajax.py @@ -86,10 +86,7 @@ def attachThread(request): patch = get_object_or_404(Patch, pk=int(request.POST['p']), commitfests=cf) msgid = request.POST['msg'] - if doAttachThread(cf, patch, msgid, request.user): - return 'OK' - else: - raise Exception("Something happened that cannot happen") + return doAttachThread(cf, patch, msgid, request.user) def doAttachThread(cf, patch, msgid, user): # Note! Must be called in an open transaction! @@ -101,8 +98,7 @@ def doAttachThread(cf, patch, msgid, user): if len(threads): thread = threads[0] if thread.patches.filter(id=patch.id).exists(): - # We have everything, so claim we're done. - return True + return 'This thread is already added to this email' # We did not exist, so we'd better add ourselves. # While at it, we update the thread entry with the latest data from the @@ -135,7 +131,7 @@ def doAttachThread(cf, patch, msgid, user): patch.set_modified() patch.save() - return True + return 'OK' @transaction.commit_on_success def detachThread(request): |