Gitlab Community Edition Instance

Commit 2e24f972 authored by Marcel Hellkamp's avatar Marcel Hellkamp
Browse files

Fix: FormUpdate methods silently adding to existing fields

parent 0a2ae0fd
......@@ -392,6 +392,9 @@ class FormUpdate:
self.fields = []
self._mp = None
def _rm(self, key):
self.fields[:] = [f for f in self.fields if f[0] != key]
@property
def body(self):
if not self._mp:
......@@ -431,6 +434,7 @@ class FormUpdate:
# TODO: Check for valid subject and permission names
sub = "acl:{}".format(subject)
self._rm(sub)
self.fields.append((sub, ','.join(permissions)))
return self
......@@ -448,10 +452,13 @@ class FormUpdate:
if file:
attr += ":/" + file.lstrip("/")
self._rm(attr)
if values:
for val in values:
self.fields.append((attr, val))
else:
self._rm(attr)
self.fields.append((attr, ""))
return self
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment