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 source realm

Constants 1

const MaxBodyLen, MaxCommentLen, MaxPageLimit

1const (
2	MaxBodyLen    = 2000 // review body
3	MaxCommentLen = 1000 // comment body
4	MaxPageLimit  = 100  // hard cap on any paginated read (DoS guard)
5
6)
source

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

Functions 23

func AcceptOwnership

crossing Action
1func AcceptOwnership(cur realm)
source

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.

func CancelOwnershipTransfer

crossing Action
1func CancelOwnershipTransfer(cur realm)
source

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

func DeleteComment

crossing Action
1func DeleteComment(cur realm, commentID uint64)
source

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

func DeleteReview

crossing Action
1func DeleteReview(cur realm, reviewID uint64)
source

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.

func EditComment

crossing Action
1func EditComment(cur realm, commentID uint64, body string)
source

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

func EditReview

crossing Action
1func EditReview(cur realm, reviewID uint64, rating int, body string)
source

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

func Flag

crossing Action
1func Flag(cur realm, targetID uint64)
source

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.

func GetCommentsJSON

Action
1func GetCommentsJSON(reviewID uint64, offset, limit int) string
source

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

func GetFlaggedJSON

Action
1func GetFlaggedJSON(offset, limit int) string
source

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.

func GetReputation

Action
1func GetReputation(addr string) int64
source

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

func GetReviewsJSON

Action
1func GetReviewsJSON(subject string, offset, limit int) string
source

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

func GetSubjectSummaryJSON

Action
1func GetSubjectSummaryJSON(subject string) string
source

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.

func HideComment

crossing Action
1func HideComment(cur realm, id uint64)
source

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

func HideReview

crossing Action
1func HideReview(cur realm, id uint64)
source

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

func PostComment

crossing Action
1func PostComment(cur realm, reviewID uint64, body string)
source

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

func PostReview

crossing Action
1func PostReview(cur realm, subject string, rating int, body string)
source

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

func React

crossing Action
1func React(cur realm, targetID uint64, kind string)
source

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.

func Render

1func Render(path string) string
source

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

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, newModerator address)
source

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.

func Unhide

crossing Action
1func Unhide(cur realm, targetID uint64)
source

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.

func GetModerationState

Action
1func GetModerationState(id uint64) ModerationState
source

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

Types 3

type Comment

struct
 1type Comment struct {
 2	ID        uint64
 3	ReviewID  uint64
 4	Author    address
 5	Body      string // ≤ MaxCommentLen
 6	CreatedAt int64
 7	EditedAt  int64
 8	Hidden    bool
 9	Deleted   bool
10	Likes     uint64
11	Dislikes  uint64
12	FlagCount uint64
13}
source

type ModerationState

struct
 1type ModerationState struct {
 2	ID        uint64
 3	Review    bool
 4	ParentID  uint64
 5	Subject   string
 6	Author    address
 7	Rating    int
 8	BodyHash  string
 9	CreatedAt int64
10	EditedAt  int64
11	Hidden    bool
12	Deleted   bool
13	Flagged   bool
14}
source

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.

type Review

struct
 1type Review struct {
 2	ID        uint64
 3	Subject   string // g1… address OR realm path
 4	Author    address
 5	Rating    int    // 1..5
 6	Body      string // optional, ≤ MaxBodyLen
 7	CreatedAt int64  // block height
 8	EditedAt  int64  // block height of last edit (0 if never)
 9	Hidden    bool   // multisig soft-delete / auto-hide
10	Deleted   bool   // author tombstone
11	Likes     uint64
12	Dislikes  uint64
13	FlagCount uint64
14}
source

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

Imports 9

Source Files 5