0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

🐛 user was not imported, but the importer tries to correct the reference (#8722)

no issue

- this is usually an edge case, but i investigated because i thought that the importer is broken
- the importer logic is build like this:
   - it creates a transaction
   - this transactions runs through:
      - beforeImport
      - doImport
      - afterImport
   - afterImport corrects user references and if a user could not be imported, we have to protect that
       NOTE: we could create two transactions to be more correct, but building this had no priority because of edge cases only
             having two transactions would solve: you first add the data (error or success), then you correct the data
   - usually a user can be always imported (!), but there are a few edge cases (e.g. multiple roles attached)
This commit is contained in:
Katharina Irrgang 2017-07-21 10:59:18 +02:00 committed by Kevin Ansfield
parent d6aaf2dbc7
commit 5ff7574324

View file

@ -209,6 +209,13 @@ class Base {
email: oldUser.email, email: oldUser.email,
status: 'all' status: 'all'
}, options).then(function (userModel) { }, options).then(function (userModel) {
// CASE: user could not be imported e.g. multiple roles attached
if (!userModel) {
userModel = {
id: models.User.ownerUser
};
}
dataToEdit = {}; dataToEdit = {};
dataToEdit[key] = userModel.id; dataToEdit[key] = userModel.id;