diff --git a/Handler/ShowChallenge.hs b/Handler/ShowChallenge.hs index b9c6d9d..9a59ba9 100644 --- a/Handler/ShowChallenge.hs +++ b/Handler/ShowChallenge.hs @@ -18,6 +18,7 @@ import Handler.Shared import Handler.Runner import Handler.Tables import Handler.TagUtils +import Handler.MakePublic import GEval.Core import GEval.OptionsParser @@ -203,7 +204,14 @@ doCreateSubmission userId challengeId mDescription mTags repoSpec chan = do _ <- getOuts chan submissionId 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 () getSubmission :: UserId -> Key Repo -> SHA1 -> Key Challenge -> Text -> Channel -> Handler (Key Submission) diff --git a/Settings.hs b/Settings.hs index b00f7bd..53a90df 100644 --- a/Settings.hs +++ b/Settings.hs @@ -79,6 +79,7 @@ data AppSettings = AppSettings , appRepoHost :: Text , appRepoScheme :: RepoScheme , appTagPermissions :: TagPermissions + , appAutoOpening :: Bool } instance FromJSON AppSettings where @@ -119,6 +120,8 @@ instance FromJSON AppSettings where tagPermissions <- o .: "tag-permissions" appTagPermissions <- return $ toTagPermissions tagPermissions + appAutoOpening <- o .:? "auto-opening" .!= False + return AppSettings {..} -- | Settings for 'widgetFile', such as which template languages to support and diff --git a/config/settings.yml b/config/settings.yml index 5b771ed..ba1ed44 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -11,6 +11,7 @@ contact-email: "_env:CONTACT_EMAIL:filipg@amu.edu.pl" repo-host: "_env:REPO_HOST:ssh://gitolite@gonito.net/" repo-scheme: "_env:REPO_SCHEME:selfhosted" tag-permissions: "_env:TAG_PERMISSIONS:only-admin-can-add-new-tags" +auto-opening: "_env:AUTO_OPENING:false" # Optional values with the following production defaults. # In development, they default to the inverse.