handle is_anonymous

This commit is contained in:
Filip Gralinski 2016-02-14 08:59:12 +01:00
parent 92af354a88
commit cf55550453
4 changed files with 11 additions and 7 deletions

View File

@ -175,7 +175,7 @@ instance YesodAuth App where
, userName = Nothing
, userIsAdmin = False
, userLocalId = Nothing
, userIsAnonymous = Just False
, userIsAnonymous = False
}
-- You can add other plugins like BrowserID, email or OAuth here

View File

@ -124,7 +124,7 @@ getSubmission repoId commit challengeId description chan = do
submissionDescription=description,
submissionStamp=time,
submissionSubmitter=userId,
submissionIsPublic=Just False }
submissionIsPublic=False }
getOuts :: Channel -> Key Submission -> Handler ([Out])
getOuts chan submissionId = do

View File

@ -107,9 +107,13 @@ getEvaluationMap s@(Entity submissionId submission) = do
formatSubmitter :: User -> Text
formatSubmitter user = case userName user of
Just name -> name
Nothing -> "[name not given]"
formatSubmitter user = if userIsAnonymous user
then
"[anonymised]"
else
case userName user of
Just name -> name
Nothing -> "[name not given]"
submissionScore :: Key Test -> (Entity Submission, Entity User, Map (Key Test) Evaluation) -> String
submissionScore k (_, _, m) = fromMaybe "N/A" (presentScore <$> lookup k m)

View File

@ -5,7 +5,7 @@ User
name Text Maybe
isAdmin Bool default=False
localId Text Maybe
isAnonymous Bool Maybe
isAnonymous Bool default=False
deriving Typeable
PublicKey
user UserId
@ -47,7 +47,7 @@ Submission
description Text
stamp UTCTime default=now()
submitter UserId
isPublic Bool Maybe
isPublic Bool default=False
UniqueSubmissionRepoCommitChallenge repo commit challenge
Fork
source SubmissionId