Skip to content

Commit

Permalink
Fixed bug when an article has no creator/changer/author (#93)
Browse files Browse the repository at this point in the history
* Fixed bug when an article has no creator/changer/author

* Code clean up

* Added missing return statement
  • Loading branch information
trickreich authored and wachterjohannes committed Mar 7, 2017
1 parent d663b9a commit 17cb175
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions Resources/public/js/components/articles/edit/settings/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ define([
var changerDef = $.Deferred();
var authorDef = $.Deferred();

if (data.creator === data.changer) {
if (data.creator && data.changer && data.creator === data.changer) {
this.loadUser(data.creator).done(function(model) {
creatorDef.resolve(model.get('fullName'), data.created);
changerDef.resolve(model.get('fullName'), data.changed);
Expand Down Expand Up @@ -279,9 +279,16 @@ define([
* @return {*}
*/
loadUser: function(id) {
var deferred = $.Deferred(),
user = new User({id: id});
var deferred = $.Deferred();

// when no id set return here
if (!id) {
deferred.reject();

return deferred;
}

var user = new User({id: id});
user.fetch({
global: false,

Expand Down

0 comments on commit 17cb175

Please sign in to comment.