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
|
||||
case ma of
|
||||
Just _ -> do
|
||||
c <- runDB $ selectList [UserAvatar ==. Just aId] []
|
||||
case null c of
|
||||
True -> do
|
||||
runDB $ delete aId
|
||||
setMessageI MsgAvatarDeleted
|
||||
redirect $ HomeR
|
||||
False -> do
|
||||
setMessageI MsgAvatarInUseError
|
||||
redirect $ AvatarR
|
||||
Nothing -> do
|
||||
setMessageI MsgAvatarUnknown
|
||||
redirect $ AvatarR
|
||||
|
|
|
@ -96,3 +96,4 @@ NewAvatar: Nový avatar
|
|||
AvatarUploadSuccessfull: Avatar úspěšně nahrán
|
||||
DeleteAvatar: Smazat avatar
|
||||
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
|
||||
DeleteAvatar: Diesen Avatar löschen
|
||||
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
|
||||
DeleteAvatar: Delete avatar
|
||||
AvatarDeleted: Avatar successfully deleted
|
||||
AvatarInUseError: You can not delete avatars that are currently in use
|
||||
|
|
Loading…
Reference in a new issue