435: Can't delete comments in the diff

giri*****@gmai***** (Google Code) (Is this you? Claim this profile.)
March 22, 2009
What's the URL of the page containing the problem?
http://reviewboard.eng.vmware.com/r/16545/diff/2/

What steps will reproduce the problem?
1. write a comment and save it.
2. can't delete it.

What is the expected output? What do you see instead?
should be able to delete it. It's very annoying. Sometimes, I can't even
change the comment that i wrote.

What operating system are you using? What browser?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.12) Gecko/20080201
Firefox/2.0.0.12

Please provide any additional information below.
chipx86
#1 chipx86
If you click on the little pencil, does it become editable/deletable?
  • +NeedInfo
  • +Component-DiffViewer
    +Component-Reviews
#2 fbea*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Here's a sample traceback:
------------------------------------------------------------
Environment:

Request Method: POST
Request URL:
http://codereview.beatport.local/api/json/reviewrequests/712/diff/1/file/6159/line/24/comments/
Django Version: 0.97-pre-SVN-unknown
Python Version: 2.5.1
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sites',
 'django.contrib.sessions',
 'djblets.util',
 'reviewboard.accounts',
 'reviewboard.diffviewer',
 'reviewboard.iphone',
 'reviewboard.reports',
 'reviewboard.reviews',
 'reviewboard.scmtools',
 'reviewboard.utils']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py" in
get_response
  82.                 response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.5/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/share/reviewboard/reviews/json.py" in _checklogin
  82.             return view_func(request, *args, **kwargs)
File "/usr/share/reviewboard/reviews/json.py" in diff_line_comments
  1142.                 comment = review.comments.get(q)
File "/usr/local/lib/python2.5/site-packages/django/db/models/manager.py" in get
  69.         return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py" in get
  265.             raise self.model.MultipleObjectsReturned, "get() returned more
than one %s -- it returned %s! Lookup parameters were %s" %
(self.model._meta.object_name, len(obj_list), kwargs)

Exception Type: MultipleObjectsReturned at
/api/json/reviewrequests/712/diff/1/file/6159/line/24/comments/
Exception Value: get() returned more than one Comment -- it returned 3! Lookup
parameters were {}
david
#3 david
  • +Concurrency
david
#4 david
  • -NeedInfo
    +New
#5 vsl****@gmai***** (Google Code) (Is this you? Claim this profile.)
The crucial part is this:

> Exception Value: get() returned more than one Comment -- it returned 3! Lookup
> parameters were {}

Here's how to reproduce it:

1. Use slow enough connection. I have RB installed on a site that has ~150ms ping
time for me. The important part is that after entering a comment in diff view and
clicking "Save Comment", it takes ~2 seconds to take any effect (having RB unloaded
so that the server has to start it up first helps too).

2. Click "Save Comment" and frantically continue hitting the button. This should
result in the comment being added several times instead of once (while only one will
be editable -- see attached screenshot).

It's normally (i.e. unless you do 2.) impossible to add more than one comment on the
same line, by one person, in one review. The exception above shows that the code
counts with it.

In addition to fixing the delete code, it would probably be good idea to disable the
"Save Comment" button as soon as it is clicked, rather than when server's reply is
received (?).
david
#6 david
This should have been fixed in the UI rewrite, I believe. Please add a comment if
you're still experiencing this.
  • -New
    +Fixed