aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_excerpt.go
diff options
context:
space:
mode:
authorSladyn <gunnerforlife00@gmail.com>2019-03-02 23:58:15 +0530
committerSladyn <gunnerforlife00@gmail.com>2019-03-02 23:58:15 +0530
commitf1d5ca4ff4e8f20f21e2cdc65fe854d6f9c16fee (patch)
tree80384da7f761f836edc3668d391376109f388d06 /cache/bug_excerpt.go
parent0c42a7c33ef02cdb72b110b65e36e0e426c19359 (diff)
downloadgit-bug-f1d5ca4ff4e8f20f21e2cdc65fe854d6f9c16fee.tar.gz
Rebased and updated.
Diffstat (limited to 'cache/bug_excerpt.go')
-rw-r--r--cache/bug_excerpt.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go
index 86424a0a..a50d8c66 100644
--- a/cache/bug_excerpt.go
+++ b/cache/bug_excerpt.go
@@ -23,11 +23,16 @@ type BugExcerpt struct {
CreateUnixTime int64
EditUnixTime int64
- Title string
Status bug.Status
- Author identity.Interface
- LenComments int
Labels []bug.Label
+ Title string
+ LenComments int
+
+ // If author is identity.Bare, LegacyAuthor is set
+ // If author is identity.Identity, AuthorId is set and data is deported
+ // in a IdentityExcerpt
+ LegacyAuthor LegacyAuthorExcerpt
+ AuthorId string
CreateMetadata map[string]string
}
@@ -45,13 +50,25 @@ func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
EditLamportTime: b.EditLamportTime(),
CreateUnixTime: b.FirstOp().GetUnixTime(),
EditUnixTime: snap.LastEditUnix(),
- Title: snap.Title,
Status: snap.Status,
Labels: snap.Labels,
+ Title: snap.Title,
LenComments: len(snap.Comments),
CreateMetadata: b.FirstOp().AllMetadata(),
}
+ switch snap.Author.(type) {
+ case *identity.Identity:
+ e.AuthorId = snap.Author.Id()
+ case *identity.Bare:
+ e.LegacyAuthor = LegacyAuthorExcerpt{
+ Login: snap.Author.Login(),
+ Name: snap.Author.Name(),
+ }
+ default:
+ panic("unhandled identity type")
+ }
+
return e
}