@@ -11,6 +11,7 @@ import (
1111 "github.com/keybase/client/go/chat"
1212 "github.com/keybase/client/go/chat/types"
1313 "github.com/keybase/client/go/chat/utils"
14+ "github.com/keybase/client/go/engine"
1415 "github.com/keybase/client/go/libkb"
1516 keybase1 "github.com/keybase/client/go/protocol/keybase1"
1617 "github.com/keybase/go-framed-msgpack-rpc/rpc"
@@ -51,48 +52,12 @@ func (h *tlfHandler) PublicCanonicalTLFNameAndID(ctx context.Context, arg keybas
5152}
5253
5354func (h * tlfHandler ) CompleteAndCanonicalizePrivateTlfName (ctx context.Context , arg keybase1.TLFQuery ) (res keybase1.CanonicalTLFNameAndIDWithBreaks , err error ) {
54- << << << < HEAD
5555 defer h .Trace (ctx , func () error { return err },
5656 fmt .Sprintf ("CompleteAndCanonicalizePrivateTlfName(tlf=%s,mode=%v)" , arg .TlfName ,
5757 arg .IdentifyBehavior ))()
5858 var breaks []keybase1.TLFIdentifyFailure
5959 ctx = chat .Context (ctx , arg .IdentifyBehavior , & breaks , chat .NewIdentifyNotifier (h .G ()))
6060 return h .tlfInfoSource .CompleteAndCanonicalizePrivateTlfName (ctx , arg .TlfName )
61- == == == =
62- username := h .G ().Env .GetUsername ()
63- if len (username ) == 0 {
64- return keybase1.CanonicalTLFNameAndIDWithBreaks {}, libkb.LoginRequiredError {}
65- }
66-
67- // Prepend username in case it's not present. We don't need to check if it
68- // exists already since CryptKeys calls below transforms the TLF name into a
69- // canonical one.
70- //
71- // This makes username a writer on this TLF, which might be unexpected.
72- // TODO: We should think about how to handle read-only TLFs.
73- arg .TlfName = string (username ) + "," + arg .TlfName
74-
75- // TODO: do some caching so we don't end up calling this RPC
76- // unnecessarily too often
77- resp , err := h .CryptKeys (ctx , arg )
78- if err != nil {
79- return keybase1.CanonicalTLFNameAndIDWithBreaks {}, err
80- }
81-
82- return resp .NameIDBreaks , nil
83- }
84-
85- func (h * tlfHandler ) identifyTLF (ctx context.Context , arg keybase1.TLFQuery , private bool ) ([]keybase1.TLFIdentifyFailure , error ) {
86- var fails []keybase1.TLFIdentifyFailure
87- pieces := strings .Split (arg .TlfName , "," )
88- for _ , p := range pieces {
89- f , err := h .identifyUser (ctx , p , private , arg .IdentifyBehavior )
90- if err != nil {
91- return nil , err
92- }
93- fails = append (fails , f )
94- }
95- return fails , nil
9661}
9762
9863func (h * tlfHandler ) identifyUser (ctx context.Context , assertion string , private bool , idBehavior keybase1.TLFIdentifyBehavior ) (keybase1.TLFIdentifyFailure , error ) {
@@ -135,5 +100,4 @@ func (h *tlfHandler) identifyUser(ctx context.Context, assertion string, private
135100 }
136101
137102 return frep , nil
138- >> >> >> > c33db3128 ... WIP
139103}
0 commit comments