handle is_anonymous
This commit is contained in:
parent
92af354a88
commit
cf55550453
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user