handle avatar delete error while avatar is in use
This commit is contained in:
parent
19b115ad94
commit
f8e5d0e8a2
4 changed files with 12 additions and 3 deletions
|
@ -118,9 +118,15 @@ getAvatarDeleteR aId = do
|
||||||
ma <- runDB $ get aId
|
ma <- runDB $ get aId
|
||||||
case ma of
|
case ma of
|
||||||
Just _ -> do
|
Just _ -> do
|
||||||
runDB $ delete aId
|
c <- runDB $ selectList [UserAvatar ==. Just aId] []
|
||||||
setMessageI MsgAvatarDeleted
|
case null c of
|
||||||
redirect $ HomeR
|
True -> do
|
||||||
|
runDB $ delete aId
|
||||||
|
setMessageI MsgAvatarDeleted
|
||||||
|
redirect $ HomeR
|
||||||
|
False -> do
|
||||||
|
setMessageI MsgAvatarInUseError
|
||||||
|
redirect $ AvatarR
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessageI MsgAvatarUnknown
|
setMessageI MsgAvatarUnknown
|
||||||
redirect $ AvatarR
|
redirect $ AvatarR
|
||||||
|
|
|
@ -96,3 +96,4 @@ NewAvatar: Nový avatar
|
||||||
AvatarUploadSuccessfull: Avatar úspěšně nahrán
|
AvatarUploadSuccessfull: Avatar úspěšně nahrán
|
||||||
DeleteAvatar: Smazat avatar
|
DeleteAvatar: Smazat avatar
|
||||||
AvatarDeleted: Avatar úspěšně smazán
|
AvatarDeleted: Avatar úspěšně smazán
|
||||||
|
AvatarInUseError: Avatar nelze smazat dokud je v užitku
|
||||||
|
|
|
@ -96,3 +96,4 @@ NewAvatar: Neuer Avatar
|
||||||
AvatarUploadSuccessfull: Avatar erfolgreich hochgeladen
|
AvatarUploadSuccessfull: Avatar erfolgreich hochgeladen
|
||||||
DeleteAvatar: Diesen Avatar löschen
|
DeleteAvatar: Diesen Avatar löschen
|
||||||
AvatarDeleted: Avatar gelöscht
|
AvatarDeleted: Avatar gelöscht
|
||||||
|
AvatarInUseError: Avatare können nicht gelöscht werden, solange sie in Benutzung sind.
|
||||||
|
|
|
@ -96,3 +96,4 @@ NewAvatar: New avatar
|
||||||
AvatarUploadSuccessfull: Avatar upload successfull
|
AvatarUploadSuccessfull: Avatar upload successfull
|
||||||
DeleteAvatar: Delete avatar
|
DeleteAvatar: Delete avatar
|
||||||
AvatarDeleted: Avatar successfully deleted
|
AvatarDeleted: Avatar successfully deleted
|
||||||
|
AvatarInUseError: You can not delete avatars that are currently in use
|
||||||
|
|
Loading…
Reference in a new issue