shroom

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CanDelete = canFactory(
		rejectDeleteLog,
		"delete-confirm",
		nil,
		"Not enough rights to delete, you must be a moderator",
		"Cannot delete this hypha because it does not exist",
		true,
	)

	CanRename = canFactory(
		rejectRenameLog,
		"rename-confirm",
		nil,
		"Not enough rights to rename, you must be a trusted editor",
		"Cannot rename this hypha because it does not exist",
		true,
	)

	CanUnattach = canFactory(
		rejectUnattachLog,
		"unattach-confirm",
		func(h *hyphae.Hypha, u *user.User) (errmsg, errtitle string) {
			if h.BinaryPath == "" {
				rejectUnattachLog(h, u, "no amnt")
				return "Cannot unattach this hypha because it has no attachment", "No attachment"
			}

			return "", ""
		},
		"Not enough rights to unattach, you must be a trusted editor",
		"Cannot unattach this hypha because it does not exist",
		true,
	)

	CanEdit = canFactory(
		rejectEditLog,
		"upload-text",
		nil,
		"You must be an editor to edit a hypha",
		"You cannot edit a hypha that does not exist",
		false,
	)

	CanAttach = canFactory(
		rejectAttachLog,
		"upload-binary",
		nil,
		"You must be an editor to attach a hypha",
		"You cannot attach a hypha that does not exist",
		false,
	)
)

Functions

func DeleteHypha

func DeleteHypha(u *user.User, h *hyphae.Hypha) (hop *history.HistoryOp, errtitle string)

DeleteHypha deletes hypha and makes a history record about that.

func FetchTextPart

func FetchTextPart(h *hyphae.Hypha) (string, error)

FetchTextPart tries to read text file of the given hypha. If there is no file, empty string is returned.

func RenameHypha

func RenameHypha(h *hyphae.Hypha, newHypha *hyphae.Hypha, recursive bool, u *user.User) (hop *history.HistoryOp, errtitle string)

RenameHypha renames hypha from old name `hyphaName` to `newName` and makes a history record about that. If `recursive` is `true`, its subhyphae will be renamed the same way.

func SetHeaderLinks()

func UnattachHypha

func UnattachHypha(u *user.User, h *hyphae.Hypha) (hop *history.HistoryOp, errtitle string)

UnattachHypha unattaches hypha and makes a history record about that.

func UploadBinary

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

func UploadText

func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User) (hop *history.HistoryOp, errtitle string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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