Skip to content

Commit

Permalink
add Fullname to Bootstrap reply (#16648)
Browse files Browse the repository at this point in the history
* add Fullname to Bootstrap reply

- as requested by @chrisnojima

* flow issue removal
  • Loading branch information
maxtaco committed Mar 19, 2019
1 parent e1cb527 commit f81ca1e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
21 changes: 21 additions & 0 deletions go/engine/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package engine

import (
"context"
"time"

"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/keybase1"
Expand Down Expand Up @@ -44,6 +45,24 @@ func (e *Bootstrap) SubConsumers() []libkb.UIConsumer {
return nil
}

func (e *Bootstrap) lookupFullname(m libkb.MetaContext, uv keybase1.UserVersion) {
pkgs, err := m.G().UIDMapper.MapUIDsToUsernamePackagesOffline(m.Ctx(), m.G(), []keybase1.UID{uv.Uid}, time.Duration(0))
if err != nil {
m.Warning("UID -> Username failed lookup: %s", err)
return
}
pkg := pkgs[0]
if pkg.NormalizedUsername.IsNil() || pkg.FullName == nil {
m.Debug("Empty username for UID=%s", uv.Uid)
return
}
if !uv.EldestSeqno.Eq(pkg.FullName.EldestSeqno) {
m.Debug("Wrong eldest for username package; got %d but wanted %d", pkg.FullName.EldestSeqno, uv.EldestSeqno)
return
}
e.status.Fullname = pkg.FullName.FullName
}

// Run starts the engine.
func (e *Bootstrap) Run(m libkb.MetaContext) error {
e.status.Registered = e.signedUp(m)
Expand Down Expand Up @@ -103,6 +122,8 @@ func (e *Bootstrap) Run(m libkb.MetaContext) error {
e.status.TopReacjis = chatHelper.TopReacjis(m.Ctx(), e.status.Uid.ToBytes())
}

e.lookupFullname(m, uv)

return nil
}

Expand Down
2 changes: 2 additions & 0 deletions go/protocol/keybase1/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions protocol/avdl/keybase1/config.avdl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ protocol config {
string username; // current logged in user's username
DeviceID deviceID; // current logged in user's device ID
string deviceName; // current logged in user's device name
FullName fullname; // current user's fullname
array<string> following; // who current logged in user is following
array<string> followers; // who follows current logged in user
array<string> topReacjis; // top 5 reacjis for current logged in user
Expand Down
4 changes: 4 additions & 0 deletions protocol/json/keybase1/config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion shared/actions/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function* loadDaemonBootstrapStatus(state, action) {
deviceName: s.deviceName,
followers: s.followers ?? [],
following: s.following ?? [],
// $FlowIssue core side isn't plumbed through yet
fullname: s.fullname || '',
loggedIn: s.loggedIn,
registered: s.registered,
Expand Down
2 changes: 1 addition & 1 deletion shared/constants/types/rpc-gen.js.flow

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f81ca1e

Please sign in to comment.