shroom

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package shroom provides utilities for hypha manipulation.

Some of them are wrappers around functions provided by package hyphae. They manage history for you.

Index

Constants

This section is empty.

Variables

View Source
var (
	CanEdit = canFactory(
		rejectEditLog,
		"upload-text",
		nil,
		"ui.act_norights_edit",
		"You cannot edit a hypha that does not exist",
		false,
	)

	CanAttach = canFactory(
		rejectUploadMediaLog,
		"upload-binary",
		nil,
		"ui.act_norights_media",
		"You cannot attach a hypha that does not exist",
		false,
	)
)

CanDelete and etc are hyphae operation checkers based on user rights and hyphae existence.

Functions

func Delete added in v1.9.0

func Delete(u *user.User, h hyphae.ExistingHypha) error

Delete deletes the hypha and makes a history record about that.

func RemoveMedia added in v1.9.0

func RemoveMedia(u *user.User, h *hyphae.MediaHypha) error

RemoveMedia removes media from the media hypha and makes a history record about that. If it only had media, the hypha will be deleted. If it also had text, the hypha will become textual.

func Rename added in v1.9.0

func Rename(oldHypha hyphae.ExistingHypha, newName string, recursive bool, leaveRedirections bool, u *user.User) error

Rename renames the old hypha to the new name and makes a history record about that. Call if and only if the user has the permission to rename.

func SetHeaderLinks()

SetHeaderLinks initializes header links by reading the configured hypha, if there is any, or resorting to default values.

func UploadBinary

func UploadBinary(h hyphae.Hypha, mime string, file multipart.File, u *user.User) error

UploadBinary edits the hypha's media part and makes a history record about that.

func UploadText

func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User) error

UploadText edits the hypha's text part and makes a history record about that.

func YieldHyphaNamesContainingString added in v1.3.0

func YieldHyphaNamesContainingString(query string) <-chan string

YieldHyphaNamesContainingString picks hyphae with have a string in their title, sorts and iterates over them in alphabetical order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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