Documentation
¶
Index ¶
- Constants
- Variables
- func AdminCategoriesPage(w http.ResponseWriter, r *http.Request)
- func AdminCategoryCreatePage(w http.ResponseWriter, r *http.Request)
- func AdminCategoryCreateSubmit(w http.ResponseWriter, r *http.Request)
- func AdminCategoryDeletePage(w http.ResponseWriter, r *http.Request)
- func AdminCategoryEditPage(w http.ResponseWriter, r *http.Request)
- func AdminCategoryEditSubmit(w http.ResponseWriter, r *http.Request)
- func AdminCategoryGrantsPage(w http.ResponseWriter, r *http.Request)
- func AdminCategoryPage(w http.ResponseWriter, r *http.Request)
- func AdminForumFlaggedPostsPage(w http.ResponseWriter, r *http.Request)
- func AdminForumModeratorLogsPage(w http.ResponseWriter, r *http.Request)
- func AdminForumPage(w http.ResponseWriter, r *http.Request)
- func AdminForumRemakeForumThreadPage(w http.ResponseWriter, r *http.Request)
- func AdminForumRemakeForumTopicPage(w http.ResponseWriter, r *http.Request)
- func AdminForumWordListPage(w http.ResponseWriter, r *http.Request)
- func AdminThreadDeleteConfirmPage(w http.ResponseWriter, r *http.Request)
- func AdminThreadDeletePage(w http.ResponseWriter, r *http.Request)
- func AdminThreadPage(w http.ResponseWriter, r *http.Request)
- func AdminThreadsPage(w http.ResponseWriter, r *http.Request)
- func AdminTopicCreatePage(w http.ResponseWriter, r *http.Request)
- func AdminTopicDeleteConfirmPage(w http.ResponseWriter, r *http.Request)
- func AdminTopicDeletePage(w http.ResponseWriter, r *http.Request)
- func AdminTopicEditFormPage(w http.ResponseWriter, r *http.Request)
- func AdminTopicEditPage(w http.ResponseWriter, r *http.Request)
- func AdminTopicGrantsPage(w http.ResponseWriter, r *http.Request)
- func AdminTopicPage(w http.ResponseWriter, r *http.Request)
- func AdminTopicsPage(w http.ResponseWriter, r *http.Request)
- func BasePathMiddleware(base string) mux.MiddlewareFunc
- func CreateTopicPageWithPostTask(w http.ResponseWriter, r *http.Request, postTask tasks.TaskString, ...)
- func CustomForumIndex(cd *common.CoreData, r *http.Request)
- func ForumCustomIndexItems(cd *common.CoreData, r *http.Request) []common.IndexItem
- func ManageTopicLabelsPage(w http.ResponseWriter, r *http.Request)
- func Page(w http.ResponseWriter, r *http.Request)
- func QuoteApi(w http.ResponseWriter, r *http.Request)
- func QuoteSelectionApi(w http.ResponseWriter, r *http.Request)
- func Register(reg *router.Registry)
- func RegisterAdminRoutes(ar *mux.Router)
- func RegisterRoutes(r *mux.Router, cfg *config.RuntimeConfig) []navpkg.RouterOptions
- func RegisterTasks() []tasks.NamedTask
- func RequireThreadAndTopic(next http.Handler) http.Handler
- func SharedThreadPreviewPage(w http.ResponseWriter, r *http.Request)
- func SharedTopicPreviewPage(w http.ResponseWriter, r *http.Request)
- func SubscribeTopicPage(w http.ResponseWriter, r *http.Request)
- func ThreadDelete(ctx context.Context, q db.Querier, threadID, topicID int32) error
- func ThreadNewCancelPage(w http.ResponseWriter, r *http.Request)
- func ThreadPage(w http.ResponseWriter, r *http.Request)
- func ThreadPageWithBasePath(w http.ResponseWriter, r *http.Request, basePath string)
- func TopicAtomPage(w http.ResponseWriter, r *http.Request)
- func TopicFeed(r *http.Request, title string, topicID int, ...) *feeds.Feed
- func TopicRssPage(w http.ResponseWriter, r *http.Request)
- func TopicThreadCommentEditActionCancelPage(w http.ResponseWriter, r *http.Request)
- func TopicThreadCommentEditActionPage(w http.ResponseWriter, r *http.Request)
- func TopicThreadReplyCancelPage(w http.ResponseWriter, r *http.Request)
- func TopicsPage(w http.ResponseWriter, r *http.Request)
- func TopicsPageWithBasePath(w http.ResponseWriter, r *http.Request, basePath string)
- func UnsubscribeTopicPage(w http.ResponseWriter, r *http.Request)
- func UserCanCreateThread(ctx context.Context, q db.Querier, section string, topicID, uid int32) (bool, error)
- func UserCanCreateTopic(ctx context.Context, q db.Querier, section string, categoryID, uid int32) (bool, error)
- func UserCanLabelTopic(ctx context.Context, q db.Querier, section string, topicID, uid int32) (bool, error)
- type AddAuthorLabelTask
- type AddPrivateLabelTask
- type AddPublicLabelTask
- type AddTopicPublicLabelTask
- type AdminTopicDisplay
- type CategoryChangeTask
- type CategoryCreateTask
- type CategoryGrantCreateTask
- type CategoryGrantDeleteTask
- type CategoryTree
- type CreateThreadTask
- func (CreateThreadTask) Action(w http.ResponseWriter, r *http.Request) any
- func (CreateThreadTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (CreateThreadTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- func (CreateThreadTask) AutoSubscribeGrants(evt eventbus.TaskEvent) ([]notif.GrantRequirement, error)
- func (CreateThreadTask) AutoSubscribePath(evt eventbus.TaskEvent) (string, string, error)
- func (CreateThreadTask) IndexData(data map[string]any) []searchworker.IndexEventData
- func (CreateThreadTask) IndexType() string
- func (CreateThreadTask) Page(w http.ResponseWriter, r *http.Request)
- func (CreateThreadTask) RequiredTemplates() []tasks.Template
- func (CreateThreadTask) SubscribedEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
- func (CreateThreadTask) SubscribedInternalNotificationTemplate(evt eventbus.TaskEvent) *string
- type CreateTopicPageForm
- type DeleteCategoryTask
- type ForumcategoryPlus
- type ForumtopicPlus
- type Handlers
- type MarkThreadReadTask
- type RemakeThreadStatsTask
- type RemakeTopicStatsTask
- type RemoveAuthorLabelTask
- type RemovePrivateLabelTask
- type RemovePublicLabelTask
- type RemoveTopicPublicLabelTask
- 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 SetTopicLabelsTask
- type ThreadDeleteTask
- type TopicChangeTask
- type TopicCreateTask
- type TopicDeleteTask
- type TopicGrantCreateTask
- type TopicGrantDeleteTask
- type TopicGrantGroup
- type TopicGrantUpdateTask
Constants ¶
const ( EmailTemplateForumReply notif.EmailTemplateName = "forumReplyEmail" NotificationTemplateForumReply notif.NotificationTemplateName = "reply" EmailTemplateAdminNotificationForumReply notif.EmailTemplateName = "adminNotificationForumReplyEmail" )
const ( EmailTemplateAdminNotificationForumCategoryCreate notif.EmailTemplateName = "adminNotificationForumCategoryCreateEmail" EmailTemplateAdminNotificationForumCategoryUpdate notif.EmailTemplateName = "adminNotificationForumCategoryUpdateEmail" EmailTemplateAdminNotificationForumCategoryDelete notif.EmailTemplateName = "adminNotificationForumCategoryDeleteEmail" EmailTemplateAdminNotificationForumTopicCreate notif.EmailTemplateName = "adminNotificationForumTopicCreateEmail" EmailTemplateAdminNotificationForumTopicChange notif.EmailTemplateName = "adminNotificationForumTopicChangeEmail" EmailTemplateAdminNotificationForumTopicDelete notif.EmailTemplateName = "adminNotificationForumTopicDeleteEmail" EmailTemplateAdminNotificationForumThreadCreate notif.EmailTemplateName = "adminNotificationForumThreadCreateEmail" EmailTemplateAdminNotificationForumThreadDelete notif.EmailTemplateName = "adminNotificationForumThreadDeleteEmail" EmailTemplateForumThreadCreate notif.EmailTemplateName = "forumThreadCreateEmail" NotificationTemplateForumThread notif.NotificationTemplateName = "thread" )
const ( // TaskCreateThread creates a new forum thread. TaskCreateThread tasks.TaskString = "Create Thread" // TaskReply posts a reply to a 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" // TaskGrantRole grants a role to a forum user. TaskGrantRole = "Grant role" // TaskUpdateRole updates an existing forum role grant. TaskUpdateRole = "Update role" // TaskRevokeRole revokes a role from a forum user. TaskRevokeRole = "Revoke role" // TaskSetTopicRestriction adds a topic restriction. TaskSetTopicRestriction = "Set topic restriction" // TaskUpdateTopicRestriction updates a topic restriction. TaskUpdateTopicRestriction = "Update topic restriction" // TaskDeleteTopicRestriction deletes a topic restriction. TaskDeleteTopicRestriction = "Delete topic restriction" // TaskCopyTopicRestriction copies topic restrictions between topics. TaskCopyTopicRestriction = "Copy topic restriction" // TaskRemakeStatisticInformationOnForumthread refreshes thread statistics. TaskRemakeStatisticInformationOnForumthread = "Remake statistic information on forumthread" // TaskRemakeStatisticInformationOnForumtopic refreshes topic statistics. TaskRemakeStatisticInformationOnForumtopic = "Remake statistic information on forumtopic" // TaskForumCategoryChange updates a forum category name. TaskForumCategoryChange = "Forum category change" // TaskForumCategoryCreate creates a new forum category. TaskForumCategoryCreate = "Forum category create" // TaskDeleteCategory removes a forum category. TaskDeleteCategory = "Delete Category" // TaskForumThreadDelete removes a forum thread. TaskForumThreadDelete = "Forum thread delete" // TaskForumTopicChange updates a forum topic title. TaskForumTopicChange = "Forum topic change" // TaskForumTopicDelete removes a forum topic. TaskForumTopicDelete = "Forum topic delete" // TaskForumTopicCreate creates a new forum topic. TaskForumTopicCreate = "Forum topic create" // TaskTopicGrantCreate adds a new grant to a forum topic. TaskTopicGrantCreate tasks.TaskString = "Create grant" // TaskTopicGrantDelete removes an existing forum topic grant. TaskTopicGrantDelete tasks.TaskString = "Delete grant" // TaskTopicGrantUpdate updates grants for a forum topic action. TaskTopicGrantUpdate tasks.TaskString = "Update grants" // TaskCategoryGrantCreate adds a new grant to a forum category. TaskCategoryGrantCreate tasks.TaskString = "Create grant" // TaskCategoryGrantDelete removes an existing forum category grant. TaskCategoryGrantDelete tasks.TaskString = "Delete grant" // TaskSubscribeToTopic subscribes the user to new threads in a topic. TaskSubscribeToTopic tasks.TaskString = "Subscribe To Topic" // TaskUnsubscribeFromTopic removes topic thread notifications. TaskUnsubscribeFromTopic tasks.TaskString = "Unsubscribe From Topic" // TaskAddPublicLabel adds a public label to a topic. TaskAddPublicLabel tasks.TaskString = "Add Public Label" // TaskRemovePublicLabel removes a public label from a topic. TaskRemovePublicLabel tasks.TaskString = "Remove Public Label" // TaskAddAuthorLabel adds an author-only label to a topic. TaskAddAuthorLabel tasks.TaskString = "Add Author Label" // TaskRemoveAuthorLabel removes an author-only label from a topic. TaskRemoveAuthorLabel tasks.TaskString = "Remove Author Label" // TaskAddPrivateLabel adds a private label to a topic. TaskAddPrivateLabel tasks.TaskString = "Add Private Label" // TaskRemovePrivateLabel removes a private label from a topic. TaskRemovePrivateLabel tasks.TaskString = "Remove Private Label" // TaskMarkThreadRead marks a thread as read for the current user. TaskMarkThreadRead tasks.TaskString = "Mark Thread Read" // TaskSetLabels replaces public and private labels on a topic. TaskSetLabels tasks.TaskString = "Set Labels" // TaskAddTopicPublicLabel adds a public label to a topic. TaskAddTopicPublicLabel tasks.TaskString = "Add Topic Public Label" // TaskRemoveTopicPublicLabel removes a public label from a topic. TaskRemoveTopicPublicLabel tasks.TaskString = "Remove Topic Public Label" // TaskSetTopicLabels replaces public and private labels on a topic. TaskSetTopicLabels tasks.TaskString = "Set Topic Labels" )
The following constants define the allowed values of the "task" form field. Each HTML form includes a hidden or submit input named "task" whose value identifies the intended action. When routes are registered the constants are passed to gorillamuxlogic's HasTask so that only requests specifying the expected task reach a handler. Centralising these string values avoids typos between templates and route declarations.
const AdminForumFlaggedPostsPageTmpl tasks.Template = "domains/admin/forumFlaggedPostsPage.gohtml"
const AdminForumModeratorLogsPageTmpl tasks.Template = "domains/admin/forumModeratorLogsPage.gohtml"
const AdminForumWordListPageTmpl tasks.Template = "domains/admin/forumWordListPage.gohtml"
const ConfirmPageTmpl tasks.Template = "pages/misc/confirmPage.gohtml"
const (
EmailTemplateAdminNotificationForumCategoryChange notif.EmailTemplateName = "adminNotificationForumCategoryChangeEmail"
)
const (
EmailTemplateAdminNotificationForumDeleteCategory notif.EmailTemplateName = "adminNotificationForumDeleteCategoryEmail"
)
const ForumAdminCategoriesPageTmpl tasks.Template = "domains/forum/forumAdminCategoriesPage.gohtml"
const ForumAdminCategoryCreatePageTmpl tasks.Template = "domains/forum/forumAdminCategoryCreatePage.gohtml"
const ForumAdminCategoryEditPageTmpl tasks.Template = "domains/forum/forumAdminCategoryEditPage.gohtml"
const ForumAdminCategoryGrantsPageTmpl tasks.Template = "domains/forum/adminCategoryGrantsPage.gohtml"
const ForumAdminCategoryPageTmpl tasks.Template = "domains/forum/forumAdminCategoryPage.gohtml"
const ForumAdminPageTmpl tasks.Template = "domains/forum/adminPage.gohtml"
const ForumAdminThreadPageTmpl tasks.Template = "domains/forum/adminThreadPage.gohtml"
const ForumAdminThreadsPageTmpl tasks.Template = "domains/forum/adminThreadsPage.gohtml"
const ForumAdminTopicDeletePageTmpl tasks.Template = "domains/forum/adminTopicDeletePage.gohtml"
const ForumAdminTopicEditPageTmpl tasks.Template = "domains/forum/adminTopicEditPage.gohtml"
const ForumAdminTopicGrantsPageTmpl tasks.Template = "domains/forum/adminTopicGrantsPage.gohtml"
const ForumAdminTopicPageTmpl tasks.Template = "domains/forum/adminTopicPage.gohtml"
const ForumAdminTopicsPageTmpl tasks.Template = "domains/forum/adminTopicsPage.gohtml"
const ForumCreateTopicPageTmpl tasks.Template = "domains/forum/create_topic.gohtml"
const ForumPageTmpl tasks.Template = "domains/forum/page.gohtml"
const ForumThreadNewPageTmpl tasks.Template = "domains/forum/threadNewPage.gohtml"
const ForumThreadPageTmpl tasks.Template = "domains/forum/threadPage.gohtml"
const ForumTopicDescription = "THIS IS A HIDDEN FORUM FOR A FORUM TOPIC"
ForumTopicDescription describes the hidden forum topic.
const ForumTopicName = "A FORUM TOPIC"
ForumTopicName is the default name for the hidden forum topic.
const ForumTopicsPageTmpl tasks.Template = "domains/forum/topicsPage.gohtml"
const ManageTopicLabelsPageTmpl tasks.Template = "domains/forum/manageTopicLabels.gohtml"
const RedirectBackPageTmpl tasks.Template = "pages/misc/redirectBackPage.gohtml"
const RunTaskPageTmpl tasks.Template = "domains/admin/runTaskPage.gohtml"
const (
// SectionWeight controls the order of the Forum section in navigation.
SectionWeight = 40
)
Variables ¶
var ( AddPublicLabelTaskHandler = addPublicLabelTask RemovePublicLabelTaskHandler = removePublicLabelTask AddPrivateLabelTaskHandler = addPrivateLabelTask RemovePrivateLabelTaskHandler = removePrivateLabelTask AddAuthorLabelTaskHandler = addAuthorLabelTask RemoveAuthorLabelTaskHandler = removeAuthorLabelTask MarkThreadReadTaskHandler = markThreadReadTask SetLabelsTaskHandler = setLabelsTask )
Exported task handlers for reuse outside the forum package.
var (
// CreateThreadTaskHandler handles creating threads and is exported for reuse.
CreateThreadTaskHandler = createThreadTask
)
var (
// ReplyTaskHandler exposes the reply task for registration on other routes.
ReplyTaskHandler = replyTask
)
compile-time assertions that ReplyTask provides notifications, indexing and auto-subscription for thread replies.
var SubscribeTopicTaskHandler = subscribeTopicTaskAction
SubscribeTopicTaskHandler subscribes a user to a topic. Exported for reuse.
var ThreadNewCancelHandler = threadNewCancelAction
ThreadNewCancelHandler aborts creating a new thread. Exported for reuse.
var TopicThreadCommentEditActionCancelHandler = topicThreadCommentEditActionCancel
TopicThreadCommentEditActionCancelHandler aborts editing a comment. Exported for reuse.
var TopicThreadCommentEditActionHandler = topicThreadCommentEditAction
TopicThreadCommentEditActionHandler updates a comment. Exported for reuse.
var TopicThreadReplyCancelHandler = topicThreadReplyCancel
TopicThreadReplyCancelHandler cancels replying to a thread. Exported for reuse.
var UnsubscribeTopicTaskHandler = unsubscribeTopicTaskAction
UnsubscribeTopicTaskHandler removes a topic subscription. Exported for reuse.
Functions ¶
func AdminCategoriesPage ¶
func AdminCategoriesPage(w http.ResponseWriter, r *http.Request)
AdminCategoriesPage displays forum categories with pagination.
func AdminCategoryCreatePage ¶
func AdminCategoryCreatePage(w http.ResponseWriter, r *http.Request)
AdminCategoryCreatePage renders a form to create a new forum category.
func AdminCategoryCreateSubmit ¶
func AdminCategoryCreateSubmit(w http.ResponseWriter, r *http.Request)
AdminCategoryCreateSubmit handles creation of a new forum category.
func AdminCategoryDeletePage ¶
func AdminCategoryDeletePage(w http.ResponseWriter, r *http.Request)
AdminCategoryDeletePage removes a forum category.
func AdminCategoryEditPage ¶
func AdminCategoryEditPage(w http.ResponseWriter, r *http.Request)
AdminCategoryEditPage displays a form to edit a forum category.
func AdminCategoryEditSubmit ¶
func AdminCategoryEditSubmit(w http.ResponseWriter, r *http.Request)
AdminCategoryEditSubmit processes updates to an existing forum category.
func AdminCategoryGrantsPage ¶
func AdminCategoryGrantsPage(w http.ResponseWriter, r *http.Request)
AdminCategoryGrantsPage displays grants for a forum category.
func AdminCategoryPage ¶
func AdminCategoryPage(w http.ResponseWriter, r *http.Request)
AdminCategoryPage shows information about a single forum category and its topics.
func AdminForumFlaggedPostsPage ¶
func AdminForumFlaggedPostsPage(w http.ResponseWriter, r *http.Request)
adminForumFlaggedPostsPage displays posts flagged for moderator review.
func AdminForumModeratorLogsPage ¶
func AdminForumModeratorLogsPage(w http.ResponseWriter, r *http.Request)
adminForumModeratorLogsPage displays recent moderator actions.
func AdminForumPage ¶
func AdminForumPage(w http.ResponseWriter, r *http.Request)
func AdminForumRemakeForumThreadPage ¶
func AdminForumRemakeForumThreadPage(w http.ResponseWriter, r *http.Request)
func AdminForumRemakeForumTopicPage ¶
func AdminForumRemakeForumTopicPage(w http.ResponseWriter, r *http.Request)
func AdminForumWordListPage ¶
func AdminForumWordListPage(w http.ResponseWriter, r *http.Request)
func AdminThreadDeleteConfirmPage ¶
func AdminThreadDeleteConfirmPage(w http.ResponseWriter, r *http.Request)
func AdminThreadDeletePage ¶
func AdminThreadDeletePage(w http.ResponseWriter, r *http.Request)
func AdminThreadPage ¶
func AdminThreadPage(w http.ResponseWriter, r *http.Request)
func AdminThreadsPage ¶
func AdminThreadsPage(w http.ResponseWriter, r *http.Request)
func AdminTopicCreatePage ¶
func AdminTopicCreatePage(w http.ResponseWriter, r *http.Request)
func AdminTopicDeleteConfirmPage ¶
func AdminTopicDeleteConfirmPage(w http.ResponseWriter, r *http.Request)
func AdminTopicDeletePage ¶
func AdminTopicDeletePage(w http.ResponseWriter, r *http.Request)
func AdminTopicEditFormPage ¶
func AdminTopicEditFormPage(w http.ResponseWriter, r *http.Request)
AdminTopicEditFormPage shows the edit form for a forum topic.
func AdminTopicEditPage ¶
func AdminTopicEditPage(w http.ResponseWriter, r *http.Request)
func AdminTopicGrantsPage ¶
func AdminTopicGrantsPage(w http.ResponseWriter, r *http.Request)
AdminTopicGrantsPage displays the drag-and-drop role grants editor for a forum topic.
func AdminTopicPage ¶
func AdminTopicPage(w http.ResponseWriter, r *http.Request)
AdminTopicPage shows information about a single forum topic.
func AdminTopicsPage ¶
func AdminTopicsPage(w http.ResponseWriter, r *http.Request)
AdminTopicsPage shows all forum topics for management.
func BasePathMiddleware ¶
func BasePathMiddleware(base string) mux.MiddlewareFunc
BasePathMiddleware sets the forum base path on CoreData for downstream handlers.
func CreateTopicPageWithPostTask ¶
func CreateTopicPageWithPostTask(w http.ResponseWriter, r *http.Request, postTask tasks.TaskString, formData *CreateTopicPageForm)
CreateTopicPageWithPostTask renders the create topic page with a given post task.
func CustomForumIndex ¶
CustomForumIndex builds context-aware index items for the public forum.
func ForumCustomIndexItems ¶
ForumCustomIndexItems returns the context-aware index items for forum pages.
func ManageTopicLabelsPage ¶
func ManageTopicLabelsPage(w http.ResponseWriter, r *http.Request)
func QuoteSelectionApi ¶ added in v0.0.205
func QuoteSelectionApi(w http.ResponseWriter, r *http.Request)
func RegisterAdminRoutes ¶
RegisterAdminRoutes attaches forum admin endpoints to ar.
func RegisterRoutes ¶
func RegisterRoutes(r *mux.Router, cfg *config.RuntimeConfig) []navpkg.RouterOptions
RegisterRoutes attaches the public forum endpoints to r.
func RegisterTasks ¶
RegisterTasks registers forum related tasks with the global registry.
func RequireThreadAndTopic ¶
RequireThreadAndTopic loads the thread specified in the URL and caches the associated topic on CoreData. Both records are accessible through CoreData for subsequent handlers.
func SharedThreadPreviewPage ¶
func SharedThreadPreviewPage(w http.ResponseWriter, r *http.Request)
SharedThreadPreviewPage renders an OpenGraph preview for a forum thread.
func SharedTopicPreviewPage ¶
func SharedTopicPreviewPage(w http.ResponseWriter, r *http.Request)
SharedTopicPreviewPage renders an OpenGraph preview for a forum topic.
func SubscribeTopicPage ¶
func SubscribeTopicPage(w http.ResponseWriter, r *http.Request)
SubscribeTopicPage renders a simple confirmation form that POSTS to the existing subscribe task endpoint. This allows exposing the action as a link in the Custom Index while keeping the state change as a POST.
func ThreadDelete ¶
ThreadDelete removes a forum thread and updates topic statistics.
func ThreadNewCancelPage ¶
func ThreadNewCancelPage(w http.ResponseWriter, r *http.Request)
func ThreadPage ¶
func ThreadPage(w http.ResponseWriter, r *http.Request)
ThreadPage serves the forum thread page at the default /forum prefix.
func ThreadPageWithBasePath ¶
func ThreadPageWithBasePath(w http.ResponseWriter, r *http.Request, basePath string)
func TopicAtomPage ¶
func TopicAtomPage(w http.ResponseWriter, r *http.Request)
func TopicRssPage ¶
func TopicRssPage(w http.ResponseWriter, r *http.Request)
func TopicThreadCommentEditActionCancelPage ¶
func TopicThreadCommentEditActionCancelPage(w http.ResponseWriter, r *http.Request)
func TopicThreadCommentEditActionPage ¶
func TopicThreadCommentEditActionPage(w http.ResponseWriter, r *http.Request)
func TopicThreadReplyCancelPage ¶
func TopicThreadReplyCancelPage(w http.ResponseWriter, r *http.Request)
func TopicsPage ¶
func TopicsPage(w http.ResponseWriter, r *http.Request)
TopicsPage serves the forum topic page at the default /forum prefix.
func TopicsPageWithBasePath ¶
func TopicsPageWithBasePath(w http.ResponseWriter, r *http.Request, basePath string)
func UnsubscribeTopicPage ¶
func UnsubscribeTopicPage(w http.ResponseWriter, r *http.Request)
UnsubscribeTopicPage renders a simple confirmation form that POSTS to the existing unsubscribe task endpoint. This allows exposing the action as a link in the Custom Index while keeping the state change as a POST.
func UserCanCreateThread ¶
func UserCanCreateThread(ctx context.Context, q db.Querier, section string, topicID, uid int32) (bool, error)
UserCanCreateThread reports whether uid may create a thread in the topic.
Types ¶
type AddAuthorLabelTask ¶
type AddAuthorLabelTask struct{ tasks.TaskString }
AddAuthorLabelTask adds an author-only label to a thread.
func (AddAuthorLabelTask) Action ¶
func (AddAuthorLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type AddPrivateLabelTask ¶
type AddPrivateLabelTask struct{ tasks.TaskString }
AddPrivateLabelTask adds a private label for the current user.
func (AddPrivateLabelTask) Action ¶
func (AddPrivateLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type AddPublicLabelTask ¶
type AddPublicLabelTask struct{ tasks.TaskString }
AddPublicLabelTask adds a public label to a thread.
func (AddPublicLabelTask) Action ¶
func (AddPublicLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type AddTopicPublicLabelTask ¶
type AddTopicPublicLabelTask struct{ tasks.TaskString }
AddTopicPublicLabelTask adds a public label to a topic.
func (AddTopicPublicLabelTask) Action ¶
func (AddTopicPublicLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type AdminTopicDisplay ¶
type CategoryChangeTask ¶
type CategoryChangeTask struct{ tasks.TaskString }
CategoryChangeTask updates a forum category name.
func (CategoryChangeTask) AdminEmailTemplate ¶
func (CategoryChangeTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (CategoryChangeTask) AdminInternalNotificationTemplate ¶
func (CategoryChangeTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (CategoryChangeTask) RequiredTemplates ¶
func (CategoryChangeTask) RequiredTemplates() []tasks.Template
type CategoryCreateTask ¶
type CategoryCreateTask struct{ tasks.TaskString }
CategoryCreateTask creates a new forum category.
func (CategoryCreateTask) AdminEmailTemplate ¶
func (CategoryCreateTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (CategoryCreateTask) AdminInternalNotificationTemplate ¶
func (CategoryCreateTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (CategoryCreateTask) RequiredTemplates ¶
func (CategoryCreateTask) RequiredTemplates() []tasks.Template
type CategoryGrantCreateTask ¶
type CategoryGrantCreateTask struct{ tasks.TaskString }
CategoryGrantCreateTask creates a new grant for a forum category.
func (CategoryGrantCreateTask) Action ¶
func (CategoryGrantCreateTask) Action(w http.ResponseWriter, r *http.Request) any
type CategoryGrantDeleteTask ¶
type CategoryGrantDeleteTask struct{ tasks.TaskString }
CategoryGrantDeleteTask removes a grant from a forum category.
func (CategoryGrantDeleteTask) Action ¶
func (CategoryGrantDeleteTask) Action(w http.ResponseWriter, r *http.Request) any
type CategoryTree ¶
type CategoryTree struct {
CategoryChildrenLookup map[int32][]*ForumcategoryPlus
CategoryLookup map[int32]*ForumcategoryPlus
}
func NewCategoryTree ¶
func NewCategoryTree(categoryRows []*db.Forumcategory, topicRows []*ForumtopicPlus) *CategoryTree
func NewCategoryTreeUnpruned ¶
func NewCategoryTreeUnpruned(categoryRows []*db.Forumcategory, topicRows []*ForumtopicPlus) *CategoryTree
func (*CategoryTree) CategoryRoots ¶
func (ct *CategoryTree) CategoryRoots(categoryId int32) (result []*ForumcategoryPlus)
func (*CategoryTree) PruneEmpty ¶
func (ct *CategoryTree) PruneEmpty()
PruneEmpty removes categories that contain no visible topics and no subcategories with visible topics.
type CreateThreadTask ¶
type CreateThreadTask struct{ tasks.TaskString }
CreateThreadTask handles creating a new forum thread.
func (CreateThreadTask) Action ¶
func (CreateThreadTask) Action(w http.ResponseWriter, r *http.Request) any
func (CreateThreadTask) AdminEmailTemplate ¶
func (CreateThreadTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (CreateThreadTask) AdminInternalNotificationTemplate ¶
func (CreateThreadTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (CreateThreadTask) AutoSubscribeGrants ¶
func (CreateThreadTask) AutoSubscribeGrants(evt eventbus.TaskEvent) ([]notif.GrantRequirement, error)
func (CreateThreadTask) AutoSubscribePath ¶
AutoSubscribePath implements notif.AutoSubscribeProvider. When the postcountworker provides context, a subscription to the created thread is generated.
func (CreateThreadTask) IndexData ¶
func (CreateThreadTask) IndexData(data map[string]any) []searchworker.IndexEventData
func (CreateThreadTask) IndexType ¶
func (CreateThreadTask) IndexType() string
func (CreateThreadTask) Page ¶
func (CreateThreadTask) Page(w http.ResponseWriter, r *http.Request)
func (CreateThreadTask) RequiredTemplates ¶
func (CreateThreadTask) RequiredTemplates() []tasks.Template
func (CreateThreadTask) SubscribedEmailTemplate ¶
func (CreateThreadTask) SubscribedEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (CreateThreadTask) SubscribedInternalNotificationTemplate ¶
func (CreateThreadTask) SubscribedInternalNotificationTemplate(evt eventbus.TaskEvent) *string
type CreateTopicPageForm ¶
type CreateTopicPageForm struct {
Participants string
InvalidParticipants string
Title string
Description string
}
CreateTopicPageForm holds the data for the create topic form.
type DeleteCategoryTask ¶
type DeleteCategoryTask struct{ tasks.TaskString }
DeleteCategoryTask removes a forum category.
func (DeleteCategoryTask) AdminEmailTemplate ¶
func (DeleteCategoryTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (DeleteCategoryTask) AdminInternalNotificationTemplate ¶
func (DeleteCategoryTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (DeleteCategoryTask) RequiredTemplates ¶
func (DeleteCategoryTask) RequiredTemplates() []tasks.Template
type ForumcategoryPlus ¶
type ForumcategoryPlus struct {
*db.Forumcategory
Categories []*ForumcategoryPlus
Topics []*ForumtopicPlus
Edit bool
}
type ForumtopicPlus ¶
type ForumtopicPlus struct {
Idforumtopic int32
Lastposter int32
ForumcategoryIdforumcategory int32
Title sql.NullString
Description sql.NullString
// DisplayTitle optionally overrides Title for display purposes.
DisplayTitle string
Threads sql.NullInt32
Comments sql.NullInt32
Lastaddition sql.NullTime
Lastposterusername sql.NullString
Edit bool
Labels []templates.TopicLabel
}
type MarkThreadReadTask ¶
type MarkThreadReadTask struct{ tasks.TaskString }
MarkThreadReadTask clears the special new/unread flags for a thread.
func (MarkThreadReadTask) Action ¶
func (MarkThreadReadTask) Action(w http.ResponseWriter, r *http.Request) any
func (*MarkThreadReadTask) Matcher ¶
func (t *MarkThreadReadTask) Matcher() mux.MatcherFunc
type RemakeThreadStatsTask ¶
type RemakeThreadStatsTask struct{ tasks.TaskString }
RemakeThreadStatsTask refreshes forum thread statistics.
type RemakeTopicStatsTask ¶
type RemakeTopicStatsTask struct{ tasks.TaskString }
RemakeTopicStatsTask refreshes forum topic statistics.
type RemoveAuthorLabelTask ¶
type RemoveAuthorLabelTask struct{ tasks.TaskString }
RemoveAuthorLabelTask removes an author-only label from a thread.
func (RemoveAuthorLabelTask) Action ¶
func (RemoveAuthorLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type RemovePrivateLabelTask ¶
type RemovePrivateLabelTask struct{ tasks.TaskString }
RemovePrivateLabelTask removes a private label for the current user.
func (RemovePrivateLabelTask) Action ¶
func (RemovePrivateLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type RemovePublicLabelTask ¶
type RemovePublicLabelTask struct{ tasks.TaskString }
RemovePublicLabelTask removes a public label from a thread.
func (RemovePublicLabelTask) Action ¶
func (RemovePublicLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type RemoveTopicPublicLabelTask ¶
type RemoveTopicPublicLabelTask struct{ tasks.TaskString }
RemoveTopicPublicLabelTask removes a public label from a topic.
func (RemoveTopicPublicLabelTask) Action ¶
func (RemoveTopicPublicLabelTask) Action(w http.ResponseWriter, r *http.Request) any
type ReplyTask ¶
type ReplyTask struct{ tasks.TaskString }
ReplyTask handles replying to an existing thread.
func (ReplyTask) AdminEmailTemplate ¶
func (ReplyTask) AdminInternalNotificationTemplate ¶
func (ReplyTask) AutoSubscribeGrants ¶
func (ReplyTask) AutoSubscribePath ¶
AutoSubscribePath ensures authors automatically receive updates on replies. AutoSubscribePath implements notif.AutoSubscribeProvider. The subscription is created for the originating forum thread when that information is 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 public and private labels on a thread.
func (SetLabelsTask) Action ¶
func (SetLabelsTask) Action(w http.ResponseWriter, r *http.Request) any
type SetTopicLabelsTask ¶
type SetTopicLabelsTask struct{ tasks.TaskString }
SetTopicLabelsTask replaces public and private labels on a topic.
func (SetTopicLabelsTask) Action ¶
func (SetTopicLabelsTask) Action(w http.ResponseWriter, r *http.Request) any
type ThreadDeleteTask ¶
type ThreadDeleteTask struct{ tasks.TaskString }
ThreadDeleteTask removes a forum thread.
func (ThreadDeleteTask) AdminEmailTemplate ¶
func (ThreadDeleteTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (ThreadDeleteTask) AdminInternalNotificationTemplate ¶
func (ThreadDeleteTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (ThreadDeleteTask) RequiredTemplates ¶
func (ThreadDeleteTask) RequiredTemplates() []tasks.Template
type TopicChangeTask ¶
type TopicChangeTask struct{ tasks.TaskString }
TopicChangeTask updates a forum topic title or details.
func (TopicChangeTask) AdminEmailTemplate ¶
func (TopicChangeTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (TopicChangeTask) AdminInternalNotificationTemplate ¶
func (TopicChangeTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (TopicChangeTask) RequiredTemplates ¶
func (TopicChangeTask) RequiredTemplates() []tasks.Template
type TopicCreateTask ¶
type TopicCreateTask struct{ tasks.TaskString }
TopicCreateTask creates a new forum topic.
func (TopicCreateTask) AdminEmailTemplate ¶
func (TopicCreateTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (TopicCreateTask) AdminInternalNotificationTemplate ¶
func (TopicCreateTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (TopicCreateTask) RequiredTemplates ¶
func (TopicCreateTask) RequiredTemplates() []tasks.Template
type TopicDeleteTask ¶
type TopicDeleteTask struct{ tasks.TaskString }
TopicDeleteTask removes a forum topic.
func (TopicDeleteTask) AdminEmailTemplate ¶
func (TopicDeleteTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)
func (TopicDeleteTask) AdminInternalNotificationTemplate ¶
func (TopicDeleteTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string
func (TopicDeleteTask) RequiredTemplates ¶
func (TopicDeleteTask) RequiredTemplates() []tasks.Template
type TopicGrantCreateTask ¶
type TopicGrantCreateTask struct{ tasks.TaskString }
TopicGrantCreateTask creates a new grant for a forum topic.
func (TopicGrantCreateTask) Action ¶
func (TopicGrantCreateTask) Action(w http.ResponseWriter, r *http.Request) any
type TopicGrantDeleteTask ¶
type TopicGrantDeleteTask struct{ tasks.TaskString }
TopicGrantDeleteTask removes a grant from a forum topic.
func (TopicGrantDeleteTask) Action ¶
func (TopicGrantDeleteTask) Action(w http.ResponseWriter, r *http.Request) any
type TopicGrantGroup ¶
TopicGrantGroup represents roles assigned to an action on a topic.
type TopicGrantUpdateTask ¶
type TopicGrantUpdateTask struct{ tasks.TaskString }
TopicGrantUpdateTask updates role grants for a forum topic action.
func (TopicGrantUpdateTask) Action ¶
func (TopicGrantUpdateTask) Action(w http.ResponseWriter, r *http.Request) any
Source Files
¶
- adminForumFlaggedPostsPage.go
- adminForumHandler.go
- adminForumModeratorLogsPage.go
- adminForumWordListHandler.go
- api.go
- basepath.go
- category_change_task.go
- category_create_task.go
- category_grant_create_task.go
- category_grant_delete_task.go
- comment_edit_action_cancel_task.go
- comment_edit_action_task.go
- constants.go
- create_topic_page.go
- customindex.go
- delete_category_task.go
- forum.go
- forumAdminCategoriesPage.go
- forumAdminCategoryCreatePage.go
- forumAdminCategoryEditPage.go
- forumAdminCategoryGrantsPage.go
- forumAdminCategoryPage.go
- forumAdminThreadsPage.go
- forumAdminTopicGrantsPage.go
- forumAdminTopicPage.go
- forumAdminTopicsPage.go
- forumFeed.go
- forumPage.go
- forumSubscriptions.go
- forumThreadNewPage.go
- forumThreadPage.go
- forumTopicPage.go
- forumTopicThreadCommentEditPage.go
- forumTopicThreadReplyPage.go
- handlers.go
- manage_topic_labels_page.go
- matchers.go
- notification_templates.go
- permissions.go
- remake_thread_stats_task.go
- remake_topic_stats_task.go
- routes.go
- routes_admin.go
- section.go
- shared_preview.go
- static.go
- subscribe_topic_page.go
- subscribe_topic_task.go
- task_events_admin.go
- tasks.go
- tasks_register.go
- thread_delete.go
- thread_delete_task.go
- thread_label_tasks.go
- thread_new_cancel_task.go
- topic_change_task.go
- topic_create_task.go
- topic_delete_task.go
- topic_grant_create_task.go
- topic_grant_delete_task.go
- topic_grant_tasks.go
- topic_grant_update_task.go
- topic_grants.go
- topic_label_tasks.go
- topic_thread_reply_cancel_task.go
- unsubscribe_topic_page.go
- unsubscribe_topic_task.go