Commit e204b8e1 authored by Michal Čihař's avatar Michal Čihař

Do not store change object for not yet saved subproject

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent f6444bef
......@@ -828,11 +828,12 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
'%s remote into repo',
self.merge_style,
)
Change.objects.create(
subproject=self,
user=request.user if request else None,
action=action,
)
if self.id:
Change.objects.create(
subproject=self,
user=request.user if request else None,
action=action,
)
return True
except RepositoryException as error:
# In case merge has failer recover
......@@ -849,12 +850,13 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
# Reset repo back
method(abort=True)
Change.objects.create(
subproject=self,
user=request.user if request else None,
action=action_failed,
target=str(error),
)
if self.id:
Change.objects.create(
subproject=self,
user=request.user if request else None,
action=action_failed,
target=str(error),
)
# Notify subscribers and admins
self.notify_merge_failure(error, status)
......
Markdown is supported
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