diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee index 7c0cd05c2..a660007e6 100644 --- a/js/app/controllers/feedcontroller.coffee +++ b/js/app/controllers/feedcontroller.coffee @@ -55,9 +55,10 @@ angular.module('News').factory '_FeedController', @_isAddingFeed = true @_feedBl.create feedUrl, parentFolderId # on success - , => + , (data) => @_$scope.feedUrl = '' @_isAddingFeed = false + @_feedBl.load(data['feeds'][0].id) # on error , => @_isAddingFeed = false diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee index 8828f0c85..f6bd804e5 100644 --- a/js/app/services/bl/feedbl.coffee +++ b/js/app/services/bl/feedbl.coffee @@ -153,7 +153,7 @@ NewLoading, _ExistsError) -> feed.error = response.msg onFailure() else - onSuccess() + onSuccess(response.data) @_persistence.createFeed url, parentId, success diff --git a/js/public/app.js b/js/public/app.js index 8fe0d0354..2aaaa05c0 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -296,9 +296,10 @@ License along with this library. If not, see . _this._$scope.feedExistsError = false; try { _this._isAddingFeed = true; - return _this._feedBl.create(feedUrl, parentFolderId, function() { + return _this._feedBl.create(feedUrl, parentFolderId, function(data) { _this._$scope.feedUrl = ''; - return _this._isAddingFeed = false; + _this._isAddingFeed = false; + return _this._feedBl.load(data['feeds'][0].id); }, function() { return _this._isAddingFeed = false; }); @@ -764,7 +765,7 @@ License along with this library. If not, see . feed.error = response.msg; return onFailure(); } else { - return onSuccess(); + return onSuccess(response.data); } }; return this._persistence.createFeed(url, parentId, success); diff --git a/js/tests/services/bl/feedblSpec.coffee b/js/tests/services/bl/feedblSpec.coffee index 1412225e5..4b534f998 100644 --- a/js/tests/services/bl/feedblSpec.coffee +++ b/js/tests/services/bl/feedblSpec.coffee @@ -283,13 +283,14 @@ describe 'FeedBl', -> onSuccess = jasmine.createSpy('Success') @persistence.createFeed = jasmine.createSpy('add feed') @persistence.createFeed.andCallFake (folderName, parentId, success) => - response = + @response = status: 'ok' - success(response) + data: 'hi' + success(@response) @FeedBl.create(' johns ', 0, onSuccess) - expect(onSuccess).toHaveBeenCalled() + expect(onSuccess).toHaveBeenCalledWith(@response.data) it 'should call the handle a response error when creating a folder', =>