Skip to content

Commit 94605d5

Browse files
committed
Bugfix: Comments for the same line on different files all showed up on the first file.
1 parent dcc4fb3 commit 94605d5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

code_comments/htdocs/code-comments.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,14 @@ var underscore = _.noConflict();
112112
addOne: function(comment) {
113113
var line = comment.get('line');
114114
var file = comment.get('path');
115-
if (!this.viewPerLine[line]) {
116-
this.viewPerLine[line] = new CommentsForALineView( { file: file, line: line } );
115+
var key = 'file_' + file + ':' + line;
116+
if (!this.viewPerLine[key]) {
117+
this.viewPerLine[key] = new CommentsForALineView( { file: file, line: line } );
117118

118119
var $tr = $( Rows.getTrByFileAndLineNumberInFile( file, line ) );
119-
$tr.after(this.viewPerLine[line].render().el).addClass('with-comments');
120+
$tr.after(this.viewPerLine[key].render().el).addClass('with-comments');
120121
}
121-
this.viewPerLine[line].addOne(comment);
122+
this.viewPerLine[key].addOne(comment);
122123
},
123124
addAll: function() {
124125
var view = this;

0 commit comments

Comments
 (0)