0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Only import can override published_by

no issue

- published_by should be set to the current user, unless we are in import mode

Credits: Matteo Beccaro
This commit is contained in:
Hannah Wolfe 2015-02-21 22:04:00 +01:00
parent a9389bf682
commit 0e80d77100

View file

@ -132,8 +132,9 @@ Post = ghostBookshelf.Model.extend({
if (!this.get('published_at')) {
this.set('published_at', new Date());
}
// This will need to go elsewhere in the API layer.
if (!this.get('published_by')) {
// unless published_by is set and we're importing, set published_by to contextUser
if (!(this.get('published_by') && options.importing)) {
this.set('published_by', this.contextUser(options));
}
}