Ghost/core/server/utils
Katharina Irrgang 1f37ff6053 🎨 refactor the importer (#8473)
refs #5422

- we can support null titles after this PR if we want
- user model: fix getAuthorRole
- user model: support adding roles by name
- we support this for roles as well, this makes it easier when importing related user roles (because usually roles already exists in the database and the related id's are wrong e.g. roles_users)
- base model: support for null created_at or updated_at values
- post or tag slugs are always safe strings
- enable an import of a null slug, no need to crash or to cover this on import layer
- add new DataImporter logic
    - uses a class inheritance mechanism to achieve an easier readability and maintenance
    - schema validation (happens on model layer) was ignored
    - allow to import unknown user id's (see https://github.com/TryGhost/Ghost/issues/8365)
    - most of the duplication handling happens on model layer (we can use the power of unique fields and errors from the database)
- the import is splitted into three steps:
  - beforeImport
    --> prepares the data to import, sorts out relations (roles, tags), detects fields (for LTS)
  - doImport
    --> does the actual import
  - afterImport
    --> updates the data after successful import e.g. update all user reference fields e.g. published_by (compares the imported data with the current state of the database)
- import images: markdown can be null
- show error message when json handler can't parse file
- do not request gravatar if email is null
- return problems/warnings after successful import
- optimise warnings in importer
- do not return warnings for role duplications, no helpful information
- error handler: return context information of error
- we show the affected json entries as one line in the UI
- show warning for: detected duplicated tag
- schema validation: fix valueMustBeBoolean translation
- remove context property from json parse error
2017-05-23 17:18:13 +01:00
..
packages 🎨 Collect & simplify package utils (#8080) 2017-03-01 14:09:31 +01:00
asset-hash.js 🐛 Refresh assetHash on theme override (#7430) 2016-09-23 13:05:44 +02:00
blog-icon.js 🙇 Blog icon utils and publisher.logo for JSON-LD (#8297) 2017-04-11 18:32:06 +02:00
cached-image-size-from-url.js 🐛 fix image size timeout (#8283) 2017-04-05 21:58:26 +01:00
ghost-version.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
gravatar.js 🎨 😎 config env usages (#7929) 2017-02-03 18:25:39 +00:00
image-size-from-url.js 🐛 fix image size timeout (#8283) 2017-04-05 21:58:26 +01:00
index.js 🎨 refactor the importer (#8473) 2017-05-23 17:18:13 +01:00
labs.js Helper Proxy & single express-hbs instance (#8225) 2017-04-04 18:07:35 +02:00
make-absolute-urls.js 🎨 source out url utils from ConfigManager (#7347) 2016-09-20 15:59:34 +01:00
markdown-converter.js replace custom showdown fork with markdown-it (#8451) 2017-05-15 18:48:14 +02:00
mobiledoc-converter.js 📦 Card-Rename (#8218) 2017-03-24 10:03:33 +00:00
pipeline.js Pipeline util tests, clean & fix 2015-11-03 09:14:44 +00:00
read-csv.js Add CSV parser for csv read utility 2016-06-07 10:47:56 +01:00
remove-open-redirect-from-url.js Remove open redirect by removing double slashes from redirects (#7247) 2016-08-23 13:47:59 +02:00
sequence.js post-scheduling 2016-06-14 10:52:13 +02:00
social-urls.js Add helpers for facebook & twitter urls 2016-05-17 16:39:58 +01:00
tokens.js 🎨 remove token logic from user model (#7622) 2016-11-07 11:18:50 +00:00
url.js 🐛 https image urls if accessed over SSL (#8373) 2017-05-15 13:09:48 +02:00
visibility.js Helper Proxy & single express-hbs instance (#8225) 2017-04-04 18:07:35 +02:00
zip-folder.js 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00