handle avatar delete error while avatar is in use

This commit is contained in:
nek0 2015-04-18 00:04:13 +02:00
parent 19b115ad94
commit f8e5d0e8a2
4 changed files with 12 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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