Skip to content

Commit

Permalink
BC-7583 - fix bugs in socket implementation (#5086)
Browse files Browse the repository at this point in the history
Fixing two bugs that were introduced with the implementation of websocket-communication for boards.
1: When a new card gets created by clicking on the corresponding button, it gets created without an empty text field element.
2: When the user hits enter key while being in a card title, a new text field element should be created at the beginning of the card and the cursor should jump into it.
  • Loading branch information
hoeppner-dataport authored Jun 28, 2024
1 parent cf58b6b commit ee670e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class BoardCollaborationGateway implements OnGatewayDisconnect {
const emitter = await this.buildBoardSocketEmitter({ socket, id: data.columnId, action: 'create-card' });
const { userId } = this.getCurrentUser(socket);
try {
const card = await this.columnUc.createCard(userId, data.columnId);
const card = await this.columnUc.createCard(userId, data.columnId, data.requiredEmptyElements);
const newCard = CardResponseMapper.mapToResponse(card);

const responsePayload = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { IsMongoId } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsMongoId, IsOptional } from 'class-validator';
import { ContentElementType } from '../../domain';

export class CreateCardMessageParams {
@IsMongoId()
columnId!: string;

@IsEnum(ContentElementType, { each: true })
@IsOptional()
@ApiPropertyOptional({
required: false,
isArray: true,
enum: ContentElementType,
})
requiredEmptyElements?: ContentElementType[];
}

0 comments on commit ee670e4

Please sign in to comment.