pull-requests: loosen strict view of pull-requests that state is changing...
ergo -
r4103:78e087c7 default
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -682,8 +682,8
682 'target_repo': _render('pullrequest_target_repo',
682 'target_repo': _render('pullrequest_target_repo',
683 pr.target_repo.repo_name),
683 pr.target_repo.repo_name),
684 'name': _render('pullrequest_name',
684 'name': _render('pullrequest_name',
685 pr.pull_request_id, pr.work_in_progress,
685 pr.pull_request_id, pr.pull_request_state,
686 pr.target_repo.repo_name,
686 pr.work_in_progress, pr.target_repo.repo_name,
687 short=True),
687 short=True),
688 'name_raw': pr.pull_request_id,
688 'name_raw': pr.pull_request_id,
689 'status': _render('pullrequest_status',
689 'status': _render('pullrequest_status',
@@ -108,8 +108,8
108
108
109 data.append({
109 data.append({
110 'name': _render('pullrequest_name',
110 'name': _render('pullrequest_name',
111 pr.pull_request_id, pr.work_in_progress,
111 pr.pull_request_id, pr.pull_request_state,
112 pr.target_repo.repo_name),
112 pr.work_in_progress, pr.target_repo.repo_name),
113 'name_raw': pr.pull_request_id,
113 'name_raw': pr.pull_request_id,
114 'status': _render('pullrequest_status',
114 'status': _render('pullrequest_status',
115 pr.calculated_review_status()),
115 pr.calculated_review_status()),
@@ -273,15 +273,7
273 self.request.matchdict['pull_request_id'])
273 self.request.matchdict['pull_request_id'])
274 pull_request_id = pull_request.pull_request_id
274 pull_request_id = pull_request.pull_request_id
275
275
276 if pull_request.pull_request_state != PullRequest.STATE_CREATED:
276 c.state_progressing = pull_request.is_state_changing()
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))
285
277
286 version = self.request.GET.get('version')
278 version = self.request.GET.get('version')
287 from_version = self.request.GET.get('from_version') or version
279 from_version = self.request.GET.get('from_version') or version
@@ -1061,15 +1053,7
1061 return {'response': True,
1053 return {'response': True,
1062 'redirect_url': redirect_url}
1054 'redirect_url': redirect_url}
1063
1055
1064 if pull_request.pull_request_state != PullRequest.STATE_CREATED:
1056 is_state_changing = pull_request.is_state_changing()
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}
1073
1057
1074 # only owner or admin can update it
1058 # only owner or admin can update it
1075 allowed_to_update = PullRequestModel().check_user_update(
1059 allowed_to_update = PullRequestModel().check_user_update(
@@ -1083,6 +1067,16
1083 pull_request, controls['review_members'],
1067 pull_request, controls['review_members'],
1084 pull_request.reviewer_data)
1068 pull_request.reviewer_data)
1085 elif str2bool(self.request.POST.get('update_commits', 'false')):
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 self._update_commits(pull_request)
1080 self._update_commits(pull_request)
1087 if force_refresh:
1081 if force_refresh:
1088 redirect_url = h.route_path(
1082 redirect_url = h.route_path(
@@ -1182,7 +1176,7
1182 self.request.matchdict['pull_request_id'])
1176 self.request.matchdict['pull_request_id'])
1183 _ = self.request.translate
1177 _ = self.request.translate
1184
1178
1185 if pull_request.pull_request_state != PullRequest.STATE_CREATED:
1179 if pull_request.is_state_changing():
1186 log.debug('show: forbidden because pull request is in state %s',
1180 log.debug('show: forbidden because pull request is in state %s',
1187 pull_request.pull_request_state)
1181 pull_request.pull_request_state)
1188 msg = _(u'Cannot merge pull requests in state other than `{}`. '
1182 msg = _(u'Cannot merge pull requests in state other than `{}`. '
@@ -4225,6 +4225,9
4225 def is_closed(self):
4225 def is_closed(self):
4226 return pull_request_obj.is_closed()
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 @property
4231 @property
4229 def pull_request_version_id(self):
4232 def pull_request_version_id(self):
4230 return getattr(pull_request_obj, 'pull_request_version_id', None)
4233 return getattr(pull_request_obj, 'pull_request_version_id', None)
@@ -4256,6 +4259,9
4256 def is_closed(self):
4259 def is_closed(self):
4257 return self.status == self.STATUS_CLOSED
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 def __json__(self):
4265 def __json__(self):
4260 return {
4266 return {
4261 'revisions': self.revisions,
4267 'revisions': self.revisions,
@@ -4313,6 +4319,9
4313 # calculate from original
4319 # calculate from original
4314 return self.pull_request.status == self.STATUS_CLOSED
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 def calculated_review_status(self):
4325 def calculated_review_status(self):
4317 return self.pull_request.calculated_review_status()
4326 return self.pull_request.calculated_review_status()
4318
4327
@@ -414,16 +414,28
414 }
414 }
415
415
416
416
417 #pr-title-input {
417 .pr-title-input {
418 width: 72%;
418 width: 80%;
419 font-size: 1em;
419 font-size: 1em;
420 margin: 0;
420 margin: 0 0 4px 0;
421 padding: 0 0 0 @padding/4;
421 padding: 0;
422 line-height: 1.7em;
422 line-height: 1.7em;
423 color: @text-color;
423 color: @text-color;
424 letter-spacing: .02em;
424 letter-spacing: .02em;
425 font-weight: @text-bold-weight;
425 font-weight: @text-bold-weight;
426 font-family: @text-bold;
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 #pullrequest_title {
441 #pullrequest_title {
@@ -62,6 +62,23
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 .metatag-list {
82 .metatag-list {
66 margin: 0;
83 margin: 0;
67 padding: 0;
84 padding: 0;
@@ -47,10 +47,10
47 pageLength: ${c.visual.dashboard_items},
47 pageLength: ${c.visual.dashboard_items},
48 order: [[ 2, "desc" ]],
48 order: [[ 2, "desc" ]],
49 columns: [
49 columns: [
50 { data: {"_": "target_repo",
51 "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false},
50 { data: {"_": "status",
52 { data: {"_": "status",
51 "sort": "status"}, title: "", className: "td-status", orderable: false},
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 { data: {"_": "name",
54 { data: {"_": "name",
55 "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" },
55 "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" },
56 { data: {"_": "title",
56 { data: {"_": "title",
@@ -78,9 +78,6
78 if (data['owned']) {
78 if (data['owned']) {
79 $(row).addClass('owned');
79 $(row).addClass('owned');
80 }
80 }
81 if (data['state'] !== 'created') {
82 $(row).addClass('state-' + data['state']);
83 }
84 }
81 }
85 });
82 });
86 $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){
83 $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){
@@ -370,17 +370,22
370 <i class="icon-comment"></i> ${comments_nr}
370 <i class="icon-comment"></i> ${comments_nr}
371 </%def>
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 <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}">
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 % if short:
376 % if short:
380 !${pull_request_id}
377 !${pull_request_id}
381 % else:
378 % else:
382 ${_('Pull request !{}').format(pull_request_id)}
379 ${_('Pull request !{}').format(pull_request_id)}
383 % endif
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 </a>
389 </a>
385 </%def>
390 </%def>
386
391
@@ -10,14 +10,17
10 </%def>
10 </%def>
11
11
12 <%def name="breadcrumbs_links()">
12 <%def name="breadcrumbs_links()">
13 <span id="pr-title">
13 <%
14 ${c.pull_request.title}
14 pr_title = c.pull_request.title
15 %if c.pull_request.is_closed():
15 if c.pull_request.is_closed():
16 (${_('Closed')})
16 pr_title = '[{}] {}'.format(_('Closed'), pr_title)
17 %endif
17 %>
18 </span>
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 <div id="pr-title-edit" class="input" style="display: none;">
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 </div>
24 </div>
22 </%def>
25 </%def>
23
26
@@ -151,7 +154,7
151 <div class="input">
154 <div class="input">
152 %if c.pull_request_review_status:
155 %if c.pull_request_review_status:
153 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
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 %if c.pull_request.is_closed():
158 %if c.pull_request.is_closed():
156 ${_('Closed')},
159 ${_('Closed')},
157 %endif
160 %endif
@@ -208,13 +211,13
208 </code>
211 </code>
209 </td>
212 </td>
210 <td>
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}"/>
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}"/>
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}"/>
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 </td>
216 </td>
214 <td>
217 <td>
215 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
218 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
216 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
219 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
217 </div>
220
218 </td>
221 </td>
219 <td>
222 <td>
220 % if c.at_version_num != ver_pr:
223 % if c.at_version_num != ver_pr:
@@ -350,8 +353,17
350 </div>
353 </div>
351 </div>
354 </div>
352 </div>
355 </div>
356
353 <div class="box">
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 <div class="table" >
367 <div class="table" >
356 <div id="changeset_compare_view_content">
368 <div id="changeset_compare_view_content">
357 ##CS
369 ##CS
@@ -599,7 +611,10
599
611
600 %endif
612 %endif
601
613
602 <script type="text/javascript">
614 % endif
615 </div>
616
617 <script type="text/javascript">
603
618
604 versionController = new VersionController();
619 versionController = new VersionController();
605 versionController.init();
620 versionController.init();
@@ -802,8 +817,6
802 })
817 })
803
818
804 </script>
819 </script>
805
806 </div>
807 </div>
820 </div>
808
821
809 </%def>
822 </%def>
@@ -114,9 +114,6
114 if (data['closed']) {
114 if (data['closed']) {
115 $(row).addClass('closed');
115 $(row).addClass('closed');
116 }
116 }
117 if (data['state'] !== 'created') {
118 $(row).addClass('state-' + data['state']);
119 }
120 }
117 }
121 });
118 });
122
119
Comments 0
You need to be logged in to leave comments. Login now