Monorepo for Tangled
tangled.org
1package models
2
3import "time"
4
5type TimelineEvent struct {
6 *Repo
7 *Follow
8 *RepoStar
9
10 EventAt time.Time
11
12 // optional: populate only if Repo is a fork
13 Source *Repo
14
15 // optional: populate only if event is Follow
16 *Profile
17 *FollowStats
18 *FollowStatus
19
20 // optional: populate only if event is Repo
21 IsStarred bool
22 StarCount int64
23}
24
25// TimelineGroup is a primary TimelineEvent plus zero or more peer events
26// that share the same operation+target (same repo starred, same user
27// followed) and arrived consecutively. Primary is the newest of the group;
28// Others holds the older peers in descending order. For non-collapsible
29// events (repo create) Others is always empty.
30type TimelineGroup struct {
31 Primary TimelineEvent
32 Others []TimelineEvent
33}
34
35func (g TimelineGroup) IsCollapsed() bool {
36 return len(g.Others) > 0
37}
38
39func (g TimelineGroup) OthersCount() int {
40 return len(g.Others)
41}