mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-03 06:42:34 +00:00
UI - Dont allow empty tag names (#1641)
This commit is contained in:
@@ -1364,13 +1364,14 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
flash("{} watches set to use default notification settings".format(len(uuids)))
|
flash("{} watches set to use default notification settings".format(len(uuids)))
|
||||||
|
|
||||||
elif (op == 'assign-tag'):
|
elif (op == 'assign-tag'):
|
||||||
op_extradata = request.form.get('op_extradata')
|
op_extradata = request.form.get('op_extradata', '').strip()
|
||||||
tag_uuid = datastore.add_tag(name=op_extradata)
|
if op_extradata:
|
||||||
if op_extradata and tag_uuid:
|
tag_uuid = datastore.add_tag(name=op_extradata)
|
||||||
for uuid in uuids:
|
if op_extradata and tag_uuid:
|
||||||
uuid = uuid.strip()
|
for uuid in uuids:
|
||||||
if datastore.data['watching'].get(uuid):
|
uuid = uuid.strip()
|
||||||
datastore.data['watching'][uuid]['tags'].append(tag_uuid)
|
if datastore.data['watching'].get(uuid):
|
||||||
|
datastore.data['watching'][uuid]['tags'].append(tag_uuid)
|
||||||
|
|
||||||
flash("{} watches assigned tag".format(len(uuids)))
|
flash("{} watches assigned tag".format(len(uuids)))
|
||||||
|
|
||||||
|
|||||||
@@ -566,9 +566,12 @@ class ChangeDetectionStore:
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def add_tag(self, name):
|
def add_tag(self, name):
|
||||||
print (">>> Adding new tag -", name)
|
|
||||||
# If name exists, return that
|
# If name exists, return that
|
||||||
n = name.strip().lower()
|
n = name.strip().lower()
|
||||||
|
print (f">>> Adding new tag - '{n}")
|
||||||
|
if not n:
|
||||||
|
return False
|
||||||
|
|
||||||
for uuid, tag in self.__data['settings']['application'].get('tags', {}).items():
|
for uuid, tag in self.__data['settings']['application'].get('tags', {}).items():
|
||||||
if n == tag.get('title', '').lower().strip():
|
if n == tag.get('title', '').lower().strip():
|
||||||
print (f">>> Tag {name} already exists")
|
print (f">>> Tag {name} already exists")
|
||||||
|
|||||||
Reference in New Issue
Block a user