<commit_before>module Handler.HonorPledge where

import Import

import Model.User (establishUser, isCurUserEligibleEstablish)

getHonorPledgeR :: Handler Html
getHonorPledgeR = do
    is_elig <- isCurUserEligibleEstablish
    defaultLayout $ do
        setTitle "Honor Pledge | Snowdrift.coop"
        $(widgetFile "honor-pledge")

postHonorPledgeR :: Handler Html
postHonorPledgeR = do
    Entity user_id user <- requireAuth
    case userEstablished user of
        EstEligible elig_time reason -> do
            runDB $ establishUser user_id elig_time reason
            setMessage "Congratulations, you are now a fully established user!"
            redirect HonorPledgeR
        _ -> error "You're not eligible for establishment."<commit_msg>redirect to home after accepting honor pledge<commit_after>module Handler.HonorPledge where

import Import

import Model.User (establishUser, isCurUserEligibleEstablish)

getHonorPledgeR :: Handler Html
getHonorPledgeR = do
    is_elig <- isCurUserEligibleEstablish
    defaultLayout $ do
        setTitle "Honor Pledge | Snowdrift.coop"
        $(widgetFile "honor-pledge")

postHonorPledgeR :: Handler Html
postHonorPledgeR = do
    Entity user_id user <- requireAuth
    case userEstablished user of
        EstEligible elig_time reason -> do
            runDB $ establishUser user_id elig_time reason
            setMessage "Congratulations, you are now a fully established user!"
            redirect HomeR
        _ -> error "You're not eligible for establishment."
{'fraction_non_alphanumeric': 0.055372445616348055, 'fraction_numerical': 0.0, 'mean_word_length': 3.349570200573066, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6574530', 'n_tokens_mistral': 464, 'n_tokens_neox': 430, 'n_words': 131}