mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Fix setting release notes in release edit
This commit is contained in:
parent
019cd66033
commit
c06ca52f4c
@ -53,7 +53,7 @@ class SwitchUserForm(FlaskForm):
|
||||
def switch_user():
|
||||
form = SwitchUserForm(formdata=request.form)
|
||||
if form.validate_on_submit():
|
||||
user = User.query.filter_by(username=form["username"].data).first()
|
||||
user = User.query.filter_by(username=form.username.data).first()
|
||||
if user is None:
|
||||
flash("Unable to find user", "danger")
|
||||
elif login_user(user):
|
||||
|
@ -68,7 +68,7 @@ class CreatePackageReleaseForm(FlaskForm):
|
||||
|
||||
class EditPackageReleaseForm(FlaskForm):
|
||||
name = StringField(lazy_gettext("Name"), [InputRequired(), Length(1, 30)])
|
||||
title = StringField(lazy_gettext("Title"), [Optional(), Length(1, 30)], filters=[nonempty_or_none])
|
||||
title = StringField(lazy_gettext("Title"), [InputRequired(), Length(1, 30)], filters=[nonempty_or_none])
|
||||
release_notes = TextAreaField(lazy_gettext("Release Notes"), [Optional(), Length(1, 100)],
|
||||
filters=[nonempty_or_none, normalize_line_endings])
|
||||
url = StringField(lazy_gettext("URL"), [Optional()])
|
||||
@ -178,13 +178,15 @@ def edit_release(package, id):
|
||||
|
||||
if form.validate_on_submit():
|
||||
if canEdit:
|
||||
release.title = form["title"].data
|
||||
release.min_rel = form["min_rel"].data.get_actual()
|
||||
release.max_rel = form["max_rel"].data.get_actual()
|
||||
release.name = form.name.data
|
||||
release.title = form.title.data
|
||||
release.release_notes = form.release_notes.data
|
||||
release.min_rel = form.min_rel.data.get_actual()
|
||||
release.max_rel = form.max_rel.data.get_actual()
|
||||
|
||||
if package.check_perm(current_user, Permission.CHANGE_RELEASE_URL):
|
||||
release.url = form["url"].data
|
||||
release.task_id = form["task_id"].data
|
||||
release.url = form.url.data
|
||||
release.task_id = form.task_id.data
|
||||
if release.task_id is not None:
|
||||
release.task_id = None
|
||||
|
||||
@ -227,10 +229,10 @@ def bulk_change_release(package):
|
||||
only_change_none = form.only_change_none.data
|
||||
|
||||
for release in package.releases.all():
|
||||
if form["set_min"].data and (not only_change_none or release.min_rel is None):
|
||||
release.min_rel = form["min_rel"].data.get_actual()
|
||||
if form["set_max"].data and (not only_change_none or release.max_rel is None):
|
||||
release.max_rel = form["max_rel"].data.get_actual()
|
||||
if form.set_min.data and (not only_change_none or release.min_rel is None):
|
||||
release.min_rel = form.min_rel.data.get_actual()
|
||||
if form.set_max.data and (not only_change_none or release.max_rel is None):
|
||||
release.max_rel = form.max_rel.data.get_actual()
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
@ -112,10 +112,10 @@ def edit_screenshot(package, id):
|
||||
was_approved = screenshot.approved
|
||||
|
||||
if can_edit:
|
||||
screenshot.title = form["title"].data or "Untitled"
|
||||
screenshot.title = form.title.data or "Untitled"
|
||||
|
||||
if can_approve:
|
||||
screenshot.approved = form["approved"].data
|
||||
screenshot.approved = form.approved.data
|
||||
else:
|
||||
screenshot.approved = was_approved
|
||||
|
||||
|
@ -370,10 +370,10 @@ def modtools(username):
|
||||
redirect_target = url_for("tasks.check", id=task_id, r=redirect_target)
|
||||
|
||||
if user.check_perm(current_user, Permission.CHANGE_RANK):
|
||||
new_rank = form["rank"].data
|
||||
new_rank = form.rank.data
|
||||
if current_user.rank.at_least(new_rank):
|
||||
if new_rank != user.rank:
|
||||
user.rank = form["rank"].data
|
||||
user.rank = form.rank.data
|
||||
msg = "Set rank of {} to {}".format(user.display_name, user.rank.title)
|
||||
add_audit_log(AuditSeverity.MODERATION, current_user, msg,
|
||||
url_for("users.profile", username=username))
|
||||
|
@ -40,7 +40,7 @@
|
||||
<h3>{{ _("1. Name release") }}</h3>
|
||||
|
||||
{{ render_field(form.name, hint=_("Release short name. Eg: 1.0.0 or 2018-05-28")) }}
|
||||
{{ render_field(form.title, hint=_("Human-readable name. Eg: 1.0.0 - The Trains Update")) }}
|
||||
{{ render_field(form.title, placeholder=_("Same as name"), hint=_("Human-readable name. Eg: 1.0.0 - The Trains Update")) }}
|
||||
{{ render_field(form.release_notes) }}
|
||||
|
||||
<h3 class="mt-5">{{ _("2. Set the content") }}</h3>
|
||||
|
Loading…
Reference in New Issue
Block a user