Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

memba_reviews_v1 state

Back to all declarations

MaxBodyLen

untyped bigint

// review body

Value

(2000 <untyped> bigint)

MaxCommentLen

untyped bigint

// comment body

Value

(1000 <untyped> bigint)

MaxPageLimit

untyped bigint

// hard cap on any paginated read (DoS guard)

Value

(100 <untyped> bigint)

ModeratorAddress

untyped string

── Constants ────────────────────────────────────────────────

Value

"g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0"

Review

type

── Types ────────────────────────────────────────────────────

Value

memba_reviews_v1.Review

Comment

type

Value

memba_reviews_v1.Comment

comments

*avl.Tree

// strID(id) -> \*Comment

Open
OID
074f6e…fc00:55
comments details

Inspect pointer

subjectIndex

*avl.Tree

// subject -> \[]uint64 (review IDs, ascending) — bounds reads

Open
OID
074f6e…fc00:57
subjectIndex details

Inspect pointer

commentIndex

*avl.Tree

// strID(reviewID) -> \[]uint64 (comment IDs, ascending)

Open
OID
074f6e…fc00:59
commentIndex details

Inspect pointer

authorSubject

*avl.Tree

// subject + "\\x00" + author -> uint64 (reviewID) — one-per-pair

Open
OID
074f6e…fc00:61
authorSubject details

Inspect pointer

reactions

*avl.Tree

// strID(targetID) + "/" + addr -> "like"|"dislike"

Open
OID
074f6e…fc00:63
reactions details

Inspect pointer

flags

*avl.Tree

// strID(targetID) + "/" + addr -> true (one flag per acct/target)

Open
OID
074f6e…fc00:65
flags details

Inspect pointer

reputation

*avl.Tree

// addr -> int64 (Σ likes−dislikes on their reviews+comments)

Open
OID
074f6e…fc00:67
reputation details

Inspect pointer

flaggedIDs

*avl.Tree

// strID(targetID) -> true (visible targets with ≥1 flag, for the mod dashboard)

Open
OID
074f6e…fc00:69
flaggedIDs details

Inspect pointer

nextID

uint64

── State ────────────────────────────────────────────────────

Value

1

strID

func(id uint64) string

── Helpers ──────────────────────────────────────────────────

Open
OID
074f6e…fc00:15
strID details

Inspect func

getReview

func(id uint64) (*memba_reviews_v1.Review, bool)
Open
OID
074f6e…fc00:16
getReview details

Inspect func

getComment

func(id uint64) (*memba_reviews_v1.Comment, bool)
Open
OID
074f6e…fc00:17
getComment details

Inspect func

getReputation

func(addr string) int64
Open
OID
074f6e…fc00:19
getReputation details

Inspect func

addReputation

func(addr string, delta int64)
Open
OID
074f6e…fc00:20
addReputation details

Inspect func

idList

func(t *avl.Tree, key string) []uint64
Open
OID
074f6e…fc00:21
idList details

Inspect func

removeID

func(ids []uint64, target uint64) []uint64

removeID returns ids with the first occurrence of target removed.

Open
OID
074f6e…fc00:22
removeID details

Inspect func

sanitizeForRender

func(s string) string

sanitizeForRender strips markdown/HTML-sensitive chars from user strings used inside Render() markdown (defense-in-depth; the frontend also DOMPurifies). "&" is escaped FIRST to prevent entity-injection (e.g. "&lt;" → "&amp;lt;").

Open
OID
074f6e…fc00:23
sanitizeForRender details

Inspect func

jsonEscape

func(s string) string

jsonEscape escapes a string for embedding in the realm's hand-built JSON.

Open
OID
074f6e…fc00:24
jsonEscape details

Inspect func

pairKey

func(subject string, a .uverse.address) string

pairKey returns the authorSubject tree key for a (subject, author) pair. The NUL separator prevents prefix collisions between subject and author.

Open
OID
074f6e…fc00:27
pairKey details

Inspect func

PostReview

func(subject string, rating int, body string)

PostReview creates the caller's review for \`subject\`, or replaces it in place if one already exists (the "one editable review per pair" rule).

Open
OID
074f6e…fc00:28
PostReview details

Inspect func

EditReview

func(reviewID uint64, rating int, body string)

