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_v2 state

Back to all declarations

moderator

.uverse.address

Value

<gnolang.StringValue>

pendingModerator

.uverse.address

Value

<zero>

TransferOwnership

func(newModerator .uverse.address)

TransferOwnership stages a handoff of the moderator role. Moderator only; it takes effect only once newModerator calls AcceptOwnership. Calling it again before acceptance replaces the staged address, which is how a mistyped proposal is corrected.

Open
OID
0ad747…5fed:5
TransferOwnership details

Inspect func

AcceptOwnership

func()

AcceptOwnership completes the handoff. Only the staged pendingModerator may call it — including against the outgoing moderator, so the two steps cannot be collapsed into one by the party giving up the role.

Open
OID
0ad747…5fed:7
AcceptOwnership details

Inspect func

CancelOwnershipTransfer

func()

CancelOwnershipTransfer clears a staged handoff. Moderator only, so a proposal can be aborted without the proposed address cooperating.

Open
OID
0ad747…5fed:8
CancelOwnershipTransfer details

Inspect func

GetModerator

func() string

GetModerator returns the address that currently holds moderation.

Open
OID
0ad747…5fed:9
GetModerator details

Inspect func

GetPendingModerator

func() string

GetPendingModerator returns the staged successor ("" when none).

Open
OID
0ad747…5fed:10
GetPendingModerator details

Inspect func

assertModeratorCur

func()

assertModeratorCur is the gate for this file's entrypoints. Named apart from the realm's existing assertModerator so the older call sites keep their signature and semantics untouched.

Open
OID
0ad747…5fed:11
assertModeratorCur details

Inspect func

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)

Review

type

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

Value

memba_reviews_v2.Review

Comment

type

Value

memba_reviews_v2.Comment

comments

*avl.Tree

// strID(id) -> \*Comment

Open
OID
0ad747…5fed:73
comments details

Inspect pointer

subjectIndex

*avl.Tree

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

Open
OID
0ad747…5fed:75
subjectIndex details

Inspect pointer

commentIndex

*avl.Tree

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

Open
OID
0ad747…5fed:77
commentIndex details

Inspect pointer

authorSubject

*avl.Tree

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

Open
OID
0ad747…5fed:79
authorSubject details

Inspect pointer

reactions

*avl.Tree

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

Open
OID
0ad747…5fed:81
reactions details

Inspect pointer

flags

*avl.Tree

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

Open
OID
0ad747…5fed:83
flags details

Inspect pointer

reputation

*avl.Tree

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

Open
OID
0ad747…5fed:85
reputation details

Inspect pointer

flaggedIDs

*avl.Tree

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

Open
OID
0ad747…5fed:87
flaggedIDs details

Inspect pointer

subjStatCount

*avl.Tree

// subject -> int64 (# visible reviews)

Open
OID
0ad747…5fed:89
subjStatCount details

Inspect pointer

subjStatSum

*avl.Tree

// subject -> int64 (Σ rating over visible reviews)

Open
OID
0ad747…5fed:91
subjStatSum details

Inspect pointer

nextID

uint64

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

Value

1

getStat

func(t *avl.Tree, subject string) int64

── RV-1 subject-stat counters (O(1) summary) ────────────────

Open
OID
0ad747…5fed:26
getStat details

Inspect func

applySubjectStat

func(subject string, dCount int64, dSum int64)

applySubjectStat adjusts the visible-review counters for a subject. Callers apply a delta only when a review's \*counted\* state (visible = !Deleted && !Hidden) actually changes.

Open
OID
0ad747…5fed:27
applySubjectStat details

Inspect func

strID

func(id uint64) string

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

Open
OID
0ad747…5fed:28
strID details

Inspect func

getReview

func(id uint64) (*memba_reviews_v2.Review, bool)
Open
OID
0ad747…5fed:29
getReview details

Inspect func

getComment

func(id uint64) (*memba_reviews_v2.Comment, bool)
Open
OID
0ad747…5fed:30
getComment details

Inspect func

getReputation

func(addr string) int64
Open
OID
0ad747…5fed:32
getReputation details

Inspect func

addReputation

func(addr string, delta int64)
Open
OID
0ad747…5fed:33
addReputation details

Inspect func

idList

func(t *avl.Tree, key string) []uint64
Open
OID
0ad747…5fed:34
idList details

