+ Patch: 0001-Display-real-line-numbers-on-pull-request-s-diff-vie.patch + Patch: 0002-Show-the-assignee-s-avatar-on-the-board.patch + Patch: 0003-Allow-setting-a-status-as-closing-even-if-the-projec.patch + Patch: 0004-Include-the-assignee-in-the-list-of-people-notified-.patch + Patch: 0005-Introduce-the-collaborator_project_groups-mapping.patch + Patch: 0006-When-a-file-a-detected-as-a-binary-file-return-the-r.patch + Patch: 0007-Remove-fenced-code-block-when-checking-mention.patch + Patch: 0008-Add-support-for-using-cchardet-to-detect-files-encod.patch + Patch: 0009-Add-support-for-disabling-user-registration.patch - Remove mandatory dependency on systemd to ease containerization OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/pagure?expand=0&rev=46
129 lines
4.5 KiB
Diff
129 lines
4.5 KiB
Diff
From 9fd32d4d948fc4231eee68e8044b844060db140c Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
|
Date: Wed, 12 Aug 2020 20:56:18 +0200
|
|
Subject: [PATCH 3/9] Allow setting a status as closing even if the project has
|
|
no close_status
|
|
|
|
When determining if a status "closes" tickets or not, we should first
|
|
check if it was set to and only if it wasn't then check if there was a
|
|
close_status set for it. Otherwise the logic wasn't correctly interpreted.
|
|
|
|
Fixes https://pagure.io/pagure/issue/4958
|
|
|
|
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
|
---
|
|
pagure/api/boards.py | 4 +-
|
|
tests/test_pagure_flask_api_boards.py | 81 +++++++++++++++++++++++++++
|
|
2 files changed, 84 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/pagure/api/boards.py b/pagure/api/boards.py
|
|
index e42f7cb6..669fd457 100644
|
|
--- a/pagure/api/boards.py
|
|
+++ b/pagure/api/boards.py
|
|
@@ -510,7 +510,9 @@ def api_board_status(repo, board_name, username=None, namespace=None):
|
|
|
|
try:
|
|
close_status = data[name].get("close_status") or None
|
|
- close = data[name].get("close") or True if close_status else False
|
|
+ close = data[name].get("close") or (
|
|
+ True if close_status else False
|
|
+ )
|
|
if close_status not in repo.close_status:
|
|
close_status = None
|
|
|
|
diff --git a/tests/test_pagure_flask_api_boards.py b/tests/test_pagure_flask_api_boards.py
|
|
index ef125878..67199703 100644
|
|
--- a/tests/test_pagure_flask_api_boards.py
|
|
+++ b/tests/test_pagure_flask_api_boards.py
|
|
@@ -801,6 +801,87 @@ class PagureFlaskApiBoardsWithBoardtests(tests.SimplePagureTest):
|
|
},
|
|
)
|
|
|
|
+ def test_api_board_api_board_status_no_close_status(self):
|
|
+ headers = {
|
|
+ "Authorization": "token aaabbbcccddd",
|
|
+ "Content-Type": "application/json",
|
|
+ }
|
|
+
|
|
+ data = json.dumps(
|
|
+ {
|
|
+ "Backlog": {
|
|
+ "close": False,
|
|
+ "close_status": None,
|
|
+ "bg_color": "#FFB300",
|
|
+ "default": True,
|
|
+ "rank": 1,
|
|
+ },
|
|
+ "Triaged": {
|
|
+ "close": False,
|
|
+ "close_status": None,
|
|
+ "bg_color": "#ca0dcd",
|
|
+ "default": False,
|
|
+ "rank": 2,
|
|
+ },
|
|
+ "Done": {
|
|
+ "close": True,
|
|
+ "close_status": None,
|
|
+ "bg_color": "#34d240",
|
|
+ "default": False,
|
|
+ "rank": 4,
|
|
+ },
|
|
+ " ": {
|
|
+ "close": True,
|
|
+ "close_status": None,
|
|
+ "bg_color": "#34d240",
|
|
+ "default": False,
|
|
+ "rank": 5,
|
|
+ },
|
|
+ }
|
|
+ )
|
|
+ output = self.app.post(
|
|
+ "/api/0/test/boards/dev/status", headers=headers, data=data
|
|
+ )
|
|
+ self.assertEqual(output.status_code, 200)
|
|
+ data = json.loads(output.get_data(as_text=True))
|
|
+ self.assertDictEqual(
|
|
+ data,
|
|
+ {
|
|
+ "board": {
|
|
+ "active": True,
|
|
+ "name": "dev",
|
|
+ "status": [
|
|
+ {
|
|
+ "bg_color": "#FFB300",
|
|
+ "close": False,
|
|
+ "close_status": None,
|
|
+ "default": True,
|
|
+ "name": "Backlog",
|
|
+ },
|
|
+ {
|
|
+ "bg_color": "#ca0dcd",
|
|
+ "close": False,
|
|
+ "close_status": None,
|
|
+ "default": False,
|
|
+ "name": "Triaged",
|
|
+ },
|
|
+ {
|
|
+ "name": "Done",
|
|
+ "close": True,
|
|
+ "close_status": None,
|
|
+ "default": False,
|
|
+ "bg_color": "#34d240",
|
|
+ },
|
|
+ ],
|
|
+ "tag": {
|
|
+ "tag": "dev",
|
|
+ "tag_color": "DeepBlueSky",
|
|
+ "tag_description": "",
|
|
+ },
|
|
+ }
|
|
+ },
|
|
+ )
|
|
+
|
|
def test_api_board_api_board_status_adding_removing(self):
|
|
headers = {
|
|
"Authorization": "token aaabbbcccddd",
|
|
--
|
|
2.26.2
|
|
|