writings

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 (
	// WritingTopicName is the default name for the hidden writing forum.
	WritingTopicName = "A WRITING TOPIC"

	// WritingTopicDescription describes the hidden writing forum.
	WritingTopicDescription = "THIS IS A HIDDEN FORUM FOR A WRITING"
)
View Source
const (
	EmailTemplateWriting        notif.EmailTemplateName        = "writingEmail"
	NotificationTemplateWriting notif.NotificationTemplateName = "writing"

	EmailTemplateWritingUpdate        notif.EmailTemplateName        = "writingUpdateEmail"
	NotificationTemplateWritingUpdate notif.NotificationTemplateName = "writing_update"

	EmailTemplateWritingReply        notif.EmailTemplateName        = "replyEmail"
	NotificationTemplateWritingReply notif.NotificationTemplateName = "reply"

	EmailTemplateAdminNotificationWritingCommentEdit notif.EmailTemplateName = "adminNotificationNewsCommentEditEmail"
)
View Source
const (
	// TaskSubmitWriting submits a new writing.
	TaskSubmitWriting tasks.TaskString = "Submit writing"

	// TaskReply posts a reply on a writing.
	TaskReply = "Reply"

	// TaskEditReply edits a comment or reply.
	TaskEditReply = "Edit Reply"

	// TaskCancel cancels a pending edit.
	TaskCancel = "Cancel"

	// TaskUpdateWriting updates an existing writing.
	TaskUpdateWriting = "Update writing"

	// TaskWritingCategoryChange changes a writing category name.
	TaskWritingCategoryChange = "writing category change"

	// TaskWritingCategoryCreate creates a new writing category.
	TaskWritingCategoryCreate = "writing category create"

	// TaskCategoryGrantCreate adds a new grant to a writing category.
	TaskCategoryGrantCreate tasks.TaskString = "Create grant"

	// TaskCategoryGrantDelete removes an existing grant from a writing category.
	TaskCategoryGrantDelete tasks.TaskString = "Delete grant"
)

Task constants used by writings handlers.

View Source
const AdminNoAccessPageTmpl tasks.Template = "domains/admin/noAccessPage.gohtml"
View Source
const AdminWritingsPageTmpl tasks.Template = "domains/writings/adminWritingsPage.gohtml"
View Source
const ArticlePageTmpl tasks.Template = "domains/writings/articlePage.gohtml"
View Source
const (
	// SectionWeight controls the order of the Writings section in navigation.
	SectionWeight = 30
)
View Source
const WritingsAdminCategoriesPageTmpl tasks.Template = "domains/writings/writingsAdminCategoriesPage.gohtml"
View Source
const WritingsAdminCategoryEditPageTmpl tasks.Template = "domains/writings/writingsAdminCategoryEditPage.gohtml"
View Source
const WritingsAdminCategoryGrantsPageTmpl tasks.Template = "domains/writings/adminCategoryGrantsPage.gohtml"
View Source
const WritingsAdminCategoryPageTmpl tasks.Template = "domains/writings/writingsAdminCategoryPage.gohtml"
View Source
const WritingsAdminPageTmpl tasks.Template = "domains/writings/writingsAdminPage.gohtml"
View Source
const WritingsArticleAddPageTmpl tasks.Template = "domains/writings/articleAddPage.gohtml"
View Source
const WritingsArticleEditPageTmpl tasks.Template = "domains/writings/articleEditPage.gohtml"
View Source
const WritingsCategoriesPageTmpl tasks.Template = "domains/writings/writingsCategoriesPage.gohtml"
View Source
const WritingsCategoryPageTmpl tasks.Template = "domains/writings/categoryPage.gohtml"
View Source
const (
	WritingsPageTmpl tasks.Template = "domains/writings/page.gohtml"
)
View Source
const WritingsWriterListPageTmpl tasks.Template = "domains/writings/writerListPage.gohtml"
View Source
const WritingsWriterPageTmpl tasks.Template = "domains/writings/writerPage.gohtml"

Variables

This section is empty.

Functions

func AdminCategoriesPage

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

func AdminCategoryEditPage

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

AdminCategoryEditPage shows a form to edit a single writing category.

func AdminCategoryGrantsPage

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

AdminCategoryGrantsPage shows grants for a writing category.

func AdminCategoryPage

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

AdminCategoryPage shows a single writing category and its writings.

func AdminPage

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

AdminPage renders the writings administration page.

func AdminWritingsPage

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

AdminWritingsPage renders the writings admin index with role summaries.

func ArticleAddActionPage

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

func ArticleAddPage

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

func ArticleCommentEditActionCancelPage

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

ArticleCommentEditActionCancelPage aborts editing a comment.

func ArticleCommentEditActionPage

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

ArticleCommentEditActionPage updates a comment on a writing and refreshes thread metadata.

func ArticleEditActionPage

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

func ArticleEditPage

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

func ArticlePage

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

func ArticleReplyActionPage

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

func AtomPage

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

func CategoriesPage

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

func CategoryPage

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

