Add ability to discard Information Banner (#16019)
Fixes https://github.com/twentyhq/twenty/issues/14028 <img width="1917" height="965" alt="image" src="https://github.com/user-attachments/assets/eeb5eab7-2c50-48be-8218-af6052b30777" />
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
import { ArgsType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { IsNotEmpty, IsUUID } from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@ArgsType()
|
||||
export class DismissReconnectAccountBannerInput {
|
||||
@Field(() => UUIDScalarType)
|
||||
@IsNotEmpty()
|
||||
@IsUUID()
|
||||
connectedAccountId: string;
|
||||
}
|
||||
+3
-1
@@ -5,8 +5,10 @@ import { TimelineMessagingService } from 'src/engine/core-modules/messaging/serv
|
||||
import { TimelineMessagingResolver } from 'src/engine/core-modules/messaging/timeline-messaging.resolver';
|
||||
import { UserModule } from 'src/engine/core-modules/user/user.module';
|
||||
import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module';
|
||||
import { ConnectedAccountModule } from 'src/modules/connected-account/connected-account.module';
|
||||
|
||||
@Module({
|
||||
imports: [WorkspaceDataSourceModule, UserModule],
|
||||
imports: [WorkspaceDataSourceModule, UserModule, ConnectedAccountModule],
|
||||
exports: [],
|
||||
providers: [
|
||||
TimelineMessagingResolver,
|
||||
|
||||
+27
-1
@@ -1,10 +1,19 @@
|
||||
import { UseGuards } from '@nestjs/common';
|
||||
import { Args, ArgsType, Field, Int, Query, Resolver } from '@nestjs/graphql';
|
||||
import {
|
||||
Args,
|
||||
ArgsType,
|
||||
Field,
|
||||
Int,
|
||||
Mutation,
|
||||
Query,
|
||||
Resolver,
|
||||
} from '@nestjs/graphql';
|
||||
|
||||
import { Max } from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { TIMELINE_THREADS_MAX_PAGE_SIZE } from 'src/engine/core-modules/messaging/constants/messaging.constants';
|
||||
import { DismissReconnectAccountBannerInput } from 'src/engine/core-modules/messaging/dtos/dismiss-reconnect-account-banner.input';
|
||||
import { TimelineThreadsWithTotalDTO } from 'src/engine/core-modules/messaging/dtos/timeline-threads-with-total.dto';
|
||||
import { GetMessagesService } from 'src/engine/core-modules/messaging/services/get-messages.service';
|
||||
import { UserService } from 'src/engine/core-modules/user/services/user.service';
|
||||
@@ -15,6 +24,7 @@ import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorat
|
||||
import { CustomPermissionGuard } from 'src/engine/guards/custom-permission.guard';
|
||||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard';
|
||||
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
||||
import { AccountsToReconnectService } from 'src/modules/connected-account/services/accounts-to-reconnect.service';
|
||||
|
||||
@ArgsType()
|
||||
class GetTimelineThreadsFromPersonIdArgs {
|
||||
@@ -61,6 +71,7 @@ export class TimelineMessagingResolver {
|
||||
constructor(
|
||||
private readonly getMessagesFromPersonIdsService: GetMessagesService,
|
||||
private readonly userService: UserService,
|
||||
private readonly accountsToReconnectService: AccountsToReconnectService,
|
||||
) {}
|
||||
|
||||
@Query(() => TimelineThreadsWithTotalDTO)
|
||||
@@ -141,4 +152,19 @@ export class TimelineMessagingResolver {
|
||||
|
||||
return timelineThreads;
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean)
|
||||
async dismissReconnectAccountBanner(
|
||||
@AuthUser() user: UserEntity,
|
||||
@AuthWorkspace() workspace: WorkspaceEntity,
|
||||
@Args() { connectedAccountId }: DismissReconnectAccountBannerInput,
|
||||
): Promise<boolean> {
|
||||
await this.accountsToReconnectService.removeAccountToReconnect(
|
||||
user.id,
|
||||
workspace.id,
|
||||
connectedAccountId,
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user