strapi-plugin-magic-mail 2.10.5 → 2.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/_chunks/{App-2Bg4LxwL.js → App-BJBweFJi.js} +2 -1
- package/dist/_chunks/{App-CAtJIwNW.mjs → App-PxOT9hIQ.mjs} +2 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +37 -13
- package/dist/server/index.mjs +37 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [2.10.6](https://github.com/Schero94/Magic-Mail/compare/v2.10.5...v2.10.6) (2026-04-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **designer:** correct template lookup order so 'Send Test' hits the actual template ([c62c0e4](https://github.com/Schero94/Magic-Mail/commit/c62c0e461d39275dca2a176276d2797c9743a8fd))
|
|
7
|
+
|
|
1
8
|
## [2.10.5](https://github.com/Schero94/Magic-Mail/compare/v2.10.4...v2.10.5) (2026-04-21)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -4830,7 +4830,8 @@ const TemplateList = () => {
|
|
|
4830
4830
|
return;
|
|
4831
4831
|
}
|
|
4832
4832
|
try {
|
|
4833
|
-
const
|
|
4833
|
+
const templateIdForLookup = selectedTemplate.templateReferenceId ?? selectedTemplate.id;
|
|
4834
|
+
const response = await post(`/magic-mail/designer/templates/${templateIdForLookup}/test-send`, {
|
|
4834
4835
|
to: testEmail,
|
|
4835
4836
|
accountName: testAccount || null
|
|
4836
4837
|
});
|
|
@@ -4807,7 +4807,8 @@ const TemplateList = () => {
|
|
|
4807
4807
|
return;
|
|
4808
4808
|
}
|
|
4809
4809
|
try {
|
|
4810
|
-
const
|
|
4810
|
+
const templateIdForLookup = selectedTemplate.templateReferenceId ?? selectedTemplate.id;
|
|
4811
|
+
const response = await post(`/magic-mail/designer/templates/${templateIdForLookup}/test-send`, {
|
|
4811
4812
|
to: testEmail,
|
|
4812
4813
|
accountName: testAccount || null
|
|
4813
4814
|
});
|
package/dist/admin/index.js
CHANGED
|
@@ -68,7 +68,7 @@ const index = {
|
|
|
68
68
|
id: `${pluginId}.plugin.name`,
|
|
69
69
|
defaultMessage: "MagicMail"
|
|
70
70
|
},
|
|
71
|
-
Component: () => Promise.resolve().then(() => require("../_chunks/App-
|
|
71
|
+
Component: () => Promise.resolve().then(() => require("../_chunks/App-BJBweFJi.js")),
|
|
72
72
|
permissions: pluginPermissions
|
|
73
73
|
});
|
|
74
74
|
app.createSettingSection(
|
package/dist/admin/index.mjs
CHANGED
|
@@ -67,7 +67,7 @@ const index = {
|
|
|
67
67
|
id: `${pluginId}.plugin.name`,
|
|
68
68
|
defaultMessage: "MagicMail"
|
|
69
69
|
},
|
|
70
|
-
Component: () => import("../_chunks/App-
|
|
70
|
+
Component: () => import("../_chunks/App-PxOT9hIQ.mjs"),
|
|
71
71
|
permissions: pluginPermissions
|
|
72
72
|
});
|
|
73
73
|
app.createSettingSection(
|
package/dist/server/index.js
CHANGED
|
@@ -15851,7 +15851,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
|
|
|
15851
15851
|
return account;
|
|
15852
15852
|
}
|
|
15853
15853
|
});
|
|
15854
|
-
const version = "2.10.
|
|
15854
|
+
const version = "2.10.5";
|
|
15855
15855
|
const require$$2 = {
|
|
15856
15856
|
version
|
|
15857
15857
|
};
|
|
@@ -16292,30 +16292,54 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16292
16292
|
});
|
|
16293
16293
|
},
|
|
16294
16294
|
/**
|
|
16295
|
-
* Get template by numeric ID
|
|
16296
|
-
*
|
|
16295
|
+
* Get template by numeric ID.
|
|
16296
|
+
*
|
|
16297
|
+
* HISTORICAL NOTE — this method supports two semantics for historical
|
|
16298
|
+
* compatibility: the internal Strapi DB id AND the user-settable
|
|
16299
|
+
* `templateReferenceId`. They are both `integer`, both `unique`, and
|
|
16300
|
+
* they CAN collide (e.g. Template A has db.id=5 and Template B has
|
|
16301
|
+
* templateReferenceId=5). Up until now the lookup tried
|
|
16302
|
+
* templateReferenceId *first* and fell back to the DB id — which
|
|
16303
|
+
* meant "Send Test" on the admin UI (which passes the DB id) would
|
|
16304
|
+
* silently send the WRONG template if another template happened to
|
|
16305
|
+
* have a templateReferenceId matching that number.
|
|
16306
|
+
*
|
|
16307
|
+
* Correct ordering: ask the DB id first (that is the value every
|
|
16308
|
+
* `findAll()` response carries as `.id`, and that is what the admin
|
|
16309
|
+
* UI and Strapi's own routing use). Only if that truly misses, try
|
|
16310
|
+
* the reference id as a best-effort fallback for legacy callers that
|
|
16311
|
+
* already persisted a reference id as their template key.
|
|
16312
|
+
*
|
|
16313
|
+
* When the fallback actually fires we log WARN + print both IDs so
|
|
16314
|
+
* the operator can spot and fix a collision in their data.
|
|
16297
16315
|
*/
|
|
16298
16316
|
async findById(id) {
|
|
16299
16317
|
const numericId = Number(id);
|
|
16300
16318
|
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by numeric ID: ${numericId}`);
|
|
16319
|
+
let byInternalId = null;
|
|
16320
|
+
try {
|
|
16321
|
+
byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
16322
|
+
populate: { versions: true }
|
|
16323
|
+
});
|
|
16324
|
+
} catch (err) {
|
|
16325
|
+
strapi2.log.debug(`[magic-mail] [LOOKUP] entityService.findOne(${numericId}) threw: ${err.message}`);
|
|
16326
|
+
}
|
|
16327
|
+
if (byInternalId) {
|
|
16328
|
+
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
|
|
16329
|
+
return byInternalId;
|
|
16330
|
+
}
|
|
16301
16331
|
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16302
16332
|
filters: { templateReferenceId: numericId },
|
|
16303
16333
|
limit: 1,
|
|
16304
16334
|
populate: { versions: true }
|
|
16305
16335
|
});
|
|
16306
16336
|
if (byRefId.length > 0) {
|
|
16307
|
-
strapi2.log.
|
|
16337
|
+
strapi2.log.warn(
|
|
16338
|
+
`[magic-mail] [FALLBACK] No template with internal id=${numericId}; resolved via templateReferenceId=${numericId} → "${byRefId[0].name}" (documentId=${byRefId[0].documentId}). If the caller meant the DB id, this is the wrong record — update the caller to pass templateReferenceId explicitly or use findByReferenceId().`
|
|
16339
|
+
);
|
|
16308
16340
|
return byRefId[0];
|
|
16309
16341
|
}
|
|
16310
|
-
strapi2.log.
|
|
16311
|
-
const byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
16312
|
-
populate: { versions: true }
|
|
16313
|
-
});
|
|
16314
|
-
if (byInternalId) {
|
|
16315
|
-
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
|
|
16316
|
-
return byInternalId;
|
|
16317
|
-
}
|
|
16318
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
|
|
16342
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried internal id and templateReferenceId)`);
|
|
16319
16343
|
return null;
|
|
16320
16344
|
},
|
|
16321
16345
|
/**
|
package/dist/server/index.mjs
CHANGED
|
@@ -15838,7 +15838,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
|
|
|
15838
15838
|
return account;
|
|
15839
15839
|
}
|
|
15840
15840
|
});
|
|
15841
|
-
const version = "2.10.
|
|
15841
|
+
const version = "2.10.5";
|
|
15842
15842
|
const require$$2 = {
|
|
15843
15843
|
version
|
|
15844
15844
|
};
|
|
@@ -16279,30 +16279,54 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16279
16279
|
});
|
|
16280
16280
|
},
|
|
16281
16281
|
/**
|
|
16282
|
-
* Get template by numeric ID
|
|
16283
|
-
*
|
|
16282
|
+
* Get template by numeric ID.
|
|
16283
|
+
*
|
|
16284
|
+
* HISTORICAL NOTE — this method supports two semantics for historical
|
|
16285
|
+
* compatibility: the internal Strapi DB id AND the user-settable
|
|
16286
|
+
* `templateReferenceId`. They are both `integer`, both `unique`, and
|
|
16287
|
+
* they CAN collide (e.g. Template A has db.id=5 and Template B has
|
|
16288
|
+
* templateReferenceId=5). Up until now the lookup tried
|
|
16289
|
+
* templateReferenceId *first* and fell back to the DB id — which
|
|
16290
|
+
* meant "Send Test" on the admin UI (which passes the DB id) would
|
|
16291
|
+
* silently send the WRONG template if another template happened to
|
|
16292
|
+
* have a templateReferenceId matching that number.
|
|
16293
|
+
*
|
|
16294
|
+
* Correct ordering: ask the DB id first (that is the value every
|
|
16295
|
+
* `findAll()` response carries as `.id`, and that is what the admin
|
|
16296
|
+
* UI and Strapi's own routing use). Only if that truly misses, try
|
|
16297
|
+
* the reference id as a best-effort fallback for legacy callers that
|
|
16298
|
+
* already persisted a reference id as their template key.
|
|
16299
|
+
*
|
|
16300
|
+
* When the fallback actually fires we log WARN + print both IDs so
|
|
16301
|
+
* the operator can spot and fix a collision in their data.
|
|
16284
16302
|
*/
|
|
16285
16303
|
async findById(id) {
|
|
16286
16304
|
const numericId = Number(id);
|
|
16287
16305
|
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by numeric ID: ${numericId}`);
|
|
16306
|
+
let byInternalId = null;
|
|
16307
|
+
try {
|
|
16308
|
+
byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
16309
|
+
populate: { versions: true }
|
|
16310
|
+
});
|
|
16311
|
+
} catch (err) {
|
|
16312
|
+
strapi2.log.debug(`[magic-mail] [LOOKUP] entityService.findOne(${numericId}) threw: ${err.message}`);
|
|
16313
|
+
}
|
|
16314
|
+
if (byInternalId) {
|
|
16315
|
+
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
|
|
16316
|
+
return byInternalId;
|
|
16317
|
+
}
|
|
16288
16318
|
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16289
16319
|
filters: { templateReferenceId: numericId },
|
|
16290
16320
|
limit: 1,
|
|
16291
16321
|
populate: { versions: true }
|
|
16292
16322
|
});
|
|
16293
16323
|
if (byRefId.length > 0) {
|
|
16294
|
-
strapi2.log.
|
|
16324
|
+
strapi2.log.warn(
|
|
16325
|
+
`[magic-mail] [FALLBACK] No template with internal id=${numericId}; resolved via templateReferenceId=${numericId} → "${byRefId[0].name}" (documentId=${byRefId[0].documentId}). If the caller meant the DB id, this is the wrong record — update the caller to pass templateReferenceId explicitly or use findByReferenceId().`
|
|
16326
|
+
);
|
|
16295
16327
|
return byRefId[0];
|
|
16296
16328
|
}
|
|
16297
|
-
strapi2.log.
|
|
16298
|
-
const byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
16299
|
-
populate: { versions: true }
|
|
16300
|
-
});
|
|
16301
|
-
if (byInternalId) {
|
|
16302
|
-
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
|
|
16303
|
-
return byInternalId;
|
|
16304
|
-
}
|
|
16305
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
|
|
16329
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried internal id and templateReferenceId)`);
|
|
16306
16330
|
return null;
|
|
16307
16331
|
},
|
|
16308
16332
|
/**
|
package/package.json
CHANGED