This commit is contained in:
@@ -16,6 +16,24 @@ type Chapter struct {
|
||||
CommentsLocked bool `bson:"commentsLocked"`
|
||||
}
|
||||
|
||||
func (chapter *Chapter) ApplyUpdate(update ChapterUpdate) {
|
||||
if update.Title != nil {
|
||||
chapter.Title = *update.Title
|
||||
}
|
||||
if update.Source != nil {
|
||||
chapter.Source = *update.Source
|
||||
}
|
||||
if update.FictionalDate != nil {
|
||||
chapter.FictionalDate = update.FictionalDate.UTC()
|
||||
}
|
||||
if update.CommentMode != nil {
|
||||
chapter.CommentMode = *update.CommentMode
|
||||
}
|
||||
if update.CommentsLocked != nil {
|
||||
chapter.CommentsLocked = *update.CommentsLocked
|
||||
}
|
||||
}
|
||||
|
||||
// CanComment returns true if the chapter can be commented to.
|
||||
func (chapter *Chapter) CanComment() bool {
|
||||
return !chapter.CommentsLocked && chapter.CommentMode.IsEnabled()
|
||||
|
||||
Reference in New Issue
Block a user