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

Constants 1

const MaxBodyLen, MaxCommentLen, MaxPageLimit, ModeratorAddress

1const (
2	MaxBodyLen    = 2000 // review body
3	MaxCommentLen = 1000 // comment body
4	MaxPageLimit  = 100  // hard cap on any paginated read (DoS guard)
5
6	// Memba moderator multisig (samcrew-core-test1 on testnet). CONFIRM before deploy.
7	ModeratorAddress = "g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0"
8)
source

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

Functions 17

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.

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 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.

Types 2

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

Source Files 2