##// END OF EJS Templates
pull-requests: loosen strict view of pull-requests that state is changing...
ergo -
r4103:78e087c7 default
parent child Browse files
Show More
@@ -682,8 +682,8 b' class MyAccountView(BaseAppView, DataGri'
682 682 'target_repo': _render('pullrequest_target_repo',
683 683 pr.target_repo.repo_name),
684 684 'name': _render('pullrequest_name',
685 pr.pull_request_id, pr.work_in_progress,
686 pr.target_repo.repo_name,
685 pr.pull_request_id, pr.pull_request_state,
686 pr.work_in_progress, pr.target_repo.repo_name,
687 687 short=True),
688 688 'name_raw': pr.pull_request_id,
689 689 'status': _render('pullrequest_status',
@@ -108,8 +108,8 b' class RepoPullRequestsView(RepoAppView, '
108 108
109 109 data.append({
110 110 'name': _render('pullrequest_name',
111 pr.pull_request_id, pr.work_in_progress,
112 pr.target_repo.repo_name),
111 pr.pull_request_id, pr.pull_request_state,
112 pr.work_in_progress, pr.target_repo.repo_name),
113 113 'name_raw': pr.pull_request_id,
114 114 'status': _render('pullrequest_status',
115 115 pr.calculated_review_status()),
@@ -273,15 +273,7 b' class RepoPullRequestsView(RepoAppView, '
273 273 self.request.matchdict['pull_request_id'])
274 274 pull_request_id = pull_request.pull_request_id
275 275
276 if pull_request.pull_request_state != PullRequest.STATE_CREATED:
277 log.debug('show: forbidden because pull request is in state %s',
278 pull_request.pull_request_state)
279 msg = _(u'Cannot show pull requests in state other than `{}`. '
280 u'Current state is: `{}`').format(PullRequest.STATE_CREATED,
281 pull_request.pull_request_state)
282 h.flash(msg, category='error')
283 raise HTTPFound(h.route_path('pullrequest_show_all',
284 repo_name=self.db_repo_name))
276 c.state_progressing = pull_request.is_state_changing()
285 277
286 278 version = self.request.GET.get('version')
287 279 from_version = self.request.GET.get('from_version') or version
@@ -1061,15 +1053,7 b' class RepoPullRequestsView(RepoAppView, '
1061 1053 return {'response': True,
1062 1054 'redirect_url': redirect_url}
1063 1055
1064 if pull_request.pull_request_state != PullRequest.STATE_CREATED:
1065 log.debug('update: forbidden because pull request is in state %s',
1066 pull_request.pull_request_state)
1067 msg = _(u'Cannot update pull requests in state other than `{}`. '
1068 u'Current state is: `{}`').format(PullRequest.STATE_CREATED,
1069 pull_request.pull_request_state)
1070 h.flash(msg, category='error')
1071 return {'response': True,
1072 'redirect_url': redirect_url}
1056 is_state_changing = pull_request.is_state_changing()
1073 1057
1074 1058 # only owner or admin can update it
1075 1059 allowed_to_update = PullRequestModel().check_user_update(
@@ -1083,6 +1067,16 b' class RepoPullRequestsView(RepoAppView, '
1083 1067 pull_request, controls['review_members'],
1084 1068 pull_request.reviewer_data)
1085 1069 elif str2bool(self.request.POST.get('update_commits', 'false')):
1070 if is_state_changing:
1071 log.debug('commits update: forbidden because pull request is in state %s',
1072 pull_request.pull_request_state)
1073 msg = _(u'Cannot update pull requests commits in state other than `{}`. '
1074 u'Current state is: `{}`').format(
1075 PullRequest.STATE_CREATED, pull_request.pull_request_state)
1076 h.flash(msg, category='error')
1077 return {'response': True,
1078 'redirect_url': redirect_url}
1079
1086 1080 self._update_commits(pull_request)
1087 1081 if force_refresh:
1088 1082 redirect_url = h.route_path(
@@ -1182,7 +1176,7 b' class RepoPullRequestsView(RepoAppView, '
1182 1176 self.request.matchdict['pull_request_id'])
1183 1177 _ = self.request.translate
1184 1178
1185 if pull_request.pull_request_state != PullRequest.STATE_CREATED:
1179 if pull_request.is_state_changing():
1186 1180 log.debug('show: forbidden because pull request is in state %s',
1187 1181 pull_request.pull_request_state)
1188 1182 msg = _(u'Cannot merge pull requests in state other than `{}`. '
@@ -4225,6 +4225,9 b' class PullRequest(Base, _PullRequestBase'
4225 4225 def is_closed(self):
4226 4226 return pull_request_obj.is_closed()
4227 4227
4228 def is_state_changing(self):
4229 return pull_request_obj.is_state_changing()
4230
4228 4231 @property
4229 4232 def pull_request_version_id(self):
4230 4233 return getattr(pull_request_obj, 'pull_request_version_id', None)
@@ -4256,6 +4259,9 b' class PullRequest(Base, _PullRequestBase'
4256 4259 def is_closed(self):
4257 4260 return self.status == self.STATUS_CLOSED
4258 4261
4262 def is_state_changing(self):
4263 return self.pull_request_state != PullRequest.STATE_CREATED
4264
4259 4265 def __json__(self):
4260 4266 return {
4261 4267 'revisions': self.revisions,
@@ -4313,6 +4319,9 b' class PullRequestVersion(Base, _PullRequ'
4313 4319 # calculate from original
4314 4320 return self.pull_request.status == self.STATUS_CLOSED
4315 4321
4322 def is_state_changing(self):
4323 return self.pull_request.pull_request_state != PullRequest.STATE_CREATED
4324
4316 4325 def calculated_review_status(self):
4317 4326 return self.pull_request.calculated_review_status()
4318 4327
@@ -414,16 +414,28 b' ul.auth_plugins {'
414 414 }
415 415
416 416
417 #pr-title-input {
418 width: 72%;
417 .pr-title-input {
418 width: 80%;
419 419 font-size: 1em;
420 margin: 0;
421 padding: 0 0 0 @padding/4;
420 margin: 0 0 4px 0;
421 padding: 0;
422 422 line-height: 1.7em;
423 423 color: @text-color;
424 424 letter-spacing: .02em;
425 425 font-weight: @text-bold-weight;
426 426 font-family: @text-bold;
427
428 &:hover {
429 box-shadow: none;
430 }
431 }
432
433 #pr-title {
434 input {
435 border: 1px transparent;
436 color: black;
437 opacity: 1
438 }
427 439 }
428 440
429 441 #pullrequest_title {
@@ -62,6 +62,23 b''
62 62 }
63 63
64 64
65 .tag-merge-state-created {
66 color: @color1;
67 }
68
69 .tag-merge-state-creating {
70 color: @color1;
71 }
72
73 .tag-merge-state-merging {
74 color: @color3;
75 }
76
77 .tag-merge-state-updating {
78 color: @color3;
79 }
80
81
65 82 .metatag-list {
66 83 margin: 0;
67 84 padding: 0;
@@ -47,10 +47,10 b''
47 47 pageLength: ${c.visual.dashboard_items},
48 48 order: [[ 2, "desc" ]],
49 49 columns: [
50 { data: {"_": "target_repo",
51 "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false},
50 52 { data: {"_": "status",
51 53 "sort": "status"}, title: "", className: "td-status", orderable: false},
52 { data: {"_": "target_repo",
53 "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false},
54 54 { data: {"_": "name",
55 55 "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" },
56 56 { data: {"_": "title",
@@ -78,9 +78,6 b''
78 78 if (data['owned']) {
79 79 $(row).addClass('owned');
80 80 }
81 if (data['state'] !== 'created') {
82 $(row).addClass('state-' + data['state']);
83 }
84 81 }
85 82 });
86 83 $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){
@@ -370,17 +370,22 b''
370 370 <i class="icon-comment"></i> ${comments_nr}
371 371 </%def>
372 372
373 <%def name="pullrequest_name(pull_request_id, is_wip, target_repo_name, short=False)">
373 <%def name="pullrequest_name(pull_request_id, state, is_wip, target_repo_name, short=False)">
374 374 <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}">
375 % if is_wip:
376 <span class="tag tooltip" title="${_('Work in progress')}">wip</span>
377 % endif
378 375
379 376 % if short:
380 377 !${pull_request_id}
381 378 % else:
382 379 ${_('Pull request !{}').format(pull_request_id)}
383 380 % endif
381
382 % if state not in ['created']:
383 <span class="tag tag-merge-state-${state} tooltip" title="Pull request state is changing">${state}</span>
384 % endif
385
386 % if is_wip:
387 <span class="tag tooltip" title="${_('Work in progress')}">wip</span>
388 % endif
384 389 </a>
385 390 </%def>
386 391
@@ -10,14 +10,17 b''
10 10 </%def>
11 11
12 12 <%def name="breadcrumbs_links()">
13 <span id="pr-title">
14 ${c.pull_request.title}
15 %if c.pull_request.is_closed():
16 (${_('Closed')})
17 %endif
18 </span>
13 <%
14 pr_title = c.pull_request.title
15 if c.pull_request.is_closed():
16 pr_title = '[{}] {}'.format(_('Closed'), pr_title)
17 %>
18
19 <div id="pr-title">
20 <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${pr_title}">
21 </div>
19 22 <div id="pr-title-edit" class="input" style="display: none;">
20 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
23 <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}">
21 24 </div>
22 25 </%def>
23 26
@@ -151,7 +154,7 b''
151 154 <div class="input">
152 155 %if c.pull_request_review_status:
153 156 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
154 <span class="changeset-status-lbl tooltip">
157 <span class="changeset-status-lbl">
155 158 %if c.pull_request.is_closed():
156 159 ${_('Closed')},
157 160 %endif
@@ -208,13 +211,13 b''
208 211 </code>
209 212 </td>
210 213 <td>
211 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
212 <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
214 <input ${('checked="checked"' if c.from_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
215 <input ${('checked="checked"' if c.at_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
213 216 </td>
214 217 <td>
215 218 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
216 219 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
217 </div>
220
218 221 </td>
219 222 <td>
220 223 % if c.at_version_num != ver_pr:
@@ -350,8 +353,17 b''
350 353 </div>
351 354 </div>
352 355 </div>
356
353 357 <div class="box">
354 ##DIFF
358
359 % if c.state_progressing:
360 <h2 style="text-align: center">
361 ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span>
362 </h2>
363
364 % else:
365
366 ## Diffs rendered here
355 367 <div class="table" >
356 368 <div id="changeset_compare_view_content">
357 369 ##CS
@@ -599,6 +611,9 b''
599 611
600 612 %endif
601 613
614 % endif
615 </div>
616
602 617 <script type="text/javascript">
603 618
604 619 versionController = new VersionController();
@@ -802,8 +817,6 b''
802 817 })
803 818
804 819 </script>
805
806 </div>
807 820 </div>
808 821
809 822 </%def>
@@ -114,9 +114,6 b''
114 114 if (data['closed']) {
115 115 $(row).addClass('closed');
116 116 }
117 if (data['state'] !== 'created') {
118 $(row).addClass('state-' + data['state']);
119 }
120 117 }
121 118 });
122 119
General Comments 0
You need to be logged in to leave comments. Login now