Show More
@@ -2188,6 +2188,7 b' class ChangesetStatus(Base, BaseModel):' | |||||
2188 | Index('cs_version_idx', 'version'), |
|
2188 | Index('cs_version_idx', 'version'), | |
2189 | Index('cs_pull_request_id_idx', 'pull_request_id'), |
|
2189 | Index('cs_pull_request_id_idx', 'pull_request_id'), | |
2190 | Index('cs_changeset_comment_id_idx', 'changeset_comment_id'), |
|
2190 | Index('cs_changeset_comment_id_idx', 'changeset_comment_id'), | |
|
2191 | Index('cs_pull_request_id_user_id_version_idx', 'pull_request_id', 'user_id', 'version'), | |||
2191 | UniqueConstraint('repo_id', 'revision', 'version'), |
|
2192 | UniqueConstraint('repo_id', 'revision', 'version'), | |
2192 | {'extend_existing': True, 'mysql_engine': 'InnoDB', |
|
2193 | {'extend_existing': True, 'mysql_engine': 'InnoDB', | |
2193 | 'mysql_charset': 'utf8', 'sqlite_autoincrement': True} |
|
2194 | 'mysql_charset': 'utf8', 'sqlite_autoincrement': True} | |
@@ -2292,6 +2293,16 b' class PullRequest(Base, BaseModel):' | |||||
2292 | def last_review_status(self): |
|
2293 | def last_review_status(self): | |
2293 | return str(self.statuses[-1].status) if self.statuses else '' |
|
2294 | return str(self.statuses[-1].status) if self.statuses else '' | |
2294 |
|
2295 | |||
|
2296 | def user_review_status(self, user_id): | |||
|
2297 | """Return the user's latest status votes on PR""" | |||
|
2298 | # note: no filtering on repo - that would be redundant | |||
|
2299 | status = ChangesetStatus.query()\ | |||
|
2300 | .filter(ChangesetStatus.pull_request == self)\ | |||
|
2301 | .filter(ChangesetStatus.user_id == user_id)\ | |||
|
2302 | .order_by(ChangesetStatus.version)\ | |||
|
2303 | .first() | |||
|
2304 | return str(status.status) if status else '' | |||
|
2305 | ||||
2295 | def __json__(self): |
|
2306 | def __json__(self): | |
2296 | return dict( |
|
2307 | return dict( | |
2297 | revisions=self.revisions |
|
2308 | revisions=self.revisions |
@@ -21,14 +21,21 b'' | |||||
21 | </thead> |
|
21 | </thead> | |
22 | % for pr in pullrequests: |
|
22 | % for pr in pullrequests: | |
23 | <tr class="${'pr-closed' if pr.is_closed() else ''}"> |
|
23 | <tr class="${'pr-closed' if pr.is_closed() else ''}"> | |
24 |
<td width=" |
|
24 | <td width="80px"> | |
25 | ## review status |
|
25 | ## review status | |
26 | %if pr.last_review_status: |
|
26 | %if pr.last_review_status: | |
27 |
<i class="icon-circle changeset-status-${pr.last_review_status}" title="${_(" |
|
27 | <i class="icon-circle changeset-status-${pr.last_review_status}" title="${_("Latest vote: %s") % pr.last_review_status}"></i> | |
28 | %else: |
|
28 | %else: | |
29 | <i class="icon-circle changeset-status-not_reviewed" title="${_("Nobody voted")}"></i> |
|
29 | <i class="icon-circle changeset-status-not_reviewed" title="${_("Nobody voted")}"></i> | |
30 | %endif |
|
30 | %endif | |
31 |
|
31 | |||
|
32 | <% status = pr.user_review_status(c.authuser.user_id) %> | |||
|
33 | %if status: | |||
|
34 | <i class="icon-circle changeset-status-${status}" title="${_("You voted: %s") % status}"></i> | |||
|
35 | %else: | |||
|
36 | <i class="icon-circle changeset-status-not_reviewed" title="${_("You didn't vote")}"></i> | |||
|
37 | %endif | |||
|
38 | ||||
32 | ## delete button |
|
39 | ## delete button | |
33 | %if pr.author.user_id == c.authuser.user_id: |
|
40 | %if pr.author.user_id == c.authuser.user_id: | |
34 | ${h.form(url('pullrequest_delete', repo_name=pr.other_repo.repo_name, pull_request_id=pr.pull_request_id),method='delete', style="display:inline-block")} |
|
41 | ${h.form(url('pullrequest_delete', repo_name=pr.other_repo.repo_name, pull_request_id=pr.pull_request_id),method='delete', style="display:inline-block")} |
General Comments 0
You need to be logged in to leave comments.
Login now