File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 112112 addOne : function ( comment ) {
113113 var line = comment . get ( 'line' ) ;
114114 if ( ! this . viewPerLine [ line ] ) {
115- this . viewPerLine [ line ] = new CommentsForALineView ( ) ;
115+ this . viewPerLine [ line ] = new CommentsForALineView ( { line : line } ) ;
116116
117117 var $tr = $ ( CodeComments . $tableRows [ line - 1 ] ) ;
118118
134134 template : _ . template ( CodeComments . templates . comments_for_a_line ) ,
135135 templateData : { } ,
136136 initialize : function ( attrs ) {
137+ this . line = attrs . line ;
137138 this . templateData . colspan = ( 'changeset' === CodeComments . page ) ? 2 : 1 ;
138139 } ,
139140 events : {
145146 return this ;
146147 } ,
147148 addOne : function ( comment ) {
149+ if ( comment . get ( 'line' ) != this . line ) {
150+ throw 'Trying to add a comment with line ' + comment . get ( 'line' ) + ' into a view for line ' + this . line ;
151+ }
148152 var view = new CommentView ( { model : comment } ) ;
149- this . line = comment . get ( 'line' ) ;
150153 view . appendTo ( $ ( "ul.comments" ) ) ;
151154 } ,
152155 showAddCommentDialog : function ( ) {
You can’t perform that action at this time.
0 commit comments