EditReview updates rating + body of an existing non-deleted review. Only the original author may edit.

Open
OID
074f6e…fc00:29
EditReview details

Inspect func

DeleteReview

func(reviewID uint64)

DeleteReview tombstones the caller's review: keeps the ID + reaction history, clears the body, and frees the (author, subject) pair for a fresh review. Only the original author may delete.

Open
OID
074f6e…fc00:30
DeleteReview details

Inspect func

validComment

func(b string) bool

validComment returns true iff body is non-empty and within MaxCommentLen.

Open
OID
074f6e…fc00:31
validComment details

Inspect func

PostComment

func(reviewID uint64, body string)

PostComment posts a flat reply to an existing, non-deleted, non-hidden review.

Open
OID
074f6e…fc00:32
PostComment details

Inspect func

EditComment

func(commentID uint64, body string)

EditComment updates the body of an existing, non-deleted comment. Only the original author may edit.

Open
OID
074f6e…fc00:33
EditComment details

Inspect func

DeleteComment

func(commentID uint64)

DeleteComment tombstones the caller's comment: clears the body. Only the original author may delete.

Open
OID
074f6e…fc00:34
DeleteComment details

Inspect func

reactionDelta

func(old string, newKind string) (likesDelta int, dislikesDelta int, repDelta int)

reactionDelta returns how a reaction change (old -> newKind, each "" | "like" | "dislike") moves the target's like count, dislike count, and the target author's reputation. repDelta = likesDelta - dislikesDelta.

Open
OID
074f6e…fc00:36
reactionDelta details

Inspect func

applyDelta

func(v uint64, delta int) uint64

applyDelta adjusts an unsigned counter by ±1-style delta without underflow.

Open
OID
074f6e…fc00:37
applyDelta details

Inspect func

React

func(targetID uint64, kind string)

React records or toggles a like/dislike on a review or comment. Re-reacting with the same kind toggles it off; switching kind replaces it. Updates the target's Likes/Dislikes counters and the author's reputation by Δ(likes−dislikes). Self-reactions are rejected. Deleted/hidden targets are rejected.

Open
OID
074f6e…fc00:38
React details

Inspect func

Flag

func(targetID uint64)

Flag records one community flag per account per target (review or comment). Auto-hide is NOT performed here; takedowns are multisig-only (HideReview/HideComment). Deleted/hidden targets are rejected.

Open
OID
074f6e…fc00:39
Flag details

Inspect func

HideReview

func(id uint64)

HideReview soft-deletes a review. Moderator (multisig) only.

Open
OID
074f6e…fc00:40
HideReview details

Inspect func

HideComment

func(id uint64)

HideComment soft-deletes a comment. Moderator (multisig) only.

Open
OID
074f6e…fc00:41
HideComment details

Inspect func

Unhide

func(targetID uint64)

Unhide reverses a hide (manual or auto-flag) on a review or comment. Moderator (multisig) only. Also removes the target from the mod dashboard index.

Open
OID
074f6e…fc00:42
Unhide details

Inspect func

clampLimit

func(limit int) int

clampLimit ensures limit is in \[1, MaxPageLimit]. Zero or negative values and values above MaxPageLimit are all clamped to MaxPageLimit.

Open
OID
074f6e…fc00:43
clampLimit details

Inspect func

window

func(ids []uint64, offset int, limit int) []uint64

window slices ids\[offset : offset+limit] safely (no panics on out-of-range).

Open
OID
074f6e…fc00:44
window details

Inspect func

reviewJSON

func(r *memba_reviews_v1.Review) string
Open
OID
074f6e…fc00:45
reviewJSON details

Inspect func

commentJSON

func(c *memba_reviews_v1.Comment) string
Open
OID
074f6e…fc00:46
commentJSON details

Inspect func

GetReviewsJSON

func(subject string, offset int, limit int) string

GetReviewsJSON returns a JSON array of a subject's non-hidden reviews (paginated). Deleted reviews are included as tombstones (empty body, deleted:true).

Open
OID
074f6e…fc00:47
GetReviewsJSON details

Inspect func

GetCommentsJSON

func(reviewID uint64, offset int, limit int) string

GetCommentsJSON returns a JSON array of a review's non-hidden comments (paginated).

