got: future proof for switch to authenticated_user

This commit is contained in:
Aaron Bieber 2024-04-30 10:31:56 -06:00
parent 95fea0358e
commit ffc827c2f6
No known key found for this signature in database

29
got.go
View File

@ -41,23 +41,28 @@ type Diffstat struct {
Total Total `json:"total"` Total Total `json:"total"`
} }
type Notification struct { type Notification struct {
Type string `json:"type"` Type string `json:"type"`
Short bool `json:"short"` Short bool `json:"short"`
Repo string `json:"repo"` Repo string `json:"repo"`
AuthUser string `json:"auth_user"` AuthUser string `json:"auth_user"`
ID string `json:"id"` AuthenticatedUser string `json:"authenticated_user"`
Author Author `json:"author,omitempty"` ID string `json:"id"`
Committer Committer `json:"committer"` Author Author `json:"author,omitempty"`
Date int `json:"date"` Committer Committer `json:"committer"`
ShortMessage string `json:"short_message"` Date int `json:"date"`
Message string `json:"message"` ShortMessage string `json:"short_message"`
Diffstat Diffstat `json:"diffstat,omitempty"` Message string `json:"message"`
Diffstat Diffstat `json:"diffstat,omitempty"`
} }
func (n *Notification) String() string { func (n *Notification) String() string {
// op committed got.git f9e653700..f9e653700^1 (main): fix gotd_parse_url() (https://git.gameoftrees.org/gitweb/?p=got.git;a=commitdiff;h=f9e653700) // op committed got.git f9e653700..f9e653700^1 (main): fix gotd_parse_url() (https://git.gameoftrees.org/gitweb/?p=got.git;a=commitdiff;h=f9e653700)
user := n.AuthenticatedUser
if user == "" {
user = n.AuthUser
}
return fmt.Sprintf("%s committed %s %s: %s (%s)", return fmt.Sprintf("%s committed %s %s: %s (%s)",
n.AuthUser, user,
n.Repo, n.Repo,
n.ID, n.ID,
n.ShortMessage, n.ShortMessage,