Documentation
¶
Overview ¶
Package activity owns the M4 "activity" plugin. It walks the user's public events feed (REST /users/<login>/events) and surfaces a typed timeline of recent activity for the classic SVG.
Index ¶
Constants ¶
const Name = "activity"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &activityPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the activity plugin. Mirrors upstream org_repo/source/templates/classic/partials/activity.ejs.
Output structure:
<section data-section="activity">
<h2 class="field"><svg pulse/>Recent activity</h2>
<div class="row"><section>
[for each event]:
<div class="row fill-width">
<section class="activity">
<div class="field"><svg/>${verb} in <span class="repo">${repo}</span></div>
<div class="timestamp">${date}</div>
</section>
</div>
</section></div>
</section>
Each per-event row is HTML (not bare <text> / <svg> primitives) so it renders inside the classic template's foreignObject (fixes the v1.0.0 bare-element invisibility bug).
Types ¶
type ActivityEvent ¶
type ActivityEvent struct {
Type string `json:"type"`
Repo string `json:"repo"`
Date time.Time `json:"date"`
Visibility string `json:"visibility"`
// Files and Lines carry pull-request diff stats for
// PullRequestEvent entries, mirroring upstream
// data.plugins.activity.events[].{files,lines}. They stay nil for
// event types that do not expose diff stats so the template can
// decide whether to render the "N files changed ++A --D" line.
Files *EventFiles `json:"files,omitempty"`
Lines *EventLines `json:"lines,omitempty"`
}
ActivityEvent mirrors one entry from the upstream events array.
type EventFiles ¶ added in v1.1.0
type EventFiles struct {
Changed int `json:"changed"`
}
EventFiles mirrors upstream event.files (PR change counts).
type EventLines ¶ added in v1.1.0
EventLines mirrors upstream event.lines (PR additions/deletions).
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
Mode string `json:"mode,omitempty"`
Events []ActivityEvent `json:"events"`
Days int `json:"days"`
}
Result is the JSON payload the plugin publishes under data.Plugins["activity"]. Field set mirrors upstream data.plugins.activity.