Reset logo configs if logo is deleted.

This commit is contained in:
Norman Jäckel 2019-02-19 21:41:49 +01:00
parent c1a818a368
commit 4b6ce77d36
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@ Core:
- Added password reset link (password reset via email) [#3914, #4199].
- Added global history mode [#3977, #4141].
- Projector refactoring [4119, #4130].
- Fixed logo configuration if logo file is deleted [#4374].
Agenda:
- Added viewpoint to assign multiple items to a new parent item [#4037].

View File

@ -1,6 +1,7 @@
from django.http import HttpResponseForbidden, HttpResponseNotFound
from django.views.static import serve
from ..core.config import config
from ..utils.auth import has_perm
from ..utils.rest_api import ModelViewSet, ValidationError
from .access_permissions import MediafileAccessPermissions
@ -76,6 +77,12 @@ class MediafileViewSet(ModelViewSet):
# on server via Django methods (file, open(), save(), ...).
mediafile = self.get_object()
mediafile.mediafile.storage.delete(mediafile.mediafile.name)
for logo in config["logos_available"]:
if config[logo]["path"] == mediafile.mediafile.url:
config[logo] = {
"display_name": config[logo]["display_name"],
"path": "",
}
return super().destroy(request, *args, **kwargs)