Inspect func

removeID

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

removeID returns ids with the first occurrence of target removed.

Open
OID
0ad747…5fed:35
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
0ad747…5fed:36
sanitizeForRender details

Inspect func

jsonEscape

func(s string) string

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

Open
OID
0ad747…5fed:37
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
0ad747…5fed:40
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
0ad747…5fed:41
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
0ad747…5fed:42
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
0ad747…5fed:43
DeleteReview details

Inspect func

validComment

func(b string) bool

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

Open
OID
0ad747…5fed:44
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
0ad747…5fed:45
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
0ad747…5fed:46
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
0ad747…5fed:47
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
0ad747…5fed:49
reactionDelta details

Inspect func

applyDelta

func(v uint64, delta int) uint64

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

Open
OID
0ad747…5fed:50
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
0ad747…5fed:51
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
0ad747…5fed:52
Flag details

Inspect func

HideReview

func(id uint64)

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

Open
OID
0ad747…5fed:53
HideReview details

Inspect func

HideComment

func(id uint64)

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

Open
OID
0ad747…5fed:54
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
0ad747…5fed:55
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
0ad747…5fed:56
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
0ad747…5fed:57
window details

Inspect func

reviewJSON

func(r *memba_reviews_v2.Review) string
Open
OID
0ad747…5fed:58
reviewJSON details

Inspect func

commentJSON

func(c *memba_reviews_v2.Comment) string
Open
OID
0ad747…5fed:59
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
0ad747…5fed:60
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
0ad747…5fed:61
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. GetSubjectSummaryJSON returns the count/average/sum of a subject's VISIBLE reviews. RV-1: O(1) — reads the maintained per-subject counters instead of scanning the (sybil- growable) review list, so it can never exceed the query gas cap.

Open
OID
0ad747…5fed:62
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
0ad747…5fed:63
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
0ad747…5fed:64
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
0ad747…5fed:65
Render details

Inspect func

ModerationState

type

ModerationState is a bounded copied snapshot, including hidden/deleted items. No pointer or body is exposed. BodyHash binds edits even within the same block. Reactions and cumulative flag counts are not moderation authorization inputs.

Value

memba_reviews_v2.ModerationState

moderationBodyHash

func(body string) string
Open
OID
0ad747…5fed:66
moderationBodyHash details

Inspect func

GetModerationState

func(id uint64) memba_reviews_v2.ModerationState

GetModerationState returns a zero value for an absent ID. The flagged-index bit is distinct from historical flags; Unhide removes only the index entry.

Open
OID
0ad747…5fed:68
GetModerationState details

Inspect func

publisherAtLoad

func() .uverse.address
Open
OID
0ad747…5fed:69
publisherAtLoad details

Inspect func
moderator : .uverse.address =<gnolang.StringValue>
pendingModerator : .uverse.address =<zero>
TransferOwnership : func(newModerator .uverse.address) Inspect
AcceptOwnership : func() Inspect
CancelOwnershipTransfer : func() Inspect
GetModerator : func() string Inspect
GetPendingModerator : func() string Inspect
assertModeratorCur : func() Inspect
MaxBodyLen : untyped bigint =(2000 <untyped> bigint)
MaxCommentLen : untyped bigint =(1000 <untyped> bigint)
MaxPageLimit : untyped bigint =(100 <untyped> bigint)
Review : type =memba_reviews_v2.Review
Comment : type =memba_reviews_v2.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
subjStatCount : *avl.Tree Inspect
subjStatSum : *avl.Tree Inspect
nextID : uint64 =1
init.25 : func() Inspect
getStat : func(t *avl.Tree, subject string) int64 Inspect
applySubjectStat : func(subject string, dCount int64, dSum int64) Inspect
strID : func(id uint64) string Inspect
getReview : func(id uint64) (*memba_reviews_v2.Review, bool) Inspect
getComment : func(id uint64) (*memba_reviews_v2.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_v2.Review) string Inspect
commentJSON : func(c *memba_reviews_v2.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
ModerationState : type =memba_reviews_v2.ModerationState
moderationBodyHash : func(body string) string Inspect
GetModerationState : func(id uint64) memba_reviews_v2.ModerationState Inspect
publisherAtLoad : func() .uverse.address Inspect