Open
OID
074f6e…fc00:48
GetCommentsJSON details

Inspect func

GetSubjectSummaryJSON

func(subject string) string

GetSubjectSummaryJSON returns {"count":N,"average":A,"sum":S} over non-hidden, non-deleted reviews for a subject. Average is integer-rounded.

Open
OID
074f6e…fc00:49
GetSubjectSummaryJSON details

Inspect func

GetReputation

func(addr string) int64

GetReputation returns the net likes−dislikes reputation for an address. Returns 0 for unknown addresses. Queried via vm/qeval (bare int64).

Open
OID
074f6e…fc00:50
GetReputation details

Inspect func

GetFlaggedJSON

func(offset int, limit int) string

GetFlaggedJSON returns a JSON array of flagged target IDs for the mod dashboard, paginated. IDs are returned as bare integers (not quoted strings). Uses early-stop iteration to avoid loading the entire tree.

Open
OID
074f6e…fc00:51
GetFlaggedJSON details

Inspect func

Render

func(path string) string

Render — human gnoweb view. "" → home (total count); "s/\<subject>" → subject review list; else 404.

Open
OID
074f6e…fc00:52
Render details

Inspect func
MaxBodyLen : untyped bigint =(2000 <untyped> bigint)
MaxCommentLen : untyped bigint =(1000 <untyped> bigint)
MaxPageLimit : untyped bigint =(100 <untyped> bigint)
ModeratorAddress : untyped string ="g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0"
Review : type =memba_reviews_v1.Review
Comment : type =memba_reviews_v1.Comment
reviews : *avl.Tree Inspect
comments : *avl.Tree Inspect
subjectIndex : *avl.Tree Inspect
commentIndex : *avl.Tree Inspect
authorSubject : *avl.Tree Inspect
reactions : *avl.Tree Inspect
flags : *avl.Tree Inspect
reputation : *avl.Tree Inspect
flaggedIDs : *avl.Tree Inspect
nextID : uint64 =1
init.16 : func() Inspect
strID : func(id uint64) string Inspect
getReview : func(id uint64) (*memba_reviews_v1.Review, bool) Inspect
getComment : func(id uint64) (*memba_reviews_v1.Comment, bool) Inspect
assertModerator : func() Inspect
getReputation : func(addr string) int64 Inspect
addReputation : func(addr string, delta int64) Inspect
idList : func(t *avl.Tree, key string) []uint64 Inspect
removeID : func(ids []uint64, target uint64) []uint64 Inspect
sanitizeForRender : func(s string) string Inspect
jsonEscape : func(s string) string Inspect
validRating : func(r int) bool Inspect
validBody : func(b string) bool Inspect
pairKey : func(subject string, a .uverse.address) string Inspect
PostReview : func(subject string, rating int, body string) Inspect
EditReview : func(reviewID uint64, rating int, body string) Inspect
DeleteReview : func(reviewID uint64) Inspect
validComment : func(b string) bool Inspect
PostComment : func(reviewID uint64, body string) Inspect
EditComment : func(commentID uint64, body string) Inspect
DeleteComment : func(commentID uint64) Inspect
boolToInt : func(b bool) int Inspect
reactionDelta : func(old string, newKind string) (likesDelta int, dislikesDelta int, repDelta int) Inspect
applyDelta : func(v uint64, delta int) uint64 Inspect
React : func(targetID uint64, kind string) Inspect
Flag : func(targetID uint64) Inspect
HideReview : func(id uint64) Inspect
HideComment : func(id uint64) Inspect
Unhide : func(targetID uint64) Inspect
clampLimit : func(limit int) int Inspect
window : func(ids []uint64, offset int, limit int) []uint64 Inspect
reviewJSON : func(r *memba_reviews_v1.Review) string Inspect
commentJSON : func(c *memba_reviews_v1.Comment) string Inspect
GetReviewsJSON : func(subject string, offset int, limit int) string Inspect
GetCommentsJSON : func(reviewID uint64, offset int, limit int) string Inspect
GetSubjectSummaryJSON : func(subject string) string Inspect
GetReputation : func(addr string) int64 Inspect
GetFlaggedJSON : func(offset int, limit int) string Inspect
Render : func(path string) string Inspect