forum

package
v0.0.217 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmailTemplateForumReply                  notif.EmailTemplateName        = "forumReplyEmail"
	NotificationTemplateForumReply           notif.NotificationTemplateName = "reply"
	EmailTemplateAdminNotificationForumReply notif.EmailTemplateName        = "adminNotificationForumReplyEmail"
)
View Source
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"
)
View Source
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.

View Source
const AdminForumFlaggedPostsPageTmpl tasks.Template = "domains/admin/forumFlaggedPostsPage.gohtml"
View Source
const AdminForumModeratorLogsPageTmpl tasks.Template = "domains/admin/forumModeratorLogsPage.gohtml"
View Source
const AdminForumWordListPageTmpl tasks.Template = "domains/admin/forumWordListPage.gohtml"
View Source
const ConfirmPageTmpl tasks.Template = "pages/misc/confirmPage.gohtml"
View Source
const (
	EmailTemplateAdminNotificationForumCategoryChange notif.EmailTemplateName = "adminNotificationForumCategoryChangeEmail"
)
View Source
const (
	EmailTemplateAdminNotificationForumDeleteCategory notif.EmailTemplateName = "adminNotificationForumDeleteCategoryEmail"
)
View Source
const ForumAdminCategoriesPageTmpl tasks.Template = "domains/forum/forumAdminCategoriesPage.gohtml"
View Source
const ForumAdminCategoryCreatePageTmpl tasks.Template = "domains/forum/forumAdminCategoryCreatePage.gohtml"
View Source
const ForumAdminCategoryEditPageTmpl tasks.Template = "domains/forum/forumAdminCategoryEditPage.gohtml"
View Source
const ForumAdminCategoryGrantsPageTmpl tasks.Template = "domains/forum/adminCategoryGrantsPage.gohtml"
View Source
const ForumAdminCategoryPageTmpl tasks.Template = "domains/forum/forumAdminCategoryPage.gohtml"
View Source
const ForumAdminPageTmpl tasks.Template = "domains/forum/adminPage.gohtml"
View Source
const ForumAdminThreadPageTmpl tasks.Template = "domains/forum/adminThreadPage.gohtml"
View Source
const ForumAdminThreadsPageTmpl tasks.Template = "domains/forum/adminThreadsPage.gohtml"
View Source
const ForumAdminTopicDeletePageTmpl tasks.Template = "domains/forum/adminTopicDeletePage.gohtml"
View Source
const ForumAdminTopicEditPageTmpl tasks.Template = "domains/forum/adminTopicEditPage.gohtml"
View Source
const ForumAdminTopicGrantsPageTmpl tasks.Template = "domains/forum/adminTopicGrantsPage.gohtml"
View Source
const ForumAdminTopicPageTmpl tasks.Template = "domains/forum/adminTopicPage.gohtml"
View Source
const ForumAdminTopicsPageTmpl tasks.Template = "domains/forum/adminTopicsPage.gohtml"
View Source
const ForumCreateTopicPageTmpl tasks.Template = "domains/forum/create_topic.gohtml"
View Source
const ForumPageTmpl tasks.Template = "domains/forum/page.gohtml"
View Source
const ForumThreadNewPageTmpl tasks.Template = "domains/forum/threadNewPage.gohtml"
View Source
const ForumThreadPageTmpl tasks.Template = "domains/forum/threadPage.gohtml"
View Source
const ForumTopicDescription = "THIS IS A HIDDEN FORUM FOR A FORUM TOPIC"

ForumTopicDescription describes the hidden forum topic.

View Source
const ForumTopicName = "A FORUM TOPIC"

ForumTopicName is the default name for the hidden forum topic.

View Source
const ForumTopicsPageTmpl tasks.Template = "domains/forum/topicsPage.gohtml"
View Source
const ManageTopicLabelsPageTmpl tasks.Template = "domains/forum/manageTopicLabels.gohtml"
View Source
const RedirectBackPageTmpl tasks.Template = "pages/misc/redirectBackPage.gohtml"
View Source
const RunTaskPageTmpl tasks.Template = "domains/admin/runTaskPage.gohtml"
View Source
const (
	// SectionWeight controls the order of the Forum section in navigation.
	SectionWeight = 40
)
View Source
const SharedPreviewLoginPageTmpl tasks.Template = "pages/auth/sharedPreviewLogin.gohtml"

Variables

View Source
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.

View Source
var (

	// CreateThreadTaskHandler handles creating threads and is exported for reuse.
	CreateThreadTaskHandler = createThreadTask
)
View Source
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.

View Source
var SubscribeTopicTaskHandler = subscribeTopicTaskAction

SubscribeTopicTaskHandler subscribes a user to a topic. Exported for reuse.

View Source
var ThreadNewCancelHandler = threadNewCancelAction

ThreadNewCancelHandler aborts creating a new thread. Exported for reuse.

View Source
var TopicThreadCommentEditActionCancelHandler = topicThreadCommentEditActionCancel

TopicThreadCommentEditActionCancelHandler aborts editing a comment. Exported for reuse.

View Source
var TopicThreadCommentEditActionHandler = topicThreadCommentEditAction

TopicThreadCommentEditActionHandler updates a comment. Exported for reuse.

View Source
var TopicThreadReplyCancelHandler = topicThreadReplyCancel

TopicThreadReplyCancelHandler cancels replying to a thread. Exported for reuse.

View Source
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

func CustomForumIndex(cd *common.CoreData, r *http.Request)

CustomForumIndex builds context-aware index items for the public forum.

func ForumCustomIndexItems

func ForumCustomIndexItems(cd *common.CoreData, r *http.Request) []common.IndexItem

ForumCustomIndexItems returns the context-aware index items for forum pages.

func ManageTopicLabelsPage

