From 4483ff67fd710025117cf6fb71fb2c68569ff52d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 11 2015 10:02:37 +0000 Subject: [PATCH 1/6] Fix API documentation --- diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 7aaf8b6..0baa55d 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -40,7 +40,7 @@ def api_new_issue(repo, username=None): Accepts POST queries only. :arg title: The title of the issue/ticket to create - :arg content: The content of the issue to create (ie the description of + :arg issue_content: The content of the issue to create (ie the description of the problem) :arg private: A boolean specifying whether this issue is private or not From b04f7cdc3f01082d8b6f1bd2530e94a9fd98b5d2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 11 2015 10:02:50 +0000 Subject: [PATCH 2/6] Create a simplied form to open new issues: IssueFormSimplified Make the regular form inherit from it to reduce code duplication (although there is plenty of it in this file) --- diff --git a/pagure/forms.py b/pagure/forms.py index 8ea955a..d34ed72 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -25,7 +25,23 @@ class ProjectForm(wtf.Form): ) -class IssueForm(wtf.Form): +class IssueFormSimplied(wtf.Form): + ''' Form to create or edit an issue. ''' + title = wtforms.TextField( + 'Title*', + [wtforms.validators.Required()] + ) + issue_content = wtforms.TextAreaField( + 'Content*', + [wtforms.validators.Required()] + ) + private = wtforms.BooleanField( + 'Private', + [wtforms.validators.optional()], + ) + + +class IssueForm(IssueFormSimplied): ''' Form to create or edit an issue. ''' title = wtforms.TextField( 'Title*', From 313b42a981c8748c5dd54cf25535202633783278 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 11 2015 10:03:51 +0000 Subject: [PATCH 3/6] Drop the status from the requirements to open a new issue --- diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 0baa55d..ccae83b 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -66,8 +66,7 @@ def api_new_issue(repo, username=None): if repo != flask.g.token.project: raise pagure.exceptions.APIError(401, error_code=APIERROR.EINVALIDTOK) - status = pagure.lib.get_issue_statuses(SESSION) - form = pagure.forms.IssueForm(status=status, csrf_enabled=False) + form = pagure.forms.IssueFormSimplied(csrf_enabled=False) if form.validate_on_submit(): title = form.title.data content = form.issue_content.data From 45c33d7aa132a715db1b435e4d9ca4c7ec7547b9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 11 2015 10:04:22 +0000 Subject: [PATCH 4/6] Adjust the tests to not include the status since it's not required --- diff --git a/tests/test_progit_flask_api_issue.py b/tests/test_progit_flask_api_issue.py index fc91fab..9597fd5 100644 --- a/tests/test_progit_flask_api_issue.py +++ b/tests/test_progit_flask_api_issue.py @@ -112,7 +112,6 @@ class PagureFlaskApiIssuetests(tests.Modeltests): data = { 'title': 'test issue', 'issue_content': 'This issue needs attention', - 'status': 'Open', } # Valid request From 06d19f0fce6ce7b9c86d296dd5985476a2749374 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 11 2015 10:17:12 +0000 Subject: [PATCH 5/6] Expand the list of blacklisted project names --- diff --git a/pagure/default_config.py b/pagure/default_config.py index 6995985..5bb57c2 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -144,7 +144,9 @@ SHORT_LENGTH = 6 APPLICATION_ROOT = '/' # List of blacklisted project names -BLACKLISTED_PROJECTS = ['static', 'pv', 'releases'] +BLACKLISTED_PROJECTS = [ + 'static', 'pv', 'releases', 'new', 'api', 'settings', + 'logout', 'login', 'users', 'groups'] ACLS = { 'issue_create': 'Create a new ticket against this project', From 2c86fb2ee723069833fac8b4082b24e294cc4a57 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 11 2015 11:00:55 +0000 Subject: [PATCH 6/6] Have the code tags behave like pre tags --- diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index cee4059..2f98001 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -13,7 +13,7 @@ input { font-size: 100%; } -pre { +pre, code { white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap;