Fix visibility updates in project settings

This commit is contained in:
Drew DeVault 2020-04-30 14:02:08 -04:00
parent b821833d07
commit 9765707eb7
2 changed files with 12 additions and 2 deletions

View File

@ -145,6 +145,7 @@ def config_POST(owner, project_name):
valid = Validation(request)
description = valid.require("description")
website = valid.optional("website")
visibility = valid.require("visibility", cls=Visibility)
valid.expect(not website or valid_url(website),
"Website must be a valid http or https URL")
if not valid.ok:
@ -153,6 +154,7 @@ def config_POST(owner, project_name):
project.description = description
project.website = website
project.visibility = visibility
db.session.commit()
return redirect(url_for("projects.summary_GET",

View File

@ -54,8 +54,10 @@
class="form-check-input"
type="radio"
name="visibility"
value="public"
checked> Public
{% if project.visibility.value == "public" %}
checked
{% endif %}
value="public"> Public
<small id="visibility-public-help" class="form-text text-muted">
Shown on your profile and listed in the public project index
</small>
@ -70,6 +72,9 @@
class="form-check-input"
type="radio"
name="visibility"
{% if project.visibility.value == "unlisted" %}
checked
{% endif %}
value="unlisted"> Unlisted
<small id="visibility-unlisted-help" class="form-text text-muted">
Visible to anyone who knows the URL, but not shown on your profile
@ -85,6 +90,9 @@
class="form-check-input"
type="radio"
name="visibility"
{% if project.visibility.value == "private" %}
checked
{% endif %}
value="private"> Private
<small id="visibility-unlisted-help" class="form-text text-muted">
Only visible to you and your collaborators