mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added default email to send import reports to (#16485)
refs https://github.com/TryGhost/Team/issues/2790 - When a Self-Serve integration does content/members import it failed because there was no "user" to get the email from - needed to send the import report - The fix defaults to the instance's owner email when an integration does the request Co-authored-by: Naz <hi@nazavo.com>
This commit is contained in:
parent
64c9e66b56
commit
751f7d5278
2 changed files with 18 additions and 3 deletions
|
@ -82,12 +82,20 @@ module.exports = {
|
|||
cacheInvalidate: true
|
||||
},
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
async query(frame) {
|
||||
const siteTimezone = settingsCache.get('timezone');
|
||||
const importTag = `#Import ${moment().tz(siteTimezone).format('YYYY-MM-DD HH:mm')}`;
|
||||
|
||||
let email;
|
||||
if (frame.user) {
|
||||
email = frame.user.get('email');
|
||||
} else {
|
||||
email = await models.User.getOwnerUser().get('email');
|
||||
}
|
||||
|
||||
return importer.importFromFile(frame.file, {
|
||||
user: {
|
||||
email: frame.user.get('email')
|
||||
email: email
|
||||
},
|
||||
importTag
|
||||
});
|
||||
|
|
|
@ -367,6 +367,13 @@ module.exports = {
|
|||
const pathToCSV = frame.file.path;
|
||||
const headerMapping = frame.data.mapping;
|
||||
|
||||
let email;
|
||||
if (frame.user) {
|
||||
email = frame.user.get('email');
|
||||
} else {
|
||||
email = await models.User.getOwnerUser().get('email');
|
||||
}
|
||||
|
||||
return membersService.processImport({
|
||||
pathToCSV,
|
||||
headerMapping,
|
||||
|
@ -374,7 +381,7 @@ module.exports = {
|
|||
importLabel,
|
||||
LabelModel: models.Label,
|
||||
user: {
|
||||
email: frame.user.get('email')
|
||||
email: email
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue