internal/gaby: enable groups sync in cron endpoint

Fixes golang/oscar#27

Change-Id: I48cfbe6e423a699b4da6b62230cd5f08dbfee38a
Reviewed-on: https://go-review.googlesource.com/c/oscar/+/625395
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
diff --git a/internal/gaby/main.go b/internal/gaby/main.go
index fce8cef..66abeb2 100644
--- a/internal/gaby/main.go
+++ b/internal/gaby/main.go
@@ -171,10 +171,11 @@
 
 	// Named functions to retrieve latest Watcher times.
 	watcherLatests := map[string]func() timed.DBTime{
-		github.DocWatcherID:     docs.LatestFunc(g.github),
-		gerrit.DocWatcherID:     docs.LatestFunc(g.gerrit),
-		discussion.DocWatcherID: docs.LatestFunc(g.disc),
-		crawl.DocWatcherID:      docs.LatestFunc(cr),
+		github.DocWatcherID:       docs.LatestFunc(g.github),
+		gerrit.DocWatcherID:       docs.LatestFunc(g.gerrit),
+		discussion.DocWatcherID:   docs.LatestFunc(g.disc),
+		crawl.DocWatcherID:        docs.LatestFunc(cr),
+		googlegroups.DocWatcherID: docs.LatestFunc(g.ggroups),
 
 		"embeddocs": func() timed.DBTime { return embeddocs.Latest(g.docs) },
 
@@ -534,6 +535,7 @@
 		check(g.syncGitHubIssues(ctx))
 		check(g.syncGitHubDiscussions(ctx))
 		check(g.syncGerrit(ctx))
+		check(g.syncGroups(ctx))
 
 		// Embed must happen last.
 		check(g.embedAll(ctx))
@@ -609,11 +611,12 @@
 	g.db.Lock(gabyGroupsSyncLock)
 	defer g.db.Unlock(gabyGroupsSyncLock)
 
-	// Download new events from all google groups.
+	// Download updated conversations from all google groups.
 	if err := g.ggroups.Sync(ctx); err != nil {
 		return err
 	}
-	// TODO: add docs
+	// Store newly downloaded conversations in the document database.
+	docs.Sync(g.docs, g.ggroups)
 	return nil
 }