mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
chore(server): add comment server feature flags (#12993)
https://github.com/toeverything/AFFiNE/pull/12989#discussion_r2180167232 #### PR Dependency Tree * **PR #12993** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * The "Comment" feature is now recognized as a server feature and is enabled by default. * The server configuration and API schema have been updated to include the "Comment" feature. * **Tests** * Added a new end-to-end test to verify that the "Comment" feature is enabled by default. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -4,9 +4,20 @@ import { app, e2e } from '../test';
|
||||
|
||||
e2e('should indexer feature enabled by default', async t => {
|
||||
const { serverConfig } = await app.gql({ query: serverConfigQuery });
|
||||
|
||||
t.is(
|
||||
serverConfig.features.includes(ServerFeature.Indexer),
|
||||
true,
|
||||
JSON.stringify(serverConfig, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
e2e('should comment feature enabled by default', async t => {
|
||||
const { serverConfig } = await app.gql({ query: serverConfigQuery });
|
||||
|
||||
t.is(
|
||||
serverConfig.features.includes(ServerFeature.Comment),
|
||||
true,
|
||||
JSON.stringify(serverConfig, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { ServerConfigModule } from '../config';
|
||||
import { PermissionModule } from '../permission';
|
||||
import { StorageModule } from '../storage';
|
||||
import { CommentResolver } from './resolver';
|
||||
import { CommentService } from './service';
|
||||
|
||||
@Module({
|
||||
imports: [PermissionModule, StorageModule],
|
||||
imports: [PermissionModule, StorageModule, ServerConfigModule],
|
||||
providers: [CommentResolver, CommentService],
|
||||
exports: [CommentService],
|
||||
})
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
} from '../../base/graphql';
|
||||
import { Comment, DocMode, Models, Reply } from '../../models';
|
||||
import { CurrentUser } from '../auth/session';
|
||||
import { ServerFeature, ServerService } from '../config';
|
||||
import { AccessController, DocAction } from '../permission';
|
||||
import { CommentAttachmentStorage } from '../storage';
|
||||
import { UserType } from '../user';
|
||||
@@ -54,8 +55,12 @@ export class CommentResolver {
|
||||
private readonly ac: AccessController,
|
||||
private readonly commentAttachmentStorage: CommentAttachmentStorage,
|
||||
private readonly queue: JobQueue,
|
||||
private readonly models: Models
|
||||
) {}
|
||||
private readonly models: Models,
|
||||
private readonly server: ServerService
|
||||
) {
|
||||
// enable comment feature by default
|
||||
this.server.enableFeature(ServerFeature.Comment);
|
||||
}
|
||||
|
||||
@Mutation(() => CommentObjectType)
|
||||
async createComment(
|
||||
|
||||
@@ -9,6 +9,7 @@ export enum ServerFeature {
|
||||
Payment = 'payment',
|
||||
OAuth = 'oauth',
|
||||
Indexer = 'indexer',
|
||||
Comment = 'comment',
|
||||
}
|
||||
|
||||
registerEnumType(ServerFeature, {
|
||||
|
||||
@@ -1774,6 +1774,7 @@ enum ServerDeploymentType {
|
||||
|
||||
enum ServerFeature {
|
||||
Captcha
|
||||
Comment
|
||||
Copilot
|
||||
CopilotEmbedding
|
||||
Indexer
|
||||
|
||||
Reference in New Issue
Block a user