Browse Source

fix: avoid checking names cross-source (#8954)

pull/8972/head
Mert E 5 months ago committed by GitHub
parent
commit
44722688e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      packages/nocodb/src/models/Model.ts

14
packages/nocodb/src/models/Model.ts

@ -1029,7 +1029,11 @@ export default class Model implements TableType {
static async checkTitleAvailable( static async checkTitleAvailable(
context: NcContext, context: NcContext,
{ table_name, exclude_id }: { table_name; base_id; source_id; exclude_id? }, {
table_name,
source_id,
exclude_id,
}: { table_name; base_id; source_id; exclude_id? },
ncMeta = Noco.ncMeta, ncMeta = Noco.ncMeta,
) { ) {
return !(await ncMeta.metaGet2( return !(await ncMeta.metaGet2(
@ -1038,6 +1042,7 @@ export default class Model implements TableType {
MetaTable.MODELS, MetaTable.MODELS,
{ {
table_name, table_name,
...(source_id ? { source_id } : {}),
}, },
null, null,
exclude_id && { id: { neq: exclude_id } }, exclude_id && { id: { neq: exclude_id } },
@ -1046,7 +1051,11 @@ export default class Model implements TableType {
static async checkAliasAvailable( static async checkAliasAvailable(
context: NcContext, context: NcContext,
{ title, exclude_id }: { title; base_id; source_id; exclude_id? }, {
title,
source_id,
exclude_id,
}: { title; base_id; source_id; exclude_id? },
ncMeta = Noco.ncMeta, ncMeta = Noco.ncMeta,
) { ) {
return !(await ncMeta.metaGet2( return !(await ncMeta.metaGet2(
@ -1055,6 +1064,7 @@ export default class Model implements TableType {
MetaTable.MODELS, MetaTable.MODELS,
{ {
title, title,
...(source_id ? { source_id } : {}),
}, },
null, null,
exclude_id && { id: { neq: exclude_id } }, exclude_id && { id: { neq: exclude_id } },

Loading…
Cancel
Save