postops

package
v0.0.0-...-d6dfe19 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanPromptNow

func CanPromptNow(ctx context.Context, exec boil.ContextExecutor, askerID string) error

func CanSeePost

func CanSeePost(p *core.Post, radius userops.ConnectionRadius) bool

func DeletePost

func DeletePost(ctx context.Context, exec boil.ContextExecutor, postID string) error

func PostSubject

func PostSubject(subject null.String) string

func SerializeBlog

func SerializeBlog(ctx context.Context, exec boil.ContextExecutor, mediaStorage server.MediaStorage, userID string, m ...qm.QueryMod) ([]byte, error)

func SerializeBlogSlice

func SerializeBlogSlice(ctx context.Context, posts []*core.Post, mediaStorage server.MediaStorage) ([]byte, error)

func SerializePost

func SerializePost(post *core.Post) []byte

func StoreURL

func StoreURL(ctx context.Context, exec boil.ContextExecutor, rawURL string) (*core.NormalizedURL, error)

StoreURL normalizes the given URL and stores it in the normalized_urls table, handling the case where the URL already exists using upsert. Returns the URL struct and any error.

Types

type AdditionalFields

type AdditionalFields struct {
	URL string
}

func DeserializePost

func DeserializePost(b []byte) (*core.Post, *AdditionalFields, error)

type Comment

type Comment struct {
	*core.PostComment
	Author       *core.User
	Post         *Post
	Capabilities *CommentCapabilities
	Level        int64
}

func ConstructComments

func ConstructComments(comments core.PostCommentSlice, radius userops.ConnectionRadius) []*Comment

func (*Comment) String

func (c *Comment) String() string

type CommentCapabilities

type CommentCapabilities struct {
	CanRespond bool
}

type ExportField

type ExportField string
const (
	OriginalID  ExportField = "original_id"
	Subject     ExportField = "subject"
	Url         ExportField = "url"
	Visibility  ExportField = "visibility"
	PublishDate ExportField = "published"
)

type InjectStats

type InjectStats struct {
	PostsCreated   int
	PostsUpdated   int
	ImagesUploaded int
	ImagesSkipped  int
}

func InjectPostsInDB

func InjectPostsInDB(ctx context.Context, exec boil.ContextExecutor, mediaStorage server.MediaStorage, userID string, posts []*PostWithMeta, images map[string][]byte) (*InjectStats, error)

type Post

type Post struct {
	*core.Post
	LinkedURL      *core.NormalizedURL
	Author         *core.User
	Via            []*core.User
	Capabilities   *PostCapabilities
	CommentsNumber int64
	Comments       []*Comment
	Radius         userops.ConnectionRadius
	EditPreview    bool
}

func ConstructPost

func ConstructPost(user *core.User, post *core.Post, radius userops.ConnectionRadius, via []*core.User, editPreview bool) *Post

func (*Post) IsPublished

func (p *Post) IsPublished() bool

func (*Post) PostSubject

func (p *Post) PostSubject() string

type PostCapabilities

type PostCapabilities struct {
	CanViewComments  bool
	CanLeaveComments bool
	CanEdit          bool
	CanShare         bool
}

func GetPostCapabilities

func GetPostCapabilities(radius userops.ConnectionRadius) *PostCapabilities

type PostPrompt

type PostPrompt struct {
	Prompt *core.PostPrompt
	Author *core.User
	Post   *core.Post
}

func GetPostPrompt

func GetPostPrompt(ctx context.Context, db boil.ContextExecutor, q ...qm.QueryMod) (*PostPrompt, error)

type PostWithMeta

type PostWithMeta struct {
	Post       *core.Post
	Additional *AdditionalFields
}

func DeserializeArchive

func DeserializeArchive(b []byte) ([]*PostWithMeta, map[string][]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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