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