changed to set contact of space is optional in web UI and API

pull/18/MERGE
13621160019@163.com 2021-03-15 13:46:16 +08:00
parent 8fca486742
commit 57b6dd3266
2 changed files with 4 additions and 4 deletions

View File

@ -28,10 +28,10 @@
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-4 control-label">{{'SETTING.CONTACT' | translate}}</label>
<div class="form-group"><label class="col-sm-4 control-label">{{'SETTING.CONTACT' | translate}} ({{'SETTING.OPTIONAL' | translate}})</label>
<div class="col-sm-8">
<ui-select ng-model="space.contact.id" name="spacecontact" theme="bootstrap">
<ui-select-match allow-clear="false" placeholder="{{'COMMON.PLACEHOLDER' | translate}}">
<ui-select-match allow-clear="true" placeholder="{{'COMMON.PLACEHOLDER' | translate}}">
{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="contact.id as contact in contacts | filter: $select.search">
<div ng-bind-html="contact.name | highlight: $select.search"></div>

View File

@ -567,7 +567,7 @@ class SpaceItem:
description='API.INVALID_IS_OUTPUT_COUNTED_VALUE')
is_output_counted = new_values['data']['is_output_counted']
if 'contact_id' in new_values['data'].keys():
if 'contact_id' in new_values['data'].keys() and new_values['data']['contact_id'] is not None:
if new_values['data']['contact_id'] <= 0:
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_CONTACT_ID')
@ -608,7 +608,7 @@ class SpaceItem:
if cursor.fetchone() is not None:
cursor.close()
cnx.disconnect()
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.SPACE_NAME_IS_ALREADY_IN_USE')
if parent_space_id is not None: