Documentation
¶
Index ¶
- Constants
- func AdminNewsDeleteConfirmPage(w http.ResponseWriter, r *http.Request)
- func AdminNewsPage(w http.ResponseWriter, r *http.Request)
- func AdminNewsPostPage(w http.ResponseWriter, r *http.Request)
- func CanEditNewsPost(cd *common.CoreData, postID int32) bool
- func CanPostNews(cd *common.CoreData) bool
- func CustomNewsIndex(data *common.CoreData, r *http.Request)
- func EnforceNewsPostAccess(next http.Handler) http.Handler
- func MatchCanPostNews(r *http.Request, rm *mux.RouteMatch) bool
- func NewNewsPostTask() tasks.Task
- func NewNewsTask() tasks.Task
- func NewsCreatePageHandler(w http.ResponseWriter, r *http.Request)
- func NewsCustomIndexItems(cd *common.CoreData, r *http.Request, ...) []common.IndexItem
- func NewsGeneralIndexItems(cd *common.CoreData, r *http.Request) []common.IndexItem
- func NewsPageHandler(w http.ResponseWriter, r *http.Request)
- func NewsPageSpecificItems(cd *common.CoreData, r *http.Request, ...) []common.IndexItem
- func NewsPostPageHandler(w http.ResponseWriter, r *http.Request)
- func NewsRssPage(w http.ResponseWriter, r *http.Request)
- func PreviewPage(w http.ResponseWriter, r *http.Request)
- func Register(reg *router.Registry)
- func RegisterAdminRoutes(ar *mux.Router)
- func RegisterRoutes(r *mux.Router, _ *config.RuntimeConfig) []navpkg.RouterOptions
- func RegisterTasks() []tasks.NamedTask
- func SearchResultNewsActionPage(w http.ResponseWriter, r *http.Request)
- func SharedPreviewPage(w http.ResponseWriter, r *http.Request)
- type AnnouncementAddTask
- func (AnnouncementAddTask) Action(w http.ResponseWriter, r *http.Request) any
- func (AnnouncementAddTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (AnnouncementAddTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (AnnouncementAddTask) RequiredTemplates() []tasks.Template
- type AnnouncementDeleteTask
- func (AnnouncementDeleteTask) Action(w http.ResponseWriter, r *http.Request) any
- func (AnnouncementDeleteTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (AnnouncementDeleteTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (AnnouncementDeleteTask) RequiredTemplates() []tasks.Template
- type CancelTask
- func (CancelTask) Action(w http.ResponseWriter, r *http.Request) any
- func (CancelTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (CancelTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (CancelTask) RequiredTemplates() []tasks.Template
- type DeleteNewsPostTask
- type EditReplyTask
- func (EditReplyTask) Action(w http.ResponseWriter, r *http.Request) any
- func (EditReplyTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (EditReplyTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (EditReplyTask) RequiredTemplates() []tasks.Template
- type EditTask
- func (EditTask) Action(w http.ResponseWriter, r *http.Request) any
- func (EditTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (EditTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (EditTask) Page(w http.ResponseWriter, r *http.Request)
- func (EditTask) RequiredTemplates() []tasks.Template
- type MarkReadTask
- type NewPostTask
- func (NewPostTask) Action(w http.ResponseWriter, r *http.Request) any
- func (NewPostTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (NewPostTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (NewPostTask) AutoSubscribeGrants(evt eventbus.TaskEvent) ([]notif.GrantRequirement, error)
- func (NewPostTask) AutoSubscribePath(evt eventbus.TaskEvent) (string, string, error)
- func (NewPostTask) RequiredTemplates() []tasks.Template
- func (NewPostTask) SubscribedEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (NewPostTask) SubscribedInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- type ReplyTask
- func (ReplyTask) Action(w http.ResponseWriter, r *http.Request) any
- func (ReplyTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (ReplyTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (ReplyTask) AutoSubscribeGrants(evt eventbus.TaskEvent) ([]notif.GrantRequirement, error)
- func (ReplyTask) AutoSubscribePath(evt eventbus.TaskEvent) (string, string, error)
- func (ReplyTask) IndexData(data map[string]any) []searchworker.IndexEventData
- func (ReplyTask) IndexType() string
- func (ReplyTask) RequiredTemplates() []tasks.Template
- func (ReplyTask) SubscribedEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (ReplyTask) SubscribedInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- type SetLabelsTask
- type UserAllowTask
- func (UserAllowTask) Action(w http.ResponseWriter, r *http.Request) any
- func (UserAllowTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (UserAllowTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (UserAllowTask) RequiredTemplates() []tasks.Template
- type UserDisallowTask
- func (UserDisallowTask) Action(w http.ResponseWriter, r *http.Request) any
- func (UserDisallowTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (UserDisallowTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (UserDisallowTask) RequiredTemplates() []tasks.Template
Constants ¶
const ( // NewsTopicName is the default name for the hidden news forum. NewsTopicName = "A NEWS TOPIC" // NewsTopicDescription describes the hidden news forum. NewsTopicDescription = "THIS IS A HIDDEN FORUM FOR A NEWS TOPIC" // SectionWeight controls the order of news in navigation menus. SectionWeight = 10 )
const ( EmailTemplateAdminNotificationNewsAdd notif.EmailTemplateName = "adminNotificationNewsAddEmail" EmailTemplateNewsAdd notif.EmailTemplateName = "newsAddEmail" NotificationTemplateNewsAdd notif.NotificationTemplateName = "news_add" EmailTemplateAdminNotificationNewsReply notif.EmailTemplateName = "adminNotificationNewsReplyEmail" EmailTemplateNewsReply notif.EmailTemplateName = "replyEmail" NotificationTemplateNewsReply notif.NotificationTemplateName = "reply" EmailTemplateAdminNotificationNewsEdit notif.EmailTemplateName = "adminNotificationNewsEditEmail" EmailTemplateNewsEdit notif.EmailTemplateName = "newsEditEmail" NotificationTemplateNewsEdit notif.NotificationTemplateName = "news_edit" EmailTemplateAdminNotificationNewsUserAllow notif.EmailTemplateName = "adminNotificationNewsUserAllowEmail" EmailTemplateAdminNotificationNewsUserDisallow notif.EmailTemplateName = "adminNotificationNewsUserDisallowEmail" EmailTemplateAdminNotificationNewsDelete notif.EmailTemplateName = "adminNotificationNewsDeleteEmail" EmailTemplateAdminNotificationNewsCommentEdit notif.EmailTemplateName = "adminNotificationNewsCommentEditEmail" EmailTemplateAdminNotificationNewsCommentCancel notif.EmailTemplateName = "adminNotificationNewsCommentCancelEmail" )
const ( // TaskAdd represents adding an announcement. TaskAdd tasks.TaskString = "Add" // TaskDelete removes an item such as an announcement. TaskDelete = "Delete" // TaskEdit modifies an existing news post. TaskEdit = "Edit" // TaskNewPost creates a new news post. TaskNewPost tasks.TaskString = "New Post" // TaskReply posts a reply to a news thread. TaskReply tasks.TaskString = "Reply" // TaskEditReply edits a comment or reply. TaskEditReply tasks.TaskString = "Edit Reply" // TaskCancel cancels the current operation and returns to the previous page. TaskCancel tasks.TaskString = "Cancel" // TaskUserAllow grants a role to a user. TaskUserAllow = "User Allow" // TaskUserDisallow removes a role from a user. TaskUserDisallow = "User Disallow" // TaskMarkRead marks a news item as read for the current user. TaskMarkRead tasks.TaskString = forumhandlers.TaskMarkThreadRead )
Task constants used within the news handlers.
const AdminNewsDeleteConfirmPageTmpl tasks.Template = "domains/news/adminNewsDeleteConfirmPage.gohtml"
const AdminNewsEditPageTmpl tasks.Template = "domains/news/adminNewsEditPage.gohtml"
const AdminNewsListPageTmpl tasks.Template = "domains/news/adminNewsListPage.gohtml"
const AdminNewsPostPageTmpl tasks.Template = "domains/news/adminNewsPostPage.gohtml"
const (
NewsCreatePageTmpl tasks.Template = "domains/news/createPage.gohtml"
)
const NewsEditPageTmpl tasks.Template = "domains/news/newsEditPage.gohtml"
const (
NewsPageTmpl tasks.Template = "domains/news/page.gohtml"
)
const (
NewsPostPageTmpl tasks.Template = "domains/news/postPage.gohtml"
)
const NewsPreviewPageTmpl tasks.Template = "domains/news/preview.gohtml"
const SearchResultNewsActionPageTmpl tasks.Template = "domains/search/resultNewsActionPage.gohtml"
Variables ¶
This section is empty.
Functions ¶
func AdminNewsDeleteConfirmPage ¶
func AdminNewsDeleteConfirmPage(w http.ResponseWriter, r *http.Request)
func AdminNewsPage ¶
func AdminNewsPage(w http.ResponseWriter, r *http.Request)
func AdminNewsPostPage ¶
func AdminNewsPostPage(w http.ResponseWriter, r *http.Request)
func CanEditNewsPost ¶ added in v0.0.214
CanEditNewsPost reports whether cd can modify the specified news post.
func CanPostNews ¶
CanPostNews reports whether the current user can create news posts.
func EnforceNewsPostAccess ¶
EnforceNewsPostAccess ensures the user has permission to edit the news post specified in the URL path. It sets the current news post ID context on success.
func MatchCanPostNews ¶
func MatchCanPostNews(r *http.Request, rm *mux.RouteMatch) bool
MatchCanPostNews matches requests where the user has permission to post news.
func NewNewsPostTask ¶
func NewNewsTask ¶
func NewsCreatePageHandler ¶
func NewsCreatePageHandler(w http.ResponseWriter, r *http.Request)
func NewsCustomIndexItems ¶
func NewsCustomIndexItems(cd *common.CoreData, r *http.Request, post *db.GetNewsPostsWithWriterUsernameAndThreadCommentCountDescendingRow) []common.IndexItem
Deprecated/Wrapper
func NewsGeneralIndexItems ¶
func NewsPageHandler ¶
func NewsPageHandler(w http.ResponseWriter, r *http.Request)
func NewsPageSpecificItems ¶
func NewsPostPageHandler ¶
func NewsPostPageHandler(w http.ResponseWriter, r *http.Request)
func NewsRssPage ¶
func NewsRssPage(w http.ResponseWriter, r *http.Request)
func PreviewPage ¶
func PreviewPage(w http.ResponseWriter, r *http.Request)
func RegisterAdminRoutes ¶
RegisterAdminRoutes attaches news admin endpoints to ar.
func RegisterRoutes ¶
func RegisterRoutes(r *mux.Router, _ *config.RuntimeConfig) []navpkg.RouterOptions
RegisterRoutes attaches the public news endpoints to r.
func RegisterTasks ¶
RegisterTasks registers news related tasks with the global registry.
func SearchResultNewsActionPage ¶
func SearchResultNewsActionPage(w http.ResponseWriter, r *http.Request)
func SharedPreviewPage ¶
func SharedPreviewPage(w http.ResponseWriter, r *http.Request)
SharedPreviewPage renders an OpenGraph preview for a news post.
Types ¶
type AnnouncementAddTask ¶
type AnnouncementAddTask struct{ tasks.TaskString }
AnnouncementAddTask enables an announcement for a news post.
func (AnnouncementAddTask) Action ¶
func (AnnouncementAddTask) Action(w http.ResponseWriter, r *http.Request) any
func (AnnouncementAddTask) AdminEmailTemplate ¶
func (AnnouncementAddTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (AnnouncementAddTask) AdminInternalNotificationTemplate ¶
func (AnnouncementAddTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (AnnouncementAddTask) RequiredTemplates ¶
func (AnnouncementAddTask) RequiredTemplates() []tasks.Template
type AnnouncementDeleteTask ¶
type AnnouncementDeleteTask struct{ tasks.TaskString }
AnnouncementDeleteTask disables the announcement for a news post.
func (AnnouncementDeleteTask) Action ¶
func (AnnouncementDeleteTask) Action(w http.ResponseWriter, r *http.Request) any
func (AnnouncementDeleteTask) AdminEmailTemplate ¶
func (AnnouncementDeleteTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (AnnouncementDeleteTask) AdminInternalNotificationTemplate ¶
func (AnnouncementDeleteTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (AnnouncementDeleteTask) RequiredTemplates ¶
func (AnnouncementDeleteTask) RequiredTemplates() []tasks.Template
type CancelTask ¶
type CancelTask struct{ tasks.TaskString }
CancelTask cancels comment editing.
func (CancelTask) Action ¶
func (CancelTask) Action(w http.ResponseWriter, r *http.Request) any
func (CancelTask) AdminEmailTemplate ¶
func (CancelTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (CancelTask) AdminInternalNotificationTemplate ¶
func (CancelTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (CancelTask) RequiredTemplates ¶
func (CancelTask) RequiredTemplates() []tasks.Template
type DeleteNewsPostTask ¶
type DeleteNewsPostTask struct{ tasks.TaskString }
DeleteNewsPostTask removes a news post.
func (DeleteNewsPostTask) Action ¶
func (DeleteNewsPostTask) Action(w http.ResponseWriter, r *http.Request) any
type EditReplyTask ¶
type EditReplyTask struct{ tasks.TaskString }
EditReplyTask updates an existing comment.
func (EditReplyTask) Action ¶
func (EditReplyTask) Action(w http.ResponseWriter, r *http.Request) any
func (EditReplyTask) AdminEmailTemplate ¶
func (EditReplyTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (EditReplyTask) AdminInternalNotificationTemplate ¶
func (EditReplyTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (EditReplyTask) RequiredTemplates ¶
func (EditReplyTask) RequiredTemplates() []tasks.Template
type EditTask ¶
type EditTask struct{ tasks.TaskString }
func (EditTask) AdminEmailTemplate ¶
func (EditTask) AdminInternalNotificationTemplate ¶
func (EditTask) RequiredTemplates ¶
RequiredTemplates declares the templates used by this task's pages.
type MarkReadTask ¶
type MarkReadTask struct{ tasks.TaskString }
MarkReadTask clears the new and unread labels on a news post.
func (MarkReadTask) Action ¶
func (MarkReadTask) Action(w http.ResponseWriter, r *http.Request) any
Action handles clearing new and unread labels on a news post.
func (*MarkReadTask) Matcher ¶
func (t *MarkReadTask) Matcher() mux.MatcherFunc
type NewPostTask ¶
type NewPostTask struct{ tasks.TaskString }
func (NewPostTask) Action ¶
func (NewPostTask) Action(w http.ResponseWriter, r *http.Request) any
func (NewPostTask) AdminEmailTemplate ¶
func (NewPostTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (NewPostTask) AdminInternalNotificationTemplate ¶
func (NewPostTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (NewPostTask) AutoSubscribeGrants ¶
func (NewPostTask) AutoSubscribeGrants(evt eventbus.TaskEvent) ([]notif.GrantRequirement, error)
func (NewPostTask) AutoSubscribePath ¶
AutoSubscribePath links the newly created post so that any future replies notify the author by default. Subscribing the poster ensures they are notified when readers engage with their new thread. AutoSubscribePath keeps authors in the loop on new post discussions. AutoSubscribePath implements notif.AutoSubscribeProvider. Subscriptions use the thread path derived from postcountworker data when possible.
func (NewPostTask) RequiredTemplates ¶
func (NewPostTask) RequiredTemplates() []tasks.Template
func (NewPostTask) SubscribedEmailTemplate ¶
func (NewPostTask) SubscribedEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (NewPostTask) SubscribedInternalNotificationTemplate ¶
func (NewPostTask) SubscribedInternalNotificationTemplate(evt eventbus.TaskEvent) *string
type ReplyTask ¶
type ReplyTask struct{ tasks.TaskString }
func (ReplyTask) AdminEmailTemplate ¶
func (ReplyTask) AdminInternalNotificationTemplate ¶
func (ReplyTask) AutoSubscribeGrants ¶
func (ReplyTask) AutoSubscribePath ¶
AutoSubscribePath registers this reply so the author automatically follows subsequent comments on the news post. When users reply to a news post we automatically subscribe them so they receive updates to the thread they just engaged with. AutoSubscribePath allows commenters to automatically watch for further replies. AutoSubscribePath implements notif.AutoSubscribeProvider. A subscription to the underlying discussion thread is created using event data when available.
func (ReplyTask) IndexData ¶
func (ReplyTask) IndexData(data map[string]any) []searchworker.IndexEventData
func (ReplyTask) RequiredTemplates ¶
func (ReplyTask) SubscribedEmailTemplate ¶
type SetLabelsTask ¶
type SetLabelsTask struct{ tasks.TaskString }
SetLabelsTask replaces private labels on a news item.
func (SetLabelsTask) Action ¶
func (SetLabelsTask) Action(w http.ResponseWriter, r *http.Request) any
type UserAllowTask ¶
type UserAllowTask struct{ tasks.TaskString }
UserAllowTask grants a user a role.
func (UserAllowTask) Action ¶
func (UserAllowTask) Action(w http.ResponseWriter, r *http.Request) any
func (UserAllowTask) AdminEmailTemplate ¶
func (UserAllowTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (UserAllowTask) AdminInternalNotificationTemplate ¶
func (UserAllowTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (UserAllowTask) RequiredTemplates ¶
func (UserAllowTask) RequiredTemplates() []tasks.Template
type UserDisallowTask ¶
type UserDisallowTask struct{ tasks.TaskString }
UserDisallowTask removes a user's role.
func (UserDisallowTask) Action ¶
func (UserDisallowTask) Action(w http.ResponseWriter, r *http.Request) any
func (UserDisallowTask) AdminEmailTemplate ¶
func (UserDisallowTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (UserDisallowTask) AdminInternalNotificationTemplate ¶
func (UserDisallowTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (UserDisallowTask) RequiredTemplates ¶
func (UserDisallowTask) RequiredTemplates() []tasks.Template
Source Files
¶
- admin_pages.go
- announcement_add_task.go
- announcement_delete_task.go
- cancel_edit_task.go
- consts.go
- customindex.go
- edit_reply_task.go
- helpers.go
- label_tasks.go
- matchers_post.go
- middleware.go
- newsAnnouncementTasks.go
- newsCommentEditTasks.go
- newsCreatePage.go
- newsDeleteTask.go
- newsEditPostTask.go
- newsNewPostTask.go
- newsPage.go
- newsPostPage.go
- newsPostTask.go
- newsPreview.go
- newsReplyTask.go
- newsRssPage.go
- newsTask.go
- notification_templates.go
- routes.go
- routes_admin.go
- searchResultNewsActionPage.go
- shared_preview.go
- tasks.go
- tasks_register.go
- user_allow_task.go
- user_disallow_task.go