Deleted Comment Reappears
Summary
The most recent deleted comment is reappearing after the page checks for new notes.
Steps to reproduce
- Open an issue
- Add a comment
- Delete the comment
- Refresh the page
- Switch to another tab, then come back (or just wait, this will force the page to check for new comments)
What is the current bug behavior?
The deleted comment shows up on the page.
What is the expected correct behavior?
No new comments show up on the page.
Scope
This issue only affects deleted comments if they were the most recent comment when deleted and no additional comments have been made after deleting.
This issue can occur to the comment author and possibly to viewers that load the page before the comment is deleted.
Notes
The notes request immediately after deleting the comment contains the deleted comment, but does not add it to the page. Only after refreshing and another notes request does the issue occur. Something on the page seems to discard the comment, but after refreshing it no longer has enough information to determine it was deleted.
Disabling the browser's cache fixes the issue.
Relevant logs and/or screenshots
First notes request (after the comment is created):
Request:
GET /deckar01/gitlab-ce/noteable/issue/4806804/notes HTTP/1.1
X-Last-Fetched-At: 1491322425
X-Requested-With: XMLHttpRequest
Referer: https://gitlab.com/deckar01/gitlab-ce/issues/2
If-None-Match: W/"d5e5c6be38a233c9ec5590f6a6366b12"
Response:
HTTP/1.1 200 OK
Date: Tue, 04 Apr 2017 16:13:50 GMT
Cache-Control: no-cache
Etag: W/"8ce58aa4df4b6ca653ba7f779012eb28"
Strict-Transport-Security: max-age=31536000
Second notes request (after the comment is deleted):
Request:
GET /deckar01/gitlab-ce/noteable/issue/4806804/notes HTTP/1.1
X-Last-Fetched-At: 1491322430
X-Requested-With: XMLHttpRequest
Referer: https://gitlab.com/deckar01/gitlab-ce/issues/2
If-None-Match: W/"8ce58aa4df4b6ca653ba7f779012eb28"
Response:
HTTP/1.1 304 Not Modified
Date: Tue, 04 Apr 2017 16:14:07 GMT
Cache-Control: no-cache
Etag: W/"8ce58aa4df4b6ca653ba7f779012eb28"
Strict-Transport-Security: max-age=31536000
Third notes request (after the page is refreshed):
Request:
GET /deckar01/gitlab-ce/noteable/issue/4806804/notes HTTP/1.1
X-Last-Fetched-At: 1491322452
X-Requested-With: XMLHttpRequest
Referer: https://gitlab.com/deckar01/gitlab-ce/issues/2
If-None-Match: W/"8ce58aa4df4b6ca653ba7f779012eb28"
Response:
HTTP/1.1 304 Not Modified
Date: Tue, 04 Apr 2017 16:14:26 GMT
Cache-Control: no-cache
Etag: W/"8ce58aa4df4b6ca653ba7f779012eb28"
Strict-Transport-Security: max-age=31536000
Output of checks
This bug happens on GitLab.com
Possible fixes
- Bust the cache for the notes request after a comment is deleted