aboutsummaryrefslogtreecommitdiffstats
path: root/bug/identity.go
diff options
context:
space:
mode:
authorMichael Muré <michael.mure@consensys.net>2019-02-01 12:22:00 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:40:22 +0100
commit56c6147eb6012252cf0b723b9eb6d1e841fc2f94 (patch)
treecce638adbf4a7d5b424fe9682cafc2fea5c64785 /bug/identity.go
parent14b240af8fef269d2c1d5dde2fff192b656c50f3 (diff)
downloadgit-bug-56c6147eb6012252cf0b723b9eb6d1e841fc2f94.tar.gz
identity: more refactoring progress
Diffstat (limited to 'bug/identity.go')
-rw-r--r--bug/identity.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/bug/identity.go b/bug/identity.go
new file mode 100644
index 00000000..2eb2bcaf
--- /dev/null
+++ b/bug/identity.go
@@ -0,0 +1,27 @@
+package bug
+
+import (
+ "github.com/MichaelMure/git-bug/identity"
+)
+
+// EnsureIdentities walk the graph of operations and make sure that all Identity
+// are properly loaded. That is, it replace all the IdentityStub with the full
+// Identity, loaded through a Resolver.
+func (bug *Bug) EnsureIdentities(resolver identity.Resolver) error {
+ it := NewOperationIterator(bug)
+
+ for it.Next() {
+ op := it.Value()
+ base := op.base()
+
+ if stub, ok := base.Author.(*identity.IdentityStub); ok {
+ i, err := resolver.ResolveIdentity(stub.Id())
+ if err != nil {
+ return err
+ }
+
+ base.Author = i
+ }
+ }
+ return nil
+}