Skip to content

Convert feature controller to service#6207

Merged
kevinansfield merged 3 commits intoTryGhost:masterfrom
acburdine:feature-service
Feb 10, 2016
Merged

Convert feature controller to service#6207
kevinansfield merged 3 commits intoTryGhost:masterfrom
acburdine:feature-service

Conversation

@acburdine
Copy link
Copy Markdown
Member

closes #6170

  • add gh-feature-flag component to create a checkbox (reduce duplicate code)

TODO:

  • add tests

This comment was marked as abuse.

@acburdine acburdine force-pushed the feature-service branch 2 times, most recently from 6d97552 to 54c9550 Compare December 17, 2015 22:44
Comment thread core/client/app/services/feature.js Outdated

This comment was marked as abuse.

@acburdine acburdine changed the title [WIP] Convert feature controller to service Convert feature controller to service Jan 11, 2016
@acburdine acburdine force-pushed the feature-service branch 3 times, most recently from 3703968 to 1cdda45 Compare January 17, 2016 14:04
@acburdine acburdine force-pushed the feature-service branch 2 times, most recently from e23b044 to fbb9fe2 Compare January 19, 2016 14:25
@acburdine
Copy link
Copy Markdown
Member Author

@kevinansfield I have a thought on how to fix this, will try implementing it and see how it goes.

@acburdine
Copy link
Copy Markdown
Member Author

kevin, I changed around the service to be more promise-based rather than CP based; however, the same error is still occurring in tests for me locally (settings adapter#save is still not being called 😞)

kevinansfield added a commit to kevinansfield/Ghost that referenced this pull request Feb 2, 2016
refs TryGhost#6207, TryGhost#6207
- updates tests for new async behaviour
- fixes tests failing on validation errors
- fixes `feature.labs` not updating after successful save
@acburdine
Copy link
Copy Markdown
Member Author

@kevinansfield the tests passed locally so this should be good to go 👍

@novaugust
Copy link
Copy Markdown
Contributor

🎊

@acburdine
Copy link
Copy Markdown
Member Author

Well, it appears it works locally because I'm using phantomjs 2.1 locally, but it fails using 1.9.8 on Travis. Thoughts? (It works using chrome testing as well)

It seems to be due to phantomjs not picking up the changes to the feature checkbox on change

@kevinansfield
Copy link
Copy Markdown
Member

Maybe worth looking at merging #6051 before spending too much time trying to find workarounds for old phantomjs versions.

This comment was marked as abuse.

This comment was marked as abuse.

@acburdine
Copy link
Copy Markdown
Member Author

@kevinansfield is there anything else I need to do for this? I feel like the other two stubbed tests can be filled out as a part of #6431

@kevinansfield
Copy link
Copy Markdown
Member

As it is right now the settings.save().catch() is broken, I think we need to detect whether we get passed any errors or if the underlying settings model has validation errors and react accordingly. I think that should be fairly simple fix and will enable the pending tests to be filled out.

#6431 is more about improving the behaviour so that we don't need workarounds like the above repeated throughout the codebase - we should definitely have working examples with tests where possible before working on it in order to validate the refactoring.

@acburdine
Copy link
Copy Markdown
Member Author

@kevinansfield I fixed the error handling and filled out the remaining tests; however, I'm not sure how/if it's possible to squash my two commits down into one b/c of the order in which the changes occurred. If there is a way, though, I'll gladly squash them 😄

acburdine and others added 2 commits February 9, 2016 08:37
closes TryGhost#6170
- add gh-feature-flag component to create a checkbox (reduce duplicate code)
refs TryGhost#6207, TryGhost#6207
- updates tests for new async behaviour
- fixes tests failing on validation errors
- fixes `feature.labs` not updating after successful save
@acburdine
Copy link
Copy Markdown
Member Author

Finally, it's good to go 👍

kevinansfield added a commit that referenced this pull request Feb 10, 2016
Convert feature controller to service
@kevinansfield kevinansfield merged commit 6656256 into TryGhost:master Feb 10, 2016
naoyak pushed a commit to naoyak/Ghost that referenced this pull request Feb 10, 2016
refs TryGhost#6207, TryGhost#6207
- updates tests for new async behaviour
- fixes tests failing on validation errors
- fixes `feature.labs` not updating after successful save
@acburdine acburdine deleted the feature-service branch February 10, 2016 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert "feature" controller to a service

3 participants