Show More
@@ -364,6 +364,7 b' def comment_pull_request(' | |||
|
364 | 364 | request, apiuser, repoid, pullrequestid, message=Optional(None), |
|
365 | 365 | commit_id=Optional(None), status=Optional(None), |
|
366 | 366 | comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE), |
|
367 | resolves_comment_id=Optional(None), | |
|
367 | 368 | userid=Optional(OAttr('apiuser'))): |
|
368 | 369 | """ |
|
369 | 370 | Comment on the pull request specified with the `pullrequestid`, |
@@ -422,6 +423,7 b' def comment_pull_request(' | |||
|
422 | 423 | status = Optional.extract(status) |
|
423 | 424 | commit_id = Optional.extract(commit_id) |
|
424 | 425 | comment_type = Optional.extract(comment_type) |
|
426 | resolves_comment_id = Optional.extract(resolves_comment_id) | |
|
425 | 427 | |
|
426 | 428 | if not message and not status: |
|
427 | 429 | raise JSONRPCError( |
@@ -446,6 +448,17 b' def comment_pull_request(' | |||
|
446 | 448 | if commit_idx != 0: |
|
447 | 449 | allowed_to_change_status = False |
|
448 | 450 | |
|
451 | if resolves_comment_id: | |
|
452 | comment = ChangesetComment.get(resolves_comment_id) | |
|
453 | if not comment: | |
|
454 | raise JSONRPCError( | |
|
455 | 'Invalid resolves_comment_id `%s` for this pull request.' | |
|
456 | % resolves_comment_id) | |
|
457 | if comment.comment_type != ChangesetComment.COMMENT_TYPE_TODO: | |
|
458 | raise JSONRPCError( | |
|
459 | 'Comment `%s` is wrong type for setting status to resolved.' | |
|
460 | % resolves_comment_id) | |
|
461 | ||
|
449 | 462 | text = message |
|
450 | 463 | status_label = ChangesetStatus.get_status_lbl(status) |
|
451 | 464 | if status and allowed_to_change_status: |
@@ -468,7 +481,8 b' def comment_pull_request(' | |||
|
468 | 481 | status_change_type=(status if status_change else None), |
|
469 | 482 | closing_pr=False, |
|
470 | 483 | renderer=renderer, |
|
471 | comment_type=comment_type | |
|
484 | comment_type=comment_type, | |
|
485 | resolves_comment_id=resolves_comment_id | |
|
472 | 486 | ) |
|
473 | 487 | |
|
474 | 488 | if allowed_to_change_status and status: |
@@ -1385,6 +1385,7 b' def lock(request, apiuser, repoid, locke' | |||
|
1385 | 1385 | def comment_commit( |
|
1386 | 1386 | request, apiuser, repoid, commit_id, message, status=Optional(None), |
|
1387 | 1387 | comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE), |
|
1388 | resolves_comment_id=Optional(None), | |
|
1388 | 1389 | userid=Optional(OAttr('apiuser'))): |
|
1389 | 1390 | """ |
|
1390 | 1391 | Set a commit comment, and optionally change the status of the commit. |
@@ -1431,12 +1432,24 b' def comment_commit(' | |||
|
1431 | 1432 | user = get_user_or_error(userid) |
|
1432 | 1433 | status = Optional.extract(status) |
|
1433 | 1434 | comment_type = Optional.extract(comment_type) |
|
1435 | resolves_comment_id = Optional.extract(resolves_comment_id) | |
|
1434 | 1436 | |
|
1435 | 1437 | allowed_statuses = [x[0] for x in ChangesetStatus.STATUSES] |
|
1436 | 1438 | if status and status not in allowed_statuses: |
|
1437 | 1439 | raise JSONRPCError('Bad status, must be on ' |
|
1438 | 1440 | 'of %s got %s' % (allowed_statuses, status,)) |
|
1439 | 1441 | |
|
1442 | if resolves_comment_id: | |
|
1443 | comment = ChangesetComment.get(resolves_comment_id) | |
|
1444 | if not comment: | |
|
1445 | raise JSONRPCError( | |
|
1446 | 'Invalid resolves_comment_id `%s` for this commit.' | |
|
1447 | % resolves_comment_id) | |
|
1448 | if comment.comment_type != ChangesetComment.COMMENT_TYPE_TODO: | |
|
1449 | raise JSONRPCError( | |
|
1450 | 'Comment `%s` is wrong type for setting status to resolved.' | |
|
1451 | % resolves_comment_id) | |
|
1452 | ||
|
1440 | 1453 | try: |
|
1441 | 1454 | rc_config = SettingsModel().get_all_settings() |
|
1442 | 1455 | renderer = rc_config.get('rhodecode_markup_renderer', 'rst') |
@@ -1446,7 +1459,8 b' def comment_commit(' | |||
|
1446 | 1459 | status_change=status_change_label, |
|
1447 | 1460 | status_change_type=status, |
|
1448 | 1461 | renderer=renderer, |
|
1449 | comment_type=comment_type | |
|
1462 | comment_type=comment_type, | |
|
1463 | resolves_comment_id=resolves_comment_id | |
|
1450 | 1464 | ) |
|
1451 | 1465 | if status: |
|
1452 | 1466 | # also do a status change |
General Comments 0
You need to be logged in to leave comments.
Login now