Cody: Add isCodyEnabled to graphQL schema for Site (#52941)

This commit is contained in:
Beatrix 2023-06-05 15:08:28 -07:00 committed by GitHub
parent 99b74ac0aa
commit e4d5317e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,7 @@ All notable changes to Sourcegraph are documented in this file.
- Batch Changes for Gerrit Code Hosts [#52647](https://github.com/sourcegraph/sourcegraph/pull/52647).
- Batch Changes now supports per-batch-change control for pushing to a fork of the upstream repository when the property `changesetTemplate.fork` is specified in the batch spec. [#51572](https://github.com/sourcegraph/sourcegraph/pull/51572)
- Executors can now be configured to process multiple queues. [#52016](https://github.com/sourcegraph/sourcegraph/pull/52016)
- Added `isCodyEnabled` as a new GraphQL field to `Site`. [#52941](https://github.com/sourcegraph/sourcegraph/pull/52941)
### Changed

View File

@ -245,6 +245,7 @@ go_library(
"//internal/codeintel/dependencies",
"//internal/codeintel/dependencies/shared",
"//internal/codeintel/resolvers",
"//internal/cody",
"//internal/conf",
"//internal/conf/conftypes",
"//internal/conf/deploy",

View File

@ -7072,6 +7072,11 @@ type Site implements SettingsSubject {
Whether users are required to have a verified email in order to access Cody.
"""
requiresVerifiedEmailForCody: Boolean!
"""
Whether Cody is enabled for this site.
"""
isCodyEnabled: Boolean!
}
"""

View File

@ -22,6 +22,7 @@ import (
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/auth"
"github.com/sourcegraph/sourcegraph/internal/cody"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/conf/deploy"
"github.com/sourcegraph/sourcegraph/internal/database"
@ -558,3 +559,5 @@ func (r *siteResolver) RequiresVerifiedEmailForCody(ctx context.Context) bool {
isAdmin := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db) == nil
return !isAdmin
}
func (r *siteResolver) IsCodyEnabled(ctx context.Context) bool { return cody.IsCodyEnabled(ctx) }