func CustomWritingsIndex

func CustomWritingsIndex(data *common.CoreData, r *http.Request)

func MatchCanEditWritingArticle

func MatchCanEditWritingArticle(r *http.Request, rm *mux.RouteMatch) bool

MatchCanEditWritingArticle matches requests where the user may edit the referenced writing article.

func MatchCanPostWriting

func MatchCanPostWriting(r *http.Request, rm *mux.RouteMatch) bool

MatchCanPostWriting matches requests where the user may create an article in the referenced category.

func NewWritingsTask

func NewWritingsTask() tasks.Task

func Register

func Register(reg *router.Registry)

Register registers the writings router module.

func RegisterAdminRoutes

func RegisterAdminRoutes(ar *mux.Router)

RegisterAdminRoutes attaches writings admin endpoints to ar.

func RegisterRoutes

func RegisterRoutes(r *mux.Router, _ *config.RuntimeConfig) []navpkg.RouterOptions

RegisterRoutes attaches the public writings endpoints to r.

func RegisterTasks

func RegisterTasks() []tasks.NamedTask

RegisterTasks returns writing related tasks.

func RequireWritingAuthor

func RequireWritingAuthor(next http.Handler) http.Handler

RequireWritingAuthor ensures the requester may edit the writing referenced in the URL.

func RequireWritingViewAccess added in v0.0.211

func RequireWritingViewAccess(next http.Handler) http.Handler

RequireWritingViewAccess ensures the user has permission to view the article specified in the URL path. It sets the current thread and topic on success.

func RoleInfoByPermID added in v0.0.214

func RoleInfoByPermID(ctx context.Context, q db.Querier, id int32) (int32, string, string, error)

func RssPage

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

func SharedPreviewPage

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

SharedPreviewPage renders an OpenGraph preview for a writing article.

func UserCanCreateWriting

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

UserCanCreateWriting reports whether uid may publish an article in the category.

func WriterListPage

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

WriterListPage shows all writers with their article counts.

func WriterPage

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

func WritingCategoryWouldLoop added in v0.0.214

func WritingCategoryWouldLoop(ctx context.Context, queries db.Querier, cid, parentID int32) ([]int32, bool, error)

func WritingsCustomIndexItems

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

Deprecated/Wrapper

func WritingsGeneralIndexItems

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

func WritingsPage

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

func WritingsPageSpecificItems

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

Types

type CancelTask

type CancelTask struct{ tasks.TaskString }

CancelTask cancels comment editing.

func (CancelTask) Action

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

type CategoryGrantCreateTask

type CategoryGrantCreateTask struct{ tasks.TaskString }

CategoryGrantCreateTask creates a new grant for a writing category.

func (CategoryGrantCreateTask) Action

type CategoryGrantDeleteTask

type CategoryGrantDeleteTask struct{ tasks.TaskString }

CategoryGrantDeleteTask removes a grant from a writing category.

func (CategoryGrantDeleteTask) Action

type EditReplyTask

type EditReplyTask struct{ tasks.TaskString }

EditReplyTask updates an existing comment.

func (EditReplyTask) Action

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 MarkWritingReadTask

type MarkWritingReadTask struct{ tasks.TaskString }

MarkWritingReadTask clears the special new/unread flags for a writing and its thread.

func (MarkWritingReadTask) Action

type ReplyTask

type ReplyTask struct{ tasks.TaskString }

ReplyTask posts a comment reply.

func (ReplyTask) Action

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

func (ReplyTask) AutoSubscribeGrants

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

func (ReplyTask) AutoSubscribePath

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

func (ReplyTask) GrantsRequired

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

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 private labels on a writing.

func (SetLabelsTask) Action

type SubmitWritingTask

type SubmitWritingTask struct{ tasks.TaskString }

SubmitWritingTask encapsulates creating a new writing.

func (SubmitWritingTask) Action

func (SubmitWritingTask) GrantsRequired

func (SubmitWritingTask) Page

func (SubmitWritingTask) RequiredTemplates

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

func (SubmitWritingTask) SubscribedEmailTemplate

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

func (SubmitWritingTask) SubscribedInternalNotificationTemplate

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

type UpdateWritingTask

type UpdateWritingTask struct{ tasks.TaskString }

UpdateWritingTask applies changes to an article.

func (UpdateWritingTask) Action

func (UpdateWritingTask) GrantsRequired

func (UpdateWritingTask) Page

func (UpdateWritingTask) RequiredTemplates

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

func (UpdateWritingTask) SubscribedEmailTemplate

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

func (UpdateWritingTask) SubscribedInternalNotificationTemplate

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

type WritingCategoryChangeTask

type WritingCategoryChangeTask struct{ tasks.TaskString }

WritingCategoryChangeTask modifies a category.

func (WritingCategoryChangeTask) Action

type WritingCategoryCreateTask

type WritingCategoryCreateTask struct{ tasks.TaskString }

WritingCategoryCreateTask creates a new category.

func (WritingCategoryCreateTask) Action

Jump to

Keyboard shortcuts

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