diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-03 22:02:01 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-03 22:02:01 +0100 |
commit | f093be96e98284580d61664adecd0a2ff8b354e4 (patch) | |
tree | 9147553b5ee19a5e31988ea9d10bc5633338f593 | |
parent | 6343c8e611dfd7af86305d1e358f513dfb1e644b (diff) | |
download | git-bug-f093be96e98284580d61664adecd0a2ff8b354e4.tar.gz |
cache: don't store legacy identities IDs in bug excerpt as they are not reachable. Fix a panic
-rw-r--r-- | cache/bug_excerpt.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go index e053f9e4..36c7dcfe 100644 --- a/cache/bug_excerpt.go +++ b/cache/bug_excerpt.go @@ -61,14 +61,18 @@ func (l LegacyAuthorExcerpt) DisplayName() string { } func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt { - participantsIds := make([]entity.Id, len(snap.Participants)) - for i, participant := range snap.Participants { - participantsIds[i] = participant.Id() + participantsIds := make([]entity.Id, 0, len(snap.Participants)) + for _, participant := range snap.Participants { + if _, ok := participant.(*identity.Identity); ok { + participantsIds = append(participantsIds, participant.Id()) + } } - actorsIds := make([]entity.Id, len(snap.Actors)) - for i, actor := range snap.Actors { - actorsIds[i] = actor.Id() + actorsIds := make([]entity.Id, 0, len(snap.Actors)) + for _, actor := range snap.Actors { + if _, ok := actor.(*identity.Identity); ok { + actorsIds = append(actorsIds, actor.Id()) + } } e := &BugExcerpt{ |