a little cleaning

This commit is contained in:
nek0 2016-08-24 20:01:11 +02:00
parent 685dead482
commit 050ff88b61
3 changed files with 7 additions and 9 deletions

View file

@ -19,7 +19,6 @@ module Handler.AlbumSettings where
import Import import Import
import Handler.Commons import Handler.Commons
import qualified Data.Text as T import qualified Data.Text as T
import Data.Maybe
import System.Directory import System.Directory
import System.FilePath import System.FilePath
import qualified Data.List as L import qualified Data.List as L

View file

@ -24,7 +24,6 @@ import Network.HTTP.Client
import Network.HTTP.Types.Status as S import Network.HTTP.Types.Status as S
import qualified Data.ByteString.Char8 as C import qualified Data.ByteString.Char8 as C
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
import qualified Data.Text as T
loginIsAdmin :: IsString t => Handler (Either (t, Route App) ()) loginIsAdmin :: IsString t => Handler (Either (t, Route App) ())
@ -97,7 +96,7 @@ putIndexES input = do
ESUser uId user -> do ESUser uId user -> do
ex <- runBH' $ indexExists (IndexName "user") ex <- runBH' $ indexExists (IndexName "user")
unless ex ((\ _ -> do unless ex ((\ _ -> do
runBH' $ createIndex is (IndexName "user") _ <- runBH' $ createIndex is (IndexName "user")
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "user") _ <- runBH' $ openIndex (IndexName "user")
@ -107,7 +106,7 @@ putIndexES input = do
ESAlbum aId album -> do ESAlbum aId album -> do
ex <- runBH' $ indexExists (IndexName "album") ex <- runBH' $ indexExists (IndexName "album")
unless ex ((\ _ -> do unless ex ((\ _ -> do
runBH' $ createIndex is (IndexName "album") _ <- runBH' $ createIndex is (IndexName "album")
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "album") _ <- runBH' $ openIndex (IndexName "album")
@ -117,7 +116,7 @@ putIndexES input = do
ESMedium mId medium -> do ESMedium mId medium -> do
ex <- runBH' $ indexExists (IndexName "medium") ex <- runBH' $ indexExists (IndexName "medium")
unless ex ((\ _ -> do unless ex ((\ _ -> do
runBH' $ createIndex is (IndexName "medium") _ <- runBH' $ createIndex is (IndexName "medium")
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "medium") _ <- runBH' $ openIndex (IndexName "medium")
@ -127,7 +126,7 @@ putIndexES input = do
ESComment cId comment -> do ESComment cId comment -> do
ex <- runBH' $ indexExists (IndexName "comment") ex <- runBH' $ indexExists (IndexName "comment")
unless ex ((\ _ -> do unless ex ((\ _ -> do
runBH' $ createIndex is (IndexName "comment") _ <- runBH' $ createIndex is (IndexName "comment")
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "comment") _ <- runBH' $ openIndex (IndexName "comment")
@ -173,7 +172,7 @@ checkResponseES resp =
200 -> return () 200 -> return ()
code -> error $ (show code) ++ ": " ++ (C.unpack $ BL.toStrict $ responseBody resp) code -> error $ (show code) ++ ": " ++ (C.unpack $ BL.toStrict $ responseBody resp)
-- runBH' :: BH m a -> Handler resp runBH' :: BH m a -> m b
runBH' action = do runBH' action = do
master <- getYesod master <- getYesod
let s = appSearchHost $ appSettings master let s = appSearchHost $ appSettings master

View file

@ -5,7 +5,7 @@
<li> <li>
<a href=@{HomeR}> <a href=@{HomeR}>
Home Home
$maybe su <- msu $maybe _ <- msu
<li> <li>
<label for="cb1"> <label for="cb1">
<a> <a>
@ -24,7 +24,7 @@
<li> <li>
<a href=@{LogoutR}> <a href=@{LogoutR}>
Logout Logout
$maybe admin <- madmin $maybe _ <- madmin
<li> <li>
<a href=@{AdminR} .red> <a href=@{AdminR} .red>
Administration Administration