aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-07-01 20:00:53 +0200
committerMichael Muré <batolettre@gmail.com>2020-10-04 20:50:15 +0200
commit499dbc0a032ff28eea99e5308be9b6c8f2d208ad (patch)
tree0ebfbc122240736292338275a5b599abaa7d710b /cache
parent5d1fc3ff393133a8aa67b97f9beecfe9b57c7e56 (diff)
downloadgit-bug-499dbc0a032ff28eea99e5308be9b6c8f2d208ad.tar.gz
identity: remove support for legacy identity
Diffstat (limited to 'cache')
-rw-r--r--cache/bug_excerpt.go12
-rw-r--r--cache/filter.go15
-rw-r--r--cache/repo_cache.go3
3 files changed, 7 insertions, 23 deletions
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go
index 631c13cb..6a9e7f75 100644
--- a/cache/bug_excerpt.go
+++ b/cache/bug_excerpt.go
@@ -26,6 +26,7 @@ type BugExcerpt struct {
CreateUnixTime int64
EditUnixTime int64
+ AuthorId entity.Id
Status bug.Status
Labels []bug.Label
Title string
@@ -33,12 +34,6 @@ type BugExcerpt struct {
Actors []entity.Id
Participants []entity.Id
- // 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 entity.Id
-
CreateMetadata map[string]string
}
@@ -94,11 +89,6 @@ func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
switch snap.Author.(type) {
case *identity.Identity, *IdentityCache:
e.AuthorId = snap.Author.Id()
- case *identity.Bare:
- e.LegacyAuthor = LegacyAuthorExcerpt{
- Login: snap.Author.Login(),
- Name: snap.Author.Name(),
- }
default:
panic("unhandled identity type")
}
diff --git a/cache/filter.go b/cache/filter.go
index 166cd48d..2ac56ab5 100644
--- a/cache/filter.go
+++ b/cache/filter.go
@@ -29,19 +29,12 @@ func AuthorFilter(query string) Filter {
return func(excerpt *BugExcerpt, resolver resolver) bool {
query = strings.ToLower(query)
- // Normal identity
- if excerpt.AuthorId != "" {
- author, err := resolver.ResolveIdentityExcerpt(excerpt.AuthorId)
- if err != nil {
- panic(err)
- }
-
- return author.Match(query)
+ author, err := resolver.ResolveIdentityExcerpt(excerpt.AuthorId)
+ if err != nil {
+ panic(err)
}
- // Legacy identity support
- return strings.Contains(strings.ToLower(excerpt.LegacyAuthor.Name), query) ||
- strings.Contains(strings.ToLower(excerpt.LegacyAuthor.Login), query)
+ return author.Match(query)
}
}
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index 51302932..4fc88015 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -19,7 +19,8 @@ import (
// 1: original format
// 2: added cache for identities with a reference in the bug cache
-const formatVersion = 2
+// 3: no more legacy identity
+const formatVersion = 3
// The maximum number of bugs loaded in memory. After that, eviction will be done.
const defaultMaxLoadedBugs = 1000