func ManageTopicLabelsPage(w http.ResponseWriter, r *http.Request)

func Page

func Page(w http.ResponseWriter, r *http.Request)

func QuoteApi

func QuoteApi(w http.ResponseWriter, r *http.Request)

func QuoteSelectionApi added in v0.0.205

func QuoteSelectionApi(w http.ResponseWriter, r *http.Request)

func Register

func Register(reg *router.Registry)

Register registers the forum router module.

func RegisterAdminRoutes

func RegisterAdminRoutes(ar *mux.Router)

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

func RegisterTasks() []tasks.NamedTask

RegisterTasks registers forum related tasks with the global registry.

func RequireThreadAndTopic

func RequireThreadAndTopic(next http.Handler) http.Handler

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

func ThreadDelete(ctx context.Context, q db.Querier, threadID, topicID int32) error

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.

func UserCanCreateTopic

func UserCanCreateTopic(ctx context.Context, q db.Querier, section string, categoryID, uid int32) (bool, error)

UserCanCreateTopic reports whether uid may create a topic in the category.

func UserCanLabelTopic

func UserCanLabelTopic(ctx context.Context, q db.Querier, section string, topicID, uid int32) (bool, error)

UserCanLabelTopic reports whether uid may add/remove labels on the topic.

Types

type AddAuthorLabelTask

type AddAuthorLabelTask struct{ tasks.TaskString }

AddAuthorLabelTask adds an author-only label to a thread.

func (AddAuthorLabelTask) Action

type AddPrivateLabelTask

type AddPrivateLabelTask struct{ tasks.TaskString }

AddPrivateLabelTask adds a private label for the current user.

func (AddPrivateLabelTask) Action

type AddPublicLabelTask

type AddPublicLabelTask struct{ tasks.TaskString }

AddPublicLabelTask adds a public label to a thread.

func (AddPublicLabelTask) Action

type AddTopicPublicLabelTask

type AddTopicPublicLabelTask struct{ tasks.TaskString }

AddTopicPublicLabelTask adds a public label to a topic.

func (AddTopicPublicLabelTask) Action

type AdminTopicDisplay

type AdminTopicDisplay struct {
	*db.Forumtopic

	IsPrivate    bool
	Participants string
	AccessInfo   string
	DisplayTitle string

	// Optional but handy for the list view / future tweaks
	CategoryLabel string
}

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

type CategoryGrantDeleteTask

type CategoryGrantDeleteTask struct{ tasks.TaskString }

CategoryGrantDeleteTask removes a grant from a forum category.

func (CategoryGrantDeleteTask) Action

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) 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

func (CreateThreadTask) AutoSubscribePath(evt eventbus.TaskEvent) (string, string, error)

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) 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 Handlers

type Handlers struct {
}

Handlers contains the web handlers for this module.

func New

func New() *Handlers

New constructs a new Handlers struct for this module.

type MarkThreadReadTask

type MarkThreadReadTask struct{ tasks.TaskString }

MarkThreadReadTask clears the special new/unread flags for a thread.

func (MarkThreadReadTask) Action

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

type RemovePrivateLabelTask

type RemovePrivateLabelTask struct{ tasks.TaskString }

RemovePrivateLabelTask removes a private label for the current user.

func (RemovePrivateLabelTask) Action

type RemovePublicLabelTask

type RemovePublicLabelTask struct{ tasks.TaskString }

RemovePublicLabelTask removes a public label from a thread.

func (RemovePublicLabelTask) Action

type RemoveTopicPublicLabelTask

type RemoveTopicPublicLabelTask struct{ tasks.TaskString }

RemoveTopicPublicLabelTask removes a public label from a topic.

func (RemoveTopicPublicLabelTask) Action

type ReplyTask

type ReplyTask struct{ tasks.TaskString }

ReplyTask handles replying to an existing thread.

func (ReplyTask) Action

func (ReplyTask) Action(w http.ResponseWriter, r *http.Request) any

func (ReplyTask) AdminEmailTemplate

func (ReplyTask) AdminEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)

func (ReplyTask) AdminInternalNotificationTemplate

func (ReplyTask) AdminInternalNotificationTemplate(evt eventbus.TaskEvent) *string

func (ReplyTask) AutoSubscribeGrants

func (ReplyTask) AutoSubscribeGrants(evt eventbus.TaskEvent) ([]notif.GrantRequirement, error)

func (ReplyTask) AutoSubscribePath

func (ReplyTask) AutoSubscribePath(evt eventbus.TaskEvent) (string, string, error)

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) IndexType

func (ReplyTask) IndexType() string

func (ReplyTask) RequiredTemplates

func (ReplyTask) RequiredTemplates() []tasks.Template

func (ReplyTask) SubscribedEmailTemplate

func (ReplyTask) SubscribedEmailTemplate(evt eventbus.TaskEvent) (templates *notif.EmailTemplates, send bool)

func (ReplyTask) SubscribedInternalNotificationTemplate

func (ReplyTask) SubscribedInternalNotificationTemplate(evt eventbus.TaskEvent) *string

type SetLabelsTask

type SetLabelsTask struct{ tasks.TaskString }

SetLabelsTask replaces public and private labels on a thread.

func (SetLabelsTask) Action

type SetTopicLabelsTask

type SetTopicLabelsTask struct{ tasks.TaskString }

SetTopicLabelsTask replaces public and private labels on a topic.

func (SetTopicLabelsTask) Action

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

type TopicGrantDeleteTask

type TopicGrantDeleteTask struct{ tasks.TaskString }

TopicGrantDeleteTask removes a grant from a forum topic.

func (TopicGrantDeleteTask) Action

type TopicGrantGroup

type TopicGrantGroup struct {
	Action    string
	Have      []string
	Disabled  []string
	Available []string
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址