Browse Source

Merge pull request #8592 from nocodb/nc-fix/comments-validation

fix: Comments - add maxLength constraint in json schema
pull/8594/head
Pranav C 6 months ago committed by GitHub
parent
commit
4f478994cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      packages/nocodb/src/controllers/comments.controller.ts
  2. 1
      packages/nocodb/src/meta/migrations/v2/nc_046_comment_mentions.ts
  3. 4
      packages/nocodb/src/meta/migrations/v2/nc_047_comment_migration.ts
  4. 6
      packages/nocodb/src/schema/swagger-v2.json
  5. 6
      packages/nocodb/src/schema/swagger.json
  6. 3
      packages/nocodb/src/utils/richTextHelper.ts

1
packages/nocodb/src/controllers/comments.controller.ts

@ -11,7 +11,6 @@ import {
Req, Req,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { Request } from 'express';
import { GlobalGuard } from '~/guards/global/global.guard'; import { GlobalGuard } from '~/guards/global/global.guard';
import { PagedResponseImpl } from '~/helpers/PagedResponse'; import { PagedResponseImpl } from '~/helpers/PagedResponse';
import { CommentsService } from '~/services/comments.service'; import { CommentsService } from '~/services/comments.service';

1
packages/nocodb/src/meta/migrations/v2/nc_046_comment_mentions.ts

@ -1,4 +1,3 @@
import { Logger } from '@nestjs/common';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals'; import { MetaTable } from '~/utils/globals';

4
packages/nocodb/src/meta/migrations/v2/nc_047_comment_migration.ts

@ -72,9 +72,7 @@ const up = async (knex: Knex) => {
// check if there are more rows to fetch // check if there are more rows to fetch
fetchNextBatch = rows.length > READ_BATCH_SIZE; fetchNextBatch = rows.length > READ_BATCH_SIZE;
} }
logger.log( logger.log('Data migrated from Audit Table to Comments Table');
'Data migrated from Audit Table to Comments Table',
);
}; };
const down = async (knex: Knex) => { const down = async (knex: Knex) => {

6
packages/nocodb/src/schema/swagger-v2.json

@ -12897,7 +12897,8 @@
"comment": { "comment": {
"type": "string", "type": "string",
"description": "Description for the target row", "description": "Description for the target row",
"example": "This is the comment for the row" "example": "This is the comment for the row",
"maxLength": 3000
}, },
"fk_model_id": { "fk_model_id": {
"type": "string", "type": "string",
@ -12935,7 +12936,8 @@
"comment": { "comment": {
"type": "string", "type": "string",
"description": "Description for the target row", "description": "Description for the target row",
"example": "This is the comment for the row" "example": "This is the comment for the row",
"maxLength": 3000
}, },
"fk_model_id": { "fk_model_id": {
"type": "string", "type": "string",

6
packages/nocodb/src/schema/swagger.json

@ -18927,7 +18927,8 @@
"comment": { "comment": {
"type": "string", "type": "string",
"description": "Description for the target row", "description": "Description for the target row",
"example": "This is the comment for the row" "example": "This is the comment for the row",
"maxLength": 3000
}, },
"fk_model_id": { "fk_model_id": {
"type": "string", "type": "string",
@ -18965,7 +18966,8 @@
"comment": { "comment": {
"type": "string", "type": "string",
"description": "Description for the target row", "description": "Description for the target row",
"example": "This is the comment for the row" "example": "This is the comment for the row",
"maxLength": 3000
}, },
"fk_model_id": { "fk_model_id": {
"type": "string", "type": "string",

3
packages/nocodb/src/utils/richTextHelper.ts

@ -6,8 +6,7 @@ export const extractMentions = (richText: string) => {
const regex = /@\(([^)]+)\)/g; const regex = /@\(([^)]+)\)/g;
let match: RegExpExecArray | null; const match: RegExpExecArray | null = regex.exec(richText);
match = regex.exec(richText);
while (match !== null) { while (match !== null) {
const userId = match[1].split('|')[0]; // Extracts the userId part from the matched string const userId = match[1].split('|')[0]; // Extracts the userId part from the matched string
mentions.push(userId); mentions.push(userId);

Loading…
Cancel
Save