yesod-comments-0.8.1: A generic comments interface for a Yesod application

Portabilityunportable
Stabilityunstable
Maintainerpbrisbin@gmail.com
Safe HaskellNone

Yesod.Comments.Core

Description

 

Synopsis

Documentation

class YesodAuth m => YesodComments m whereSource

Methods

commentStorage :: CommentStorage s mSource

How to store and load comments from persistent storage.

userDetails :: AuthId m -> GHandler s m (Maybe UserDetails)Source

If Nothing is returned, the user cannot add a comment. This can be used to blacklist users. Note that comments left by them will still appear until manually deleted.

threadRoute :: ThreadId -> Route mSource

A thread's route. Currently, only used for linking back from the admin subsite.

editRoute :: Maybe (ThreadId -> CommentId -> Route m)Source

A route to the admin subsite's EditCommentR action. If Nothing, the Edit link will not be shown.

deleteRoute :: Maybe (ThreadId -> CommentId -> Route m)Source

A route to the admin subsite's DeleteCommentR action. If Nothing, the Delete link will not be shown.

data Comment Source

The core data type, a Comment

Constructors

Comment 

Fields

commentId :: CommentId
 
cThreadId :: ThreadId
 
cTimeStamp :: UTCTime
 
cIpAddress :: Text
 
cUserName :: Text
 
cUserEmail :: Text
 
cContent :: Markdown
 
cIsAuth :: Bool

compatability field, always true

Instances

data UserDetails Source

Information about the User needed to store comments.

Constructors

UserDetails 

Fields

textUserId :: Text

Text version of a user id, toPathPiece userId is recommended. Comments are stored using this value so users can freely change names without losing comments.

friendlyName :: Text

The name that's actually displayed

emailAddress :: Text

Not shown but stored

Instances

data CommentStorage s m Source

How to save and restore comments from persistent storage. All necessary actions are accomplished through these 5 functions. Currently, only persistStorage is available.

Constructors

CommentStorage 

Fields

csGet :: ThreadId -> CommentId -> GHandler s m (Maybe Comment)
 
csStore :: Comment -> GHandler s m ()
 
csUpdate :: Comment -> Comment -> GHandler s m ()
 
csDelete :: Comment -> GHandler s m ()
 
csLoad :: Maybe ThreadId -> GHandler s m [Comment]

Pass Nothing to get all comments site-wide.