##// END OF EJS Templates
emails: added reply link to comment type emails...
dan -
r4050:b3fe0fcc default
parent child Browse files
Show More
@@ -428,6 +428,10 b' channelstream.history.location = %(here)'
428 428 ## If you use proxy-prefix the prefix should be added before /_channelstream
429 429 channelstream.proxy_path = /_channelstream
430 430
431 ## Live chat for commits/pull requests. Requires CHANNELSTREAM to be enabled
432 ## and configured. (EE edition only)
433 chat.enabled = true
434
431 435
432 436 ###################################
433 437 ## APPENLIGHT CONFIG ##
@@ -126,12 +126,13 b' Check if we should use full-topic or min'
126 126
127 127 'pull_request_url': 'http://localhost/pr1',
128 128 'pr_comment_url': 'http://comment-url',
129 'pr_comment_reply_url': 'http://comment-url#reply',
129 130
130 131 'comment_file': None,
131 132 'comment_line': None,
132 133 'comment_type': 'note',
133 134 'comment_body': 'This is my comment body. *I like !*',
134
135 'comment_id': 2048,
135 136 'renderer_type': 'markdown',
136 137 'mention': True,
137 138
@@ -153,6 +154,7 b' Check if we should use full-topic or min'
153 154
154 155 'pull_request_url': 'http://localhost/pr1',
155 156 'pr_comment_url': 'http://comment-url',
157 'pr_comment_reply_url': 'http://comment-url#reply',
156 158
157 159 'comment_type': 'todo',
158 160 'comment_file': None,
@@ -169,7 +171,7 b' def db():'
169 171 ```
170 172
171 173 ''',
172
174 'comment_id': 2048,
173 175 'renderer_type': 'markdown',
174 176 'mention': True,
175 177
@@ -192,6 +194,7 b' def db():'
192 194 'pull_request_url': 'http://localhost/pr1',
193 195
194 196 'pr_comment_url': 'http://comment-url',
197 'pr_comment_reply_url': 'http://comment-url#reply',
195 198
196 199 'comment_file': 'rhodecode/model/db.py',
197 200 'comment_line': 'o1210',
@@ -206,7 +209,7 b' But please check this code::'
206 209
207 210 This should work better !
208 211 ''',
209
212 'comment_id': 2048,
210 213 'renderer_type': 'rst',
211 214 'mention': True,
212 215
@@ -224,7 +227,9 b' This should work better !'
224 227 'comment_file': None,
225 228 'comment_line': None,
226 229 'commit_comment_url': 'http://comment-url',
230 'commit_comment_reply_url': 'http://comment-url#reply',
227 231 'comment_body': 'This is my comment body. *I like !*',
232 'comment_id': 2048,
228 233 'renderer_type': 'markdown',
229 234 'mention': True,
230 235 },
@@ -240,6 +245,7 b' This should work better !'
240 245 'comment_file': None,
241 246 'comment_line': None,
242 247 'commit_comment_url': 'http://comment-url',
248 'commit_comment_reply_url': 'http://comment-url#reply',
243 249 'comment_body': '''
244 250 Hello **world**
245 251
@@ -248,6 +254,7 b' This is a multiline comment :)'
248 254 - list
249 255 - list2
250 256 ''',
257 'comment_id': 2048,
251 258 'renderer_type': 'markdown',
252 259 'mention': True,
253 260 },
@@ -265,7 +272,9 b' This is a multiline comment :)'
265 272 'comment_line': 'n100',
266 273
267 274 'commit_comment_url': 'http://comment-url',
275 'commit_comment_reply_url': 'http://comment-url#reply',
268 276 'comment_body': 'This is my comment body. *I like !*',
277 'comment_id': 2048,
269 278 'renderer_type': 'markdown',
270 279 'mention': True,
271 280 },
@@ -339,7 +339,8 b' class CommentsModel(BaseModel):'
339 339 'comment_body': text,
340 340 'comment_file': f_path,
341 341 'comment_line': line_no,
342 'comment_type': comment_type or 'note'
342 'comment_type': comment_type or 'note',
343 'comment_id': comment.comment_id
343 344 }
344 345
345 346 if commit_obj:
@@ -353,6 +354,9 b' class CommentsModel(BaseModel):'
353 354 recipients += [cs_author]
354 355
355 356 commit_comment_url = self.get_url(comment, request=request)
357 commit_comment_reply_url = self.get_url(
358 comment, request=request,
359 anchor='comment-{}/?/ReplyToComment'.format(comment.comment_id))
356 360
357 361 target_repo_url = h.link_to(
358 362 repo.repo_name,
@@ -364,6 +368,7 b' class CommentsModel(BaseModel):'
364 368 'commit_message': commit_obj.message,
365 369 'commit_target_repo_url': target_repo_url,
366 370 'commit_comment_url': commit_comment_url,
371 'commit_comment_reply_url': commit_comment_reply_url
367 372 })
368 373
369 374 elif pull_request_obj:
@@ -379,11 +384,10 b' class CommentsModel(BaseModel):'
379 384 pr_target_repo = pull_request_obj.target_repo
380 385 pr_source_repo = pull_request_obj.source_repo
381 386
382 pr_comment_url = h.route_url(
383 'pullrequest_show',
384 repo_name=pr_target_repo.repo_name,
385 pull_request_id=pull_request_obj.pull_request_id,
386 _anchor='comment-%s' % comment.comment_id)
387 pr_comment_url = self.get_url(comment, request=request)
388 pr_comment_reply_url = self.get_url(
389 comment, request=request,
390 anchor='comment-{}/?/ReplyToComment'.format(comment.comment_id))
387 391
388 392 pr_url = h.route_url(
389 393 'pullrequest_show',
@@ -407,6 +411,7 b' class CommentsModel(BaseModel):'
407 411 'pull_request_source_repo': pr_source_repo,
408 412 'pull_request_source_repo_url': pr_source_repo_url,
409 413 'pr_comment_url': pr_comment_url,
414 'pr_comment_reply_url': pr_comment_reply_url,
410 415 'pr_closing': closing_pr,
411 416 })
412 417
@@ -505,24 +510,27 b' class CommentsModel(BaseModel):'
505 510 q = q.order_by(ChangesetComment.created_on)
506 511 return q.all()
507 512
508 def get_url(self, comment, request=None, permalink=False):
513 def get_url(self, comment, request=None, permalink=False, anchor=None):
509 514 if not request:
510 515 request = get_current_request()
511 516
512 517 comment = self.__get_commit_comment(comment)
518 if anchor is None:
519 anchor = 'comment-{}'.format(comment.comment_id)
520
513 521 if comment.pull_request:
514 522 pull_request = comment.pull_request
515 523 if permalink:
516 524 return request.route_url(
517 525 'pull_requests_global',
518 526 pull_request_id=pull_request.pull_request_id,
519 _anchor='comment-%s' % comment.comment_id)
527 _anchor=anchor)
520 528 else:
521 529 return request.route_url(
522 530 'pullrequest_show',
523 531 repo_name=safe_str(pull_request.target_repo.repo_name),
524 532 pull_request_id=pull_request.pull_request_id,
525 _anchor='comment-%s' % comment.comment_id)
533 _anchor=anchor)
526 534
527 535 else:
528 536 repo = comment.repo
@@ -532,13 +540,13 b' class CommentsModel(BaseModel):'
532 540 return request.route_url(
533 541 'repo_commit', repo_name=safe_str(repo.repo_id),
534 542 commit_id=commit_id,
535 _anchor='comment-%s' % comment.comment_id)
543 _anchor=anchor)
536 544
537 545 else:
538 546 return request.route_url(
539 547 'repo_commit', repo_name=safe_str(repo.repo_name),
540 548 commit_id=commit_id,
541 _anchor='comment-%s' % comment.comment_id)
549 _anchor=anchor)
542 550
543 551 def get_comments(self, repo_id, revision=None, pull_request=None):
544 552 """
@@ -302,11 +302,15 b' table.code-difftable {'
302 302
303 303
304 304 // Comments
305
306 div.comment:target {
305 .comment-selected-hl {
307 306 border-left: 6px solid @comment-highlight-color !important;
308 padding-left: 3px;
309 margin-left: -9px;
307 padding-left: 3px !important;
308 margin-left: -7px !important;
309 }
310
311 div.comment:target,
312 div.comment-outdated:target {
313 .comment-selected-hl;
310 314 }
311 315
312 316 //TODO: anderson: can't get an absolute number out of anything, so had to put the
@@ -534,15 +534,17 b' function scrollToElement(element, percen'
534 534
535 535 if (location.hash) {
536 536 var result = splitDelimitedHash(location.hash);
537 var loc = result.loc;
537
538 var loc = result.loc;
539
538 540 if (loc.length > 1) {
539 541
540 542 var highlightable_line_tds = [];
541 543
542 544 // source code line format
543 var page_highlights = loc.substring(
544 loc.indexOf('#') + 1).split('L');
545 var page_highlights = loc.substring(loc.indexOf('#') + 1).split('L');
545 546
547 // multi-line HL, for files
546 548 if (page_highlights.length > 1) {
547 549 var highlight_ranges = page_highlights[1].split(",");
548 550 var h_lines = [];
@@ -556,8 +558,7 b' function scrollToElement(element, percen'
556 558 h_lines.push(i);
557 559 }
558 560 }
559 }
560 else {
561 } else {
561 562 h_lines.push(parseInt(highlight_ranges[pos]));
562 563 }
563 564 }
@@ -569,24 +570,45 b' function scrollToElement(element, percen'
569 570 }
570 571 }
571 572
572 // now check a direct id reference (diff page)
573 if ($(loc).length && $(loc).hasClass('cb-lineno')) {
573 // now check a direct id reference of line in diff / pull-request page)
574 if ($(loc).length > 0 && $(loc).hasClass('cb-lineno')) {
574 575 highlightable_line_tds.push($(loc));
575 576 }
577
578 // mark diff lines as selected
576 579 $.each(highlightable_line_tds, function (i, $td) {
577 580 $td.addClass('cb-line-selected'); // line number td
578 581 $td.prev().addClass('cb-line-selected'); // line data
579 582 $td.next().addClass('cb-line-selected'); // line content
580 583 });
581 584
582 if (highlightable_line_tds.length) {
585 if (highlightable_line_tds.length > 0) {
583 586 var $first_line_td = highlightable_line_tds[0];
584 587 scrollToElement($first_line_td);
585 588 $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({
586 589 td: $first_line_td,
587 590 remainder: result.remainder
588 591 });
592 } else {
593 // case for direct anchor to comments
594 var $line = $(loc);
595
596 if ($line.hasClass('comment-general')) {
597 $line.show();
598 } else if ($line.hasClass('comment-inline')) {
599 $line.show();
600 var $cb = $line.closest('.cb');
601 $cb.removeClass('cb-collapsed')
602 }
603 if ($line.length > 0) {
604 $line.addClass('comment-selected-hl');
605 offsetScroll($line, 70);
606 }
607 if (!$line.hasClass('comment-outdated') && result.remainder === '/ReplyToComment') {
608 $line.nextAll('.cb-comment-add-button').trigger('click');
609 }
589 610 }
611
590 612 }
591 613 }
592 614 collapsableContent();
@@ -212,7 +212,6 b''
212 212 }
213 213 });
214 214
215
216 215 // next links
217 216 $('#child_link').on('click', function(e){
218 217 // fetch via ajax what is going to be the next link, if we have
@@ -291,23 +290,12 b''
291 290 }
292 291 });
293 292
294 if (location.hash) {
295 var result = splitDelimitedHash(location.hash);
296 var line = $('html').find(result.loc);
297 if (line.length > 0){
298 offsetScroll(line, 70);
299 }
300 }
301
302 293 // browse tree @ revision
303 294 $('#files_link').on('click', function(e){
304 295 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
305 296 e.preventDefault();
306 297 });
307 298
308 // inject comments into their proper positions
309 var file_comments = $('.inline-comment-placeholder');
310
311 299 })
312 300 </script>
313 301
@@ -12,6 +12,7 b' data = {'
12 12 'comment_file': comment_file,
13 13 'comment_line': comment_line,
14 14 'comment_type': comment_type,
15 'comment_id': comment_id,
15 16
16 17 'commit_id': h.show_id(commit),
17 18 }
@@ -40,6 +41,7 b' data = {'
40 41 'comment_file': comment_file,
41 42 'comment_line': comment_line,
42 43 'comment_type': comment_type,
44 'comment_id': comment_id,
43 45
44 46 'commit_id': h.show_id(commit),
45 47 }
@@ -78,6 +80,7 b' data = {'
78 80 'comment_file': comment_file,
79 81 'comment_line': comment_line,
80 82 'comment_type': comment_type,
83 'comment_id': comment_id,
81 84 'renderer_type': renderer_type or 'plain',
82 85
83 86 'repo': commit_target_repo_url,
@@ -146,16 +149,22 b' data = {'
146 149 </tr>
147 150 % endif
148 151
149 <tr style="background-image: linear-gradient(to right, black 33%, rgba(255,255,255,0) 0%);background-position: bottom;background-size: 3px 1px;background-repeat: repeat-x;">
152 <tr style="border-bottom:1px solid #dbd9da;">
150 153 <td colspan="2" style="padding-right:20px;">
151 154 % if comment_type == 'todo':
152 ${_('`TODO` comment')}:
155 ${_('`TODO` number')} ${comment_id}:
153 156 % else:
154 ${_('`Note` comment')}:
157 ${_('`Note` number')} ${comment_id}:
155 158 % endif
156 159 </td>
157 160 </tr>
158 161
159 <td colspan="2" style="background: #F7F7F7">${h.render(comment_body, renderer=data['renderer_type'], mentions=True)}</td>
162 <tr>
163 <td colspan="2" style="background: #F7F7F7">${h.render(comment_body, renderer=data['renderer_type'], mentions=True)}</td>
164 </tr>
165
166 <tr>
167 <td><a href="${commit_comment_reply_url}">${_('Reply')}</a></td>
168 <td></td>
160 169 </tr>
161 170 </table>
@@ -12,6 +12,7 b' data = {'
12 12 'comment_file': comment_file,
13 13 'comment_line': comment_line,
14 14 'comment_type': comment_type,
15 'comment_id': comment_id,
15 16
16 17 'pr_title': pull_request.title,
17 18 'pr_id': pull_request.pull_request_id,
@@ -41,6 +42,7 b' data = {'
41 42 'comment_file': comment_file,
42 43 'comment_line': comment_line,
43 44 'comment_type': comment_type,
45 'comment_id': comment_id,
44 46
45 47 'pr_title': pull_request.title,
46 48 'pr_id': pull_request.pull_request_id,
@@ -91,6 +93,7 b' data = {'
91 93 'comment_file': comment_file,
92 94 'comment_line': comment_line,
93 95 'comment_type': comment_type,
96 'comment_id': comment_id,
94 97 'renderer_type': renderer_type or 'plain',
95 98
96 99 'pr_title': pull_request.title,
@@ -176,16 +179,22 b' data = {'
176 179 </tr>
177 180 % endif
178 181
179 <tr style="background-image: linear-gradient(to right, black 33%, rgba(255,255,255,0) 0%);background-position: bottom;background-size: 3px 1px;background-repeat: repeat-x;">
182 <tr style="border-bottom:1px solid #dbd9da;">
180 183 <td colspan="2" style="padding-right:20px;">
181 184 % if comment_type == 'todo':
182 ${_('`TODO` comment')}:
185 ${_('`TODO` number')} ${comment_id}:
183 186 % else:
184 ${_('`Note` comment')}:
187 ${_('`Note` number')} ${comment_id}:
185 188 % endif
186 189 </td>
187 190 </tr>
188 191
189 <td colspan="2" style="background: #F7F7F7">${h.render(comment_body, renderer=data['renderer_type'], mentions=True)}</td>
192 <tr>
193 <td colspan="2" style="background: #F7F7F7">${h.render(comment_body, renderer=data['renderer_type'], mentions=True)}</td>
194 </tr>
195
196 <tr>
197 <td><a href="${pr_comment_reply_url}">${_('Reply')}</a></td>
198 <td></td>
190 199 </tr>
191 200 </table>
@@ -576,21 +576,6 b''
576 576 %endif
577 577
578 578 <script type="text/javascript">
579 if (location.hash) {
580 var result = splitDelimitedHash(location.hash);
581 var line = $('html').find(result.loc);
582 // show hidden comments if we use location.hash
583 if (line.hasClass('comment-general')) {
584 $(line).show();
585 } else if (line.hasClass('comment-inline')) {
586 $(line).show();
587 var $cb = $(line).closest('.cb');
588 $cb.removeClass('cb-collapsed')
589 }
590 if (line.length > 0){
591 offsetScroll(line, 70);
592 }
593 }
594 579
595 580 versionController = new VersionController();
596 581 versionController.init();
@@ -796,6 +781,7 b''
796 781 ReviewerAutoComplete('#user');
797 782
798 783 })
784
799 785 </script>
800 786
801 787 </div>
@@ -115,12 +115,15 b' def test_render_comment_subject_no_newli'
115 115 'comment_file': 'test-file.py',
116 116 'comment_line': 'n100',
117 117 'comment_type': 'note',
118 'comment_id': 2048,
118 119 'commit_comment_url': 'http://comment-url',
120 'commit_comment_reply_url': 'http://comment-url/#Reply',
119 121 'instance_url': 'http://rc-instance',
120 122 'comment_body': 'hello world',
121 123 'mention': mention,
122 124
123 125 'pr_comment_url': 'http://comment-url',
126 'pr_comment_reply_url': 'http://comment-url/#Reply',
124 127 'pull_request': pr,
125 128 'pull_request_commits': [],
126 129
General Comments 0
You need to be logged in to leave comments. Login now