Show More
@@ -357,6 +357,8 b' class ChangesetController(BaseRepoContro' | |||||
357 | if status else None), |
|
357 | if status else None), | |
358 | status_change_type=status |
|
358 | status_change_type=status | |
359 | ) |
|
359 | ) | |
|
360 | c.inline_comment = True if comment.line_no else False | |||
|
361 | ||||
360 | # get status if set ! |
|
362 | # get status if set ! | |
361 | if status: |
|
363 | if status: | |
362 | # if latest status was from pull request and it's closed |
|
364 | # if latest status was from pull request and it's closed |
@@ -814,7 +814,11 b' class PullrequestsController(BaseRepoCon' | |||||
814 | _inline_cnt, c.inline_versions = cc_model.get_inline_comments_count( |
|
814 | _inline_cnt, c.inline_versions = cc_model.get_inline_comments_count( | |
815 | inline_comments, version=at_version, include_aggregates=True) |
|
815 | inline_comments, version=at_version, include_aggregates=True) | |
816 |
|
816 | |||
|
817 | c.versions = pull_request_display_obj.versions() | |||
817 | c.at_version_num = at_version if at_version and at_version != 'latest' else None |
|
818 | c.at_version_num = at_version if at_version and at_version != 'latest' else None | |
|
819 | c.at_version_pos = ChangesetComment.get_index_from_version( | |||
|
820 | c.at_version_num, c.versions) | |||
|
821 | ||||
818 | is_outdated = lambda co: \ |
|
822 | is_outdated = lambda co: \ | |
819 | not c.at_version_num \ |
|
823 | not c.at_version_num \ | |
820 | or co.pull_request_version_id <= c.at_version_num |
|
824 | or co.pull_request_version_id <= c.at_version_num | |
@@ -872,7 +876,6 b' class PullrequestsController(BaseRepoCon' | |||||
872 | c.pull_request_latest = pull_request_latest |
|
876 | c.pull_request_latest = pull_request_latest | |
873 | c.at_version = at_version |
|
877 | c.at_version = at_version | |
874 |
|
878 | |||
875 | c.versions = pull_request_display_obj.versions() |
|
|||
876 | c.changes = None |
|
879 | c.changes = None | |
877 | c.file_changes = None |
|
880 | c.file_changes = None | |
878 |
|
881 | |||
@@ -983,6 +986,7 b' class PullrequestsController(BaseRepoCon' | |||||
983 | } |
|
986 | } | |
984 | if comm: |
|
987 | if comm: | |
985 | c.co = comm |
|
988 | c.co = comm | |
|
989 | c.inline_comment = True if comm.line_no else False | |||
986 | data.update(comm.get_dict()) |
|
990 | data.update(comm.get_dict()) | |
987 | data.update({'rendered_text': |
|
991 | data.update({'rendered_text': | |
988 | render('changeset/changeset_comment_block.mako')}) |
|
992 | render('changeset/changeset_comment_block.mako')}) |
@@ -2935,6 +2935,14 b' class ChangesetComment(Base, BaseModel):' | |||||
2935 | q = q.filter(cls.pull_request_id == pull_request_id) |
|
2935 | q = q.filter(cls.pull_request_id == pull_request_id) | |
2936 | return q.all() |
|
2936 | return q.all() | |
2937 |
|
2937 | |||
|
2938 | @classmethod | |||
|
2939 | def get_index_from_version(cls, pr_version, versions): | |||
|
2940 | num_versions = [x.pull_request_version_id for x in versions] | |||
|
2941 | try: | |||
|
2942 | return num_versions.index(pr_version) +1 | |||
|
2943 | except (IndexError, ValueError): | |||
|
2944 | return | |||
|
2945 | ||||
2938 | @property |
|
2946 | @property | |
2939 | def outdated(self): |
|
2947 | def outdated(self): | |
2940 | return self.display_state == self.COMMENT_OUTDATED |
|
2948 | return self.display_state == self.COMMENT_OUTDATED | |
@@ -2945,6 +2953,10 b' class ChangesetComment(Base, BaseModel):' | |||||
2945 | """ |
|
2953 | """ | |
2946 | return self.outdated and self.pull_request_version_id != version |
|
2954 | return self.outdated and self.pull_request_version_id != version | |
2947 |
|
2955 | |||
|
2956 | def get_index_version(self, versions): | |||
|
2957 | return self.get_index_from_version( | |||
|
2958 | self.pull_request_version_id, versions) | |||
|
2959 | ||||
2948 | def render(self, mentions=False): |
|
2960 | def render(self, mentions=False): | |
2949 | from rhodecode.lib import helpers as h |
|
2961 | from rhodecode.lib import helpers as h | |
2950 | return h.render(self.text, renderer=self.renderer, mentions=mentions) |
|
2962 | return h.render(self.text, renderer=self.renderer, mentions=mentions) |
@@ -48,6 +48,12 b' tr.inline-comments div {' | |||||
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | .comment { |
|
50 | .comment { | |
|
51 | ||||
|
52 | &.comment-general { | |||
|
53 | border: 1px solid @grey5; | |||
|
54 | padding: 5px 5px 5px 5px; | |||
|
55 | } | |||
|
56 | ||||
51 | margin: @padding 0; |
|
57 | margin: @padding 0; | |
52 | padding: 4px 0 0 0; |
|
58 | padding: 4px 0 0 0; | |
53 | line-height: 1em; |
|
59 | line-height: 1em; | |
@@ -61,6 +67,8 b' tr.inline-comments div {' | |||||
61 | position: relative; |
|
67 | position: relative; | |
62 | width: 100%; |
|
68 | width: 100%; | |
63 | margin: 0 0 .5em 0; |
|
69 | margin: 0 0 .5em 0; | |
|
70 | border-bottom: 1px solid @grey5; | |||
|
71 | padding: 8px 0px; | |||
64 |
|
72 | |||
65 | &:hover .permalink { |
|
73 | &:hover .permalink { | |
66 | visibility: visible; |
|
74 | visibility: visible; | |
@@ -71,8 +79,6 b' tr.inline-comments div {' | |||||
71 | .author, |
|
79 | .author, | |
72 | .date { |
|
80 | .date { | |
73 | display: inline; |
|
81 | display: inline; | |
74 | margin: 0 .5 0 0; |
|
|||
75 | padding: 0 .5 0 0; |
|
|||
76 |
|
82 | |||
77 | &:after { |
|
83 | &:after { | |
78 | content: ' | '; |
|
84 | content: ' | '; | |
@@ -80,6 +86,13 b' tr.inline-comments div {' | |||||
80 | } |
|
86 | } | |
81 | } |
|
87 | } | |
82 |
|
88 | |||
|
89 | .author-general img { | |||
|
90 | top: -3px; | |||
|
91 | } | |||
|
92 | .author-inline img { | |||
|
93 | top: -3px; | |||
|
94 | } | |||
|
95 | ||||
83 | .status-change, |
|
96 | .status-change, | |
84 | .permalink, |
|
97 | .permalink, | |
85 | .changeset-status-lbl { |
|
98 | .changeset-status-lbl { | |
@@ -153,7 +166,6 b' tr.inline-comments div {' | |||||
153 |
|
166 | |||
154 | .text { |
|
167 | .text { | |
155 | clear: both; |
|
168 | clear: both; | |
156 | border: @border-thickness solid @grey5; |
|
|||
157 | .border-radius(@border-radius); |
|
169 | .border-radius(@border-radius); | |
158 | .box-sizing(border-box); |
|
170 | .box-sizing(border-box); | |
159 |
|
171 | |||
@@ -163,6 +175,19 b' tr.inline-comments div {' | |||||
163 | // TODO: lisa: This is needed because of other rst !important rules :[ |
|
175 | // TODO: lisa: This is needed because of other rst !important rules :[ | |
164 | } |
|
176 | } | |
165 | } |
|
177 | } | |
|
178 | ||||
|
179 | .pr-version { | |||
|
180 | float: left; | |||
|
181 | margin: 0px 4px; | |||
|
182 | } | |||
|
183 | .pr-version-inline { | |||
|
184 | float: left; | |||
|
185 | margin: 1px 4px; | |||
|
186 | } | |||
|
187 | .pr-version-num { | |||
|
188 | font-size: 10px; | |||
|
189 | } | |||
|
190 | ||||
166 | } |
|
191 | } | |
167 |
|
192 | |||
168 | .show-outdated-comments { |
|
193 | .show-outdated-comments { |
@@ -1,4 +1,4 b'' | |||||
1 | ## this is a dummy html file for partial rendering on server and sending |
|
1 | ## this is a dummy html file for partial rendering on server and sending | |
2 | ## generated output via ajax after comment submit |
|
2 | ## generated output via ajax after comment submit | |
3 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
3 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> | |
4 |
${comment.comment_block(c.co, inline= |
|
4 | ${comment.comment_block(c.co, inline=c.inline_comment)} |
@@ -7,9 +7,10 b'' | |||||
7 |
|
7 | |||
8 | <%def name="comment_block(comment, inline=False)"> |
|
8 | <%def name="comment_block(comment, inline=False)"> | |
9 | <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version', None)) %> |
|
9 | <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version', None)) %> | |
|
10 | <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %> | |||
10 |
|
11 | |||
11 | <div class="comment |
|
12 | <div class="comment | |
12 | ${'comment-inline' if inline else ''} |
|
13 | ${'comment-inline' if inline else 'comment-general'} | |
13 | ${'comment-outdated' if outdated_at_ver else 'comment-current'}" |
|
14 | ${'comment-outdated' if outdated_at_ver else 'comment-current'}" | |
14 | id="comment-${comment.comment_id}" |
|
15 | id="comment-${comment.comment_id}" | |
15 | line="${comment.line_no}" |
|
16 | line="${comment.line_no}" | |
@@ -17,19 +18,17 b'' | |||||
17 | style="${'display: none;' if outdated_at_ver else ''}"> |
|
18 | style="${'display: none;' if outdated_at_ver else ''}"> | |
18 |
|
19 | |||
19 | <div class="meta"> |
|
20 | <div class="meta"> | |
20 | <div class="author"> |
|
21 | <div class="author ${'author-inline' if inline else 'author-general'}"> | |
21 |
${base.gravatar_with_user(comment.author.email, |
|
22 | ${base.gravatar_with_user(comment.author.email, 20)} | |
22 | </div> |
|
23 | </div> | |
23 | <div class="date"> |
|
24 | <div class="date"> | |
24 | ${h.age_component(comment.modified_at, time_is_local=True)} |
|
25 | ${h.age_component(comment.modified_at, time_is_local=True)} | |
25 | </div> |
|
26 | </div> | |
|
27 | % if inline: | |||
|
28 | <span></span> | |||
|
29 | % else: | |||
26 | <div class="status-change"> |
|
30 | <div class="status-change"> | |
27 | % if comment.pull_request: |
|
31 | % if comment.pull_request: | |
28 | % if comment.outdated: |
|
|||
29 | <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}"> |
|
|||
30 | ${_('Outdated comment from pull request version {}').format(comment.pull_request_version_id)} |
|
|||
31 | </a> |
|
|||
32 | % else: |
|
|||
33 |
|
|
32 | <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}"> | |
34 |
|
|
33 | % if comment.status_change: | |
35 |
|
|
34 | ${_('Vote on pull request #%s') % comment.pull_request.pull_request_id}: | |
@@ -37,7 +36,6 b'' | |||||
37 |
|
|
36 | ${_('Comment on pull request #%s') % comment.pull_request.pull_request_id} | |
38 |
|
|
37 | % endif | |
39 |
|
|
38 | </a> | |
40 | % endif |
|
|||
41 | % else: |
|
39 | % else: | |
42 | % if comment.status_change: |
|
40 | % if comment.status_change: | |
43 | ${_('Status change on commit')}: |
|
41 | ${_('Status change on commit')}: | |
@@ -46,15 +44,51 b'' | |||||
46 | % endif |
|
44 | % endif | |
47 | % endif |
|
45 | % endif | |
48 | </div> |
|
46 | </div> | |
|
47 | % endif | |||
|
48 | ||||
49 |
|
|
49 | % if comment.status_change: | |
50 | <div class="${'flag_status %s' % comment.status_change[0].status}"></div> |
|
50 | <div class="${'flag_status %s' % comment.status_change[0].status}"></div> | |
51 | <div title="${_('Commit status')}" class="changeset-status-lbl"> |
|
51 | <div title="${_('Commit status')}" class="changeset-status-lbl"> | |
52 | ${comment.status_change[0].status_lbl} |
|
52 | ${comment.status_change[0].status_lbl} | |
53 | </div> |
|
53 | </div> | |
54 | %endif |
|
54 | % endif | |
|
55 | ||||
55 | <a class="permalink" href="#comment-${comment.comment_id}"> ¶</a> |
|
56 | <a class="permalink" href="#comment-${comment.comment_id}"> ¶</a> | |
56 |
|
57 | |||
57 | <div class="comment-links-block"> |
|
58 | <div class="comment-links-block"> | |
|
59 | ||||
|
60 | % if inline: | |||
|
61 | % if outdated_at_ver: | |||
|
62 | <div class="pr-version-inline"> | |||
|
63 | <a href="${h.url.current(version=comment.pull_request_version_id, anchor='comment-{}'.format(comment.comment_id))}"> | |||
|
64 | <code class="pr-version-num"> | |||
|
65 | outdated ${'v{}'.format(pr_index_ver)} | |||
|
66 | </code> | |||
|
67 | </a> | |||
|
68 | </div> | |||
|
69 | | | |||
|
70 | % endif | |||
|
71 | % else: | |||
|
72 | % if comment.pull_request_version_id and pr_index_ver: | |||
|
73 | | | |||
|
74 | <div class="pr-version"> | |||
|
75 | % if comment.outdated: | |||
|
76 | <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}"> | |||
|
77 | ${_('Outdated comment from pull request version {}').format(pr_index_ver)} | |||
|
78 | </a> | |||
|
79 | % else: | |||
|
80 | <div class="tooltip" title="${_('Comment from pull request version {0}').format(pr_index_ver)}"> | |||
|
81 | <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}"> | |||
|
82 | <code class="pr-version-num"> | |||
|
83 | ${'v{}'.format(pr_index_ver)} | |||
|
84 | </code> | |||
|
85 | </a> | |||
|
86 | </div> | |||
|
87 | % endif | |||
|
88 | </div> | |||
|
89 | % endif | |||
|
90 | % endif | |||
|
91 | ||||
58 | ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed |
|
92 | ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed | |
59 | ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated |
|
93 | ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated | |
60 | %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())): |
|
94 | %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())): |
@@ -176,10 +176,10 b' collapse_all = len(diffset.files) > coll' | |||||
176 | '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}} |
|
176 | '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}} | |
177 | %endif |
|
177 | %endif | |
178 |
|
178 | |||
179 |
<% at_ver = getattr(c, 'at_version_ |
|
179 | <% at_ver = getattr(c, 'at_version_pos', None) %> | |
180 | % if at_ver: |
|
180 | % if at_ver: | |
181 | <div class="pull-right"> |
|
181 | <div class="pull-right"> | |
182 |
${_(' |
|
182 | ${_('Showing changes at version %d') % at_ver} | |
183 | </div> |
|
183 | </div> | |
184 | % endif |
|
184 | % endif | |
185 |
|
185 |
@@ -203,8 +203,11 b'' | |||||
203 |
|
203 | |||
204 | ## SHOW ALL VERSIONS OF PR |
|
204 | ## SHOW ALL VERSIONS OF PR | |
205 | <% ver_pr = None %> |
|
205 | <% ver_pr = None %> | |
206 |
% for |
|
206 | % for data in reversed(list(enumerate(c.versions, 1))): | |
|
207 | <% ver_pos = data[0] %> | |||
|
208 | <% ver = data[1] %> | |||
207 | <% ver_pr = ver.pull_request_version_id %> |
|
209 | <% ver_pr = ver.pull_request_version_id %> | |
|
210 | ||||
208 | <tr class="version-pr" style="display: ${'' if c.at_version == ver_pr else 'none'}"> |
|
211 | <tr class="version-pr" style="display: ${'' if c.at_version == ver_pr else 'none'}"> | |
209 | <td> |
|
212 | <td> | |
210 | % if c.at_version == ver_pr: |
|
213 | % if c.at_version == ver_pr: | |
@@ -214,7 +217,9 b'' | |||||
214 | % endif |
|
217 | % endif | |
215 | </td> |
|
218 | </td> | |
216 | <td> |
|
219 | <td> | |
217 | <code><a href="${h.url.current(version=ver_pr)}">version ${ver_pr}</a></code> |
|
220 | <code class="tooltip" title="${_('Comment from pull request version {0}').format(ver_pos)}"> | |
|
221 | <a href="${h.url.current(version=ver_pr)}">v${ver_pos}</a> | |||
|
222 | </code> | |||
218 | </td> |
|
223 | </td> | |
219 | <td> |
|
224 | <td> | |
220 | <code>${ver.source_ref_parts.commit_id[:6]}</code> |
|
225 | <code>${ver.source_ref_parts.commit_id[:6]}</code> |
General Comments 0
You need to be logged in to leave comments.
Login now