Prevent saving environment roles as empty strings
This commit is contained in:
@@ -27,7 +27,7 @@ class Environments(object):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_member(cls, user, environment, member, role=None):
|
def add_member(cls, environment, member, role):
|
||||||
environment_user = EnvironmentRole(
|
environment_user = EnvironmentRole(
|
||||||
user=member, environment=environment, role=role
|
user=member, environment=environment, role=role
|
||||||
)
|
)
|
||||||
|
@@ -14,9 +14,6 @@ class Projects(object):
|
|||||||
project = Project(workspace=workspace, name=name, description=description)
|
project = Project(workspace=workspace, name=name, description=description)
|
||||||
Environments.create_many(project, environment_names)
|
Environments.create_many(project, environment_names)
|
||||||
|
|
||||||
for environment in project.environments:
|
|
||||||
Environments.add_member(user, environment, user)
|
|
||||||
|
|
||||||
db.session.add(project)
|
db.session.add(project)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@@ -249,7 +249,8 @@ def update_member(workspace_id, member_id):
|
|||||||
if re.match("env_", entry):
|
if re.match("env_", entry):
|
||||||
env_id = entry[4:]
|
env_id = entry[4:]
|
||||||
env_role = form_dict[entry]
|
env_role = form_dict[entry]
|
||||||
ids_and_roles.append({"id": env_id, "role": env_role})
|
if env_role:
|
||||||
|
ids_and_roles.append({"id": env_id, "role": env_role})
|
||||||
|
|
||||||
form = EditMemberForm(http_request.form)
|
form = EditMemberForm(http_request.form)
|
||||||
|
|
||||||
|
@@ -74,8 +74,6 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class='project-list-item__environment__actions'>
|
<div class='project-list-item__environment__actions'>
|
||||||
<div>{{ form.data["environment_role"] }}</div>
|
|
||||||
|
|
||||||
<span v-bind:class="label_class" v-html:on=displayName></span>
|
<span v-bind:class="label_class" v-html:on=displayName></span>
|
||||||
<button v-on:click="openModal('{{ env.name }}RolesModal')" type="button" class="icon-link">set role</button>
|
<button v-on:click="openModal('{{ env.name }}RolesModal')" type="button" class="icon-link">set role</button>
|
||||||
{% call Modal(name=env.name + 'RolesModal', dismissable=False) %}
|
{% call Modal(name=env.name + 'RolesModal', dismissable=False) %}
|
||||||
|
Reference in New Issue
Block a user