Fixing issue with 1:N relationships and multiple fields, issue #1753.

This commit is contained in:
mike12345567 2021-06-20 10:53:55 +01:00
parent 9afd7fb57a
commit 052d14ad38
2 changed files with 2 additions and 3 deletions

View File

@ -211,14 +211,14 @@ class LinkController {
// iterate through the link IDs in the row field, see if any don't exist already // iterate through the link IDs in the row field, see if any don't exist already
for (let linkId of rowField) { for (let linkId of rowField) {
if (linkedSchema.relationshipType === RelationshipTypes.ONE_TO_MANY) { if (linkedSchema.relationshipType === RelationshipTypes.ONE_TO_MANY) {
const links = ( let links = (
await getLinkDocuments({ await getLinkDocuments({
appId: this._appId, appId: this._appId,
tableId: field.tableId, tableId: field.tableId,
rowId: linkId, rowId: linkId,
includeDocs: IncludeDocs.EXCLUDE, includeDocs: IncludeDocs.EXCLUDE,
}) })
).filter(link => link.id !== row._id) ).filter(link => link.id !== row._id && link.fieldName === linkedSchema.name)
// The 1 side of 1:N is already related to something else // The 1 side of 1:N is already related to something else
// You must remove the existing relationship // You must remove the existing relationship

View File

@ -53,7 +53,6 @@ describe("/api/admin/email", () => {
it("should be able to send a welcome email", async () => { it("should be able to send a welcome email", async () => {
await sendRealEmail(EmailTemplatePurpose.WELCOME) await sendRealEmail(EmailTemplatePurpose.WELCOME)
}) })
it("should be able to send a invitation email", async () => { it("should be able to send a invitation email", async () => {