forked from filipg/gonito
add auto-opening mode
This commit is contained in:
parent
3c157290b9
commit
c54af512c7
@ -18,6 +18,7 @@ import Handler.Shared
|
|||||||
import Handler.Runner
|
import Handler.Runner
|
||||||
import Handler.Tables
|
import Handler.Tables
|
||||||
import Handler.TagUtils
|
import Handler.TagUtils
|
||||||
|
import Handler.MakePublic
|
||||||
|
|
||||||
import GEval.Core
|
import GEval.Core
|
||||||
import GEval.OptionsParser
|
import GEval.OptionsParser
|
||||||
@ -203,7 +204,14 @@ doCreateSubmission userId challengeId mDescription mTags repoSpec chan = do
|
|||||||
_ <- getOuts chan submissionId
|
_ <- getOuts chan submissionId
|
||||||
|
|
||||||
runDB $ addTags submissionId (if isNothing mTags then mCommitTags else mTags) []
|
runDB $ addTags submissionId (if isNothing mTags then mCommitTags else mTags) []
|
||||||
msg chan "Done"
|
msg chan "SUBMISSION CREATED"
|
||||||
|
|
||||||
|
app <- getYesod
|
||||||
|
if appAutoOpening $ appSettings app
|
||||||
|
then
|
||||||
|
doMakePublic submissionId chan
|
||||||
|
else
|
||||||
|
return ()
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
|
|
||||||
getSubmission :: UserId -> Key Repo -> SHA1 -> Key Challenge -> Text -> Channel -> Handler (Key Submission)
|
getSubmission :: UserId -> Key Repo -> SHA1 -> Key Challenge -> Text -> Channel -> Handler (Key Submission)
|
||||||
|
@ -79,6 +79,7 @@ data AppSettings = AppSettings
|
|||||||
, appRepoHost :: Text
|
, appRepoHost :: Text
|
||||||
, appRepoScheme :: RepoScheme
|
, appRepoScheme :: RepoScheme
|
||||||
, appTagPermissions :: TagPermissions
|
, appTagPermissions :: TagPermissions
|
||||||
|
, appAutoOpening :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
instance FromJSON AppSettings where
|
instance FromJSON AppSettings where
|
||||||
@ -119,6 +120,8 @@ instance FromJSON AppSettings where
|
|||||||
tagPermissions <- o .: "tag-permissions"
|
tagPermissions <- o .: "tag-permissions"
|
||||||
appTagPermissions <- return $ toTagPermissions tagPermissions
|
appTagPermissions <- return $ toTagPermissions tagPermissions
|
||||||
|
|
||||||
|
appAutoOpening <- o .:? "auto-opening" .!= False
|
||||||
|
|
||||||
return AppSettings {..}
|
return AppSettings {..}
|
||||||
|
|
||||||
-- | Settings for 'widgetFile', such as which template languages to support and
|
-- | Settings for 'widgetFile', such as which template languages to support and
|
||||||
|
@ -11,6 +11,7 @@ contact-email: "_env:CONTACT_EMAIL:filipg@amu.edu.pl"
|
|||||||
repo-host: "_env:REPO_HOST:ssh://gitolite@gonito.net/"
|
repo-host: "_env:REPO_HOST:ssh://gitolite@gonito.net/"
|
||||||
repo-scheme: "_env:REPO_SCHEME:selfhosted"
|
repo-scheme: "_env:REPO_SCHEME:selfhosted"
|
||||||
tag-permissions: "_env:TAG_PERMISSIONS:only-admin-can-add-new-tags"
|
tag-permissions: "_env:TAG_PERMISSIONS:only-admin-can-add-new-tags"
|
||||||
|
auto-opening: "_env:AUTO_OPENING:false"
|
||||||
|
|
||||||
# Optional values with the following production defaults.
|
# Optional values with the following production defaults.
|
||||||
# In development, they default to the inverse.
|
# In development, they default to the inverse.
|
||||||
|
Loading…
Reference in New Issue
Block a user