Documentation
¶
Overview ¶
Package reactions owns the M4 "reactions" plugin. It aggregates the per-emoji reaction content on the user's issues + issue comments via GraphQL and renders the upstream 8-emoji gauge panel.
Upstream (lowlighter/metrics) additionally covers discussions and discussion comments; those arms require extra scopes / a separate query surface and are deferred. The two issue-side sources reproduce the same gauge layout and per-content aggregation.
Index ¶
Constants ¶
const Name = "reactions"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &reactionsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the reactions plugin. Mirrors upstream org_repo/source/templates/classic/partials/reactions.ejs.
It always renders the 8-category emoji gauge panel: one `<div class="category column">` per reaction with a `<svg class="gauge info">` circle (plus a `gauge-arc` when score > 0), the emoji as a `<text>` inside the gauge, and an optional `title nowrap` detail span driven by plugin_reactions_details.
Types ¶
type Reaction ¶ added in v1.1.0
type Reaction struct {
// Value is the raw number of reactions with this content.
Value int `json:"value"`
// Percentage is value / total reactions (absolute share).
Percentage float64 `json:"percentage"`
// Score drives the gauge arc: value / total in "absolute" display
// mode, or value / max in "relative" display mode.
Score float64 `json:"score"`
}
Reaction is the per-content aggregate published for one emoji category. Mirrors upstream's `list[content]` entry.
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
// List is the per-content aggregate keyed by the GraphQL
// ReactionContent enum (HEART, THUMBS_UP, ...).
List map[string]Reaction `json:"list"`
// Total is the total number of reactions collected.
Total int `json:"total"`
// Comments is the number of comments scanned (drives the header).
Comments int `json:"comments"`
// Details mirrors upstream `plugin_reactions_details`: the ordered
// detail fields to render under each gauge (count / percentage).
Details []string `json:"details,omitempty"`
// Days is the comment maximum age (0 = disabled).
Days int `json:"days"`
}
Result is the JSON payload published under data.Plugins["reactions"].