Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to disable various karma/bug/test requirements #348

Closed
lmacken opened this issue Aug 25, 2015 · 4 comments · Fixed by #384
Closed

Unable to disable various karma/bug/test requirements #348

lmacken opened this issue Aug 25, 2015 · 4 comments · Fixed by #384
Labels
Critical We can't go on living in this sqalor, drop everything and fix it! JS Issues pertaining to Bodhi's JavaScript code

Comments

@lmacken
Copy link
Contributor

lmacken commented Aug 25, 2015

I am unable to edit an update and uncheck any of the Bug/Test/Karma requirement checkboxes, or even the "Automatically close bugs".

@lmacken lmacken added the Critical We can't go on living in this sqalor, drop everything and fix it! label Aug 25, 2015
@lmacken
Copy link
Contributor Author

lmacken commented Aug 25, 2015

Here is the POST payload when trying to disable require bugs, testcases, and auto-request stable.

{
    "": [],
    "autokarma": [],
    "bugs": [
        "781425",
        "1256191"
    ],
    "builds": "python-shove-0.6.4-1.fc23",
    "close_bugs": "on",
    "csrf_token": "x",
    "edited": "python-shove-0.6.4-1.fc23",
    "notes": "ChangeLog: https://bitbucket.org/lcrees/shove/raw/f612167f6c2b6eb9d9c39852a09db8477dc0aa8f/CHANGELOG",
    "require_bugs": [],
    "require_testcases": [],
    "requirements": "rpmlint",
    "severity": "unspecified",
    "stable_karma": "1",
    "suggest": "unspecified",
    "term": [],
    "type": "enhancement",
    "unstable_karma": "-2"
}

@jwboyer
Copy link
Contributor

jwboyer commented Aug 25, 2015

Issue 341 might be the same as this?

@ralphbean ralphbean added the JS Issues pertaining to Bodhi's JavaScript code label Aug 25, 2015
@ralphbean
Copy link
Contributor

It might be that the colander schema has missing=True for these fields. A patch like this might do it:

diff --git a/bodhi/schemas.py b/bodhi/schemas.py
index 79a60a0..c919653 100644
--- a/bodhi/schemas.py
+++ b/bodhi/schemas.py
@@ -174,7 +174,7 @@ class SaveUpdateSchema(CSRFProtectedSchema, colander.MappingSchema):
     )
     autokarma = colander.SchemaNode(
         colander.Boolean(),
-        missing=True,
+        missing=False,
     )
     stable_karma = colander.SchemaNode(
         colander.Integer(),
@@ -201,11 +201,11 @@ class SaveUpdateSchema(CSRFProtectedSchema, colander.MappingSchema):
     )
     require_bugs = colander.SchemaNode(
         colander.Boolean(),
-        missing=True,
+        missing=False,
     )
     require_testcases = colander.SchemaNode(
         colander.Boolean(),
-        missing=True,
+        missing=False,
     )

@lmacken
Copy link
Contributor Author

lmacken commented Aug 25, 2015

Yeah, I think you might be right @ralphbean. It seems that when the checkboxes are enabled, we get "on", else [], hopefully colander will convert the empty list to False for us.

ralphbean added a commit that referenced this issue Aug 26, 2015
ralphbean added a commit that referenced this issue Aug 27, 2015
This fixes #397.

The bug was introduced in 2c3bba9 when we were trying to fix something else.
The bug stems from the way the list of submitted builds gets generated in
javascript before it is POSTed to the server.  It looks like this when you have
one checkbox unchecked:

```javascript
[
        "foo-1.2.3-1.fc23",
        "bar-0.1.0-1.fc23",
        false,
        "baz-900-2.fc23",
]
```

The code in this patch only pushes that ``false`` value into the list **if**
the checkbox is specially marked with a ``data-singleton`` HTML5 attribute
(which I made up).  So, now:

- lists of checkboxes should *not* get the ``false`` value
  pushed (fixing #397).
- singleton checkboxes will still get their ``false`` value
  included (keeping #348 in good shape).
ralphbean added a commit that referenced this issue Sep 9, 2015
ralphbean added a commit that referenced this issue Sep 9, 2015
This fixes #397.

The bug was introduced in 2c3bba9 when we were trying to fix something else.
The bug stems from the way the list of submitted builds gets generated in
javascript before it is POSTed to the server.  It looks like this when you have
one checkbox unchecked:

```javascript
[
        "foo-1.2.3-1.fc23",
        "bar-0.1.0-1.fc23",
        false,
        "baz-900-2.fc23",
]
```

The code in this patch only pushes that ``false`` value into the list **if**
the checkbox is specially marked with a ``data-singleton`` HTML5 attribute
(which I made up).  So, now:

- lists of checkboxes should *not* get the ``false`` value
  pushed (fixing #397).
- singleton checkboxes will still get their ``false`` value
  included (keeping #348 in good shape).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical We can't go on living in this sqalor, drop everything and fix it! JS Issues pertaining to Bodhi's JavaScript code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants