Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix handling of team delete #20070

Merged
merged 4 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions go/teams/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,38 +301,32 @@ func HandleDeleteNotification(ctx context.Context, g *libkb.GlobalContext, rows
defer mctx.Trace(fmt.Sprintf("team.HandleDeleteNotification(%v)", len(rows)),
func() error { return err })()

var errs []error
for _, row := range rows {
g.Log.CDebugf(ctx, "team.HandleDeleteNotification: (%+v)", row)
err := TombstoneTeam(libkb.NewMetaContext(ctx, g), row.Id)
if err != nil {
errs = append(errs, err)
continue
if err := TombstoneTeam(libkb.NewMetaContext(ctx, g), row.Id); err != nil {
g.Log.CDebugf(ctx, "team.HandleDeleteNotification: failed to Tombstone: %s", err)
}
invalidateCaches(mctx, row.Id)
g.NotifyRouter.HandleTeamDeleted(ctx, row.Id)
}

return libkb.CombineErrors(errs...)
return nil
}

func HandleExitNotification(ctx context.Context, g *libkb.GlobalContext, rows []keybase1.TeamExitRow) (err error) {
mctx := libkb.NewMetaContext(ctx, g)
defer mctx.Trace(fmt.Sprintf("team.HandleExitNotification(%v)", len(rows)),
func() error { return err })()

var errs []error
for _, row := range rows {
mctx.Debug("team.HandleExitNotification: (%+v)", row)
err := FreezeTeam(mctx, row.Id)
if err != nil {
errs = append(errs, err)
continue
if err := FreezeTeam(mctx, row.Id); err != nil {
mctx.Debug("team.HandleExitNotification: failed to FreezeTeam: %s", err)
}
invalidateCaches(mctx, row.Id)
mctx.G().NotifyRouter.HandleTeamExit(ctx, row.Id)
}
return libkb.CombineErrors(errs...)
return nil
}

func HandleNewlyAddedToTeamNotification(ctx context.Context, g *libkb.GlobalContext, rows []keybase1.TeamNewlyAddedRow) (err error) {
Expand Down
16 changes: 8 additions & 8 deletions go/teams/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -2624,6 +2624,10 @@ func TeamInviteTypeFromString(mctx libkb.MetaContext, inviteTypeStr string) (key
}

func FreezeTeam(mctx libkb.MetaContext, teamID keybase1.TeamID) error {
err3 := mctx.G().GetHiddenTeamChainManager().Freeze(mctx, teamID)
if err3 != nil {
mctx.Debug("error freezing in hidden team chain manager: %v", err3)
}
err1 := mctx.G().GetTeamLoader().Freeze(mctx.Ctx(), teamID)
if err1 != nil {
mctx.Debug("error freezing in team cache: %v", err1)
Expand All @@ -2632,14 +2636,14 @@ func FreezeTeam(mctx libkb.MetaContext, teamID keybase1.TeamID) error {
if err2 != nil {
mctx.Debug("error freezing in fast team cache: %v", err2)
}
err3 := mctx.G().GetHiddenTeamChainManager().Freeze(mctx, teamID)
if err3 != nil {
mctx.Debug("error freezing in hidden team chain manager: %v", err3)
}
return libkb.CombineErrors(err1, err2, err3)
}

func TombstoneTeam(mctx libkb.MetaContext, teamID keybase1.TeamID) error {
mmaxim marked this conversation as resolved.
Show resolved Hide resolved
err3 := mctx.G().GetHiddenTeamChainManager().Tombstone(mctx, teamID)
if err3 != nil {
mctx.Debug("error tombstoning in hidden team chain manager: %v", err3)
}
err1 := mctx.G().GetTeamLoader().Tombstone(mctx.Ctx(), teamID)
if err1 != nil {
mctx.Debug("error tombstoning in team cache: %v", err1)
Expand All @@ -2648,10 +2652,6 @@ func TombstoneTeam(mctx libkb.MetaContext, teamID keybase1.TeamID) error {
if err2 != nil {
mctx.Debug("error tombstoning in fast team cache: %v", err2)
}
err3 := mctx.G().GetHiddenTeamChainManager().Tombstone(mctx, teamID)
if err3 != nil {
mctx.Debug("error tombstoning in hidden team chain manager: %v", err3)
}
return libkb.CombineErrors(err1, err2, err3)
}

Expand Down