<commit_before>
module Widgets.Sidebar where

import Import

import Model.Role
import Model.Currency

import Data.Time.Calendar
import Data.Time.Clock

import Database.Persist.Query.Join (selectOneMany, SelectOneMany (..))
import Database.Persist.Query.Join.Sql (runJoin)

sidebar :: Widget
sidebar = do
    maybe_user <- lift maybeAuth
    maybe_route <- lift getCurrentRoute

    lift $ cacheSeconds 10

    let role = fromMaybe Uninvited (userRole . entityVal <$> maybe_user)
        log_in_or_out = do
            case maybe_user of
                Nothing ->
                    toWidget [hamlet|
                        <a href=@{AuthR LoginR}>Sign In
                    |]

                Just (Entity user_id user) -> do
                    let name = fromMaybe (userIdent user) $ userName user
                    toWidget [hamlet|
                        <a href=@{UserR user_id}>#{name}
                        <br>
                        <a href=@{AuthR LogoutR}>Sign Out
                    |]

        string :: String -> String<commit_msg>Preventing caching of anything with a sidebar.<commit_after>
module Widgets.Sidebar where

import Import

import Model.Role
import Model.Currency

import Data.Time.Calendar
import Data.Time.Clock

import Database.Persist.Query.Join (selectOneMany, SelectOneMany (..))
import Database.Persist.Query.Join.Sql (runJoin)

sidebar :: Widget
sidebar = do
    maybe_user <- lift maybeAuth
    maybe_route <- lift getCurrentRoute

    lift alreadyExpired

    let role = fromMaybe Uninvited (userRole . entityVal <$> maybe_user)
        log_in_or_out = do
            case maybe_user of
                Nothing ->
                    toWidget [hamlet|
                        <a href=@{AuthR LoginR}>Sign In
                    |]

                Just (Entity user_id user) -> do
                    let name = fromMaybe (userIdent user) $ userName user
                    toWidget [hamlet|
                        <a href=@{UserR user_id}>#{name}
                        <br>
                        <a href=@{AuthR LogoutR}>Sign Out
                    |]

        string :: String -> String
{'fraction_non_alphanumeric': 0.08115671641791045, 'fraction_numerical': 0.0009328358208955224, 'mean_word_length': 1.674563591022444, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '5241932', 'n_tokens_mistral': 592, 'n_tokens_neox': 561, 'n_words': 160}