Commit Graph

6161 Commits

Author SHA1 Message Date
Hannah Wolfe
192086bd98 Merge pull request #6615 from jaswilli/delete-204
Use HTTP status 204 on deletes
2016-03-22 18:43:49 +00:00
Hannah Wolfe
66fb70337f Merge pull request #6623 from jaswilli/knex
Update knex and bookshelf
2016-03-22 17:09:12 +00:00
Jason Williams
136bdbd9ff Return http status 204 on deletes
Closes #2871
- Refactor api http handlers.
- Update tests.
- Remove special handling of responses in ember adapter.
2016-03-22 11:42:48 -05:00
Hannah Wolfe
bba7bdd8eb Merge pull request #6613 from jaswilli/delete-content-refactor
Refactor content deletion
2016-03-22 16:39:43 +00:00
Kevin Ansfield
94abaca531 Merge pull request #6611 from dbalders/ember-navitems
Remove Nav Item Placeholder and Set as Base Url Value
2016-03-22 16:18:28 +01:00
Jason Williams
9fe573a0c5 Refactor content deletion
- Simplify the `init` method in `models/index.js` so that it no longer
  returns a promise. Easier to use.
- Eliminates the `deleteAllContent` method from `models/index.js` as it
  can all be handled at the API layer in a single spot.
- Optimize `destroyAllContent` in `api/db.js`. Eliminates
  double-fetching every post from the database and converting it to
  JSON. Also only fetches ids from the database instead of the entire
  model.
- Eliminates the custom static method `destroy` in the Post model in
  favor of handling detaching tag relations in a single place (the
  `destroying` event). This also eliminates a big source of unneeded
  database round trips--needing to get post ids to feed into
  `Post.destroy()` which then re-fetches the post again.
2016-03-22 10:10:09 -05:00
Sebastian Gierlinger
229c2925a6 Merge pull request #6622 from ErisDS/migration-messaging
Migration messaging improvements
2016-03-22 15:24:13 +01:00
David Balderston
9eb0a8a690 Remove Nav Item Placeholder and Set as Base Url Value
Closes #6440

* Removed the `.fake-placeholder`class from the input, test, and css
* On adding a nav item, if the url value has not been set by the user,
then set it to the base url as shown in the input
* If url has been set by the user, just do what it has always done
2016-03-22 07:11:20 -07:00
Austin Burdine
b9720e3589 Merge pull request #6624 from king6cong/preview-fix
fix invalid preview url
2016-03-22 08:27:35 -05:00
king6cong
cf7bc6f415 fix invalid preview url 2016-03-22 20:42:46 +08:00
Hannah Wolfe
84f387785a Migration messaging improvements
refs #6301

- fix messages that joined with comma and therefore missed outputting version no
- change `logInfo` to `logger` that has both an info and a warn method
- add new warn method to errors
- add a warn message everytime a migration (data or fixture) gets skipped over
- update logger everywhere, including tests
- update tests to check logger.warn gets called
2016-03-22 09:59:22 +00:00
Sebastian Gierlinger
c2d8436437 Merge pull request #6621 from ErisDS/fixture-run-once
Ensure fixture operations only run if needed
2016-03-22 10:32:31 +01:00
Jason Williams
ee534845e5 deps: bookshelf@0.9.2 2016-03-21 19:27:23 -05:00
Jason Williams
57250edf0b deps: knex@0.10.0
Closes #6573
2016-03-21 19:27:23 -05:00
Jason Williams
82b0b92b73 Merge pull request #6619 from kevinansfield/ember-data-2-4-2
deps: ember-data@2.4.2
2016-03-21 13:31:03 -05:00
Hannah Wolfe
9030620b23 Ensure fixture operations only run if needed
refs #6301

- Make sure that every fixture operation has a check to ensure that it hasn't already run
- E.g. The update of sort_order on posts_tags should only happen if there are no values which aren't a zero
  - This makes sure that we don't accidentally overwrite data on FORCE_MIGRATE
- No need to try to set settings types if they are already correct
- Only update the admin client if it needs it, else we're regenerating secrets each time
2016-03-21 18:15:01 +00:00
Kevin Ansfield
3d8e40f9ae deps: ember-data@2.4.2
no issue
- https://github.com/emberjs/data/releases/tag/v2.4.1
- https://github.com/emberjs/data/releases/tag/v2.4.2
- uses the new public import path for `EmbeddedRecordsMixin` (http://emberjs.com/blog/2016/03/13/ember-data-2-4-released.html#toc_importing-modules - note that the module naming there isn't quite right)
2016-03-21 16:37:42 +00:00
Jason Williams
90dca163a6 Merge pull request #6618 from kevinansfield/ember-2-4-3
deps: ember@2.4.3
2016-03-21 10:17:41 -05:00
Sebastian Gierlinger
ea9c8235fa Merge pull request #6609 from ErisDS/new-db-upgrade
Rewrite DB update to be explicit
2016-03-21 16:14:59 +01:00
Kevin Ansfield
8f33a3540d deps: ember@2.4.3
no issue
- https://github.com/emberjs/ember.js/releases/tag/v2.4.2
- https://github.com/emberjs/ember.js/releases/tag/v2.4.3
2016-03-21 14:10:18 +00:00
Sebastian Gierlinger
1256272640 Merge pull request #6616 from ErisDS/meta-schema-fix
Never output null JSON-LD schema
2016-03-21 10:22:06 +01:00
Sebastian Gierlinger
25c490b2ec Merge pull request #6614 from ErisDS/paginated-urls
Clean up paginated URL generation
2016-03-21 10:08:53 +01:00
Sebastian Gierlinger
e7fcc9e059 Merge pull request #6612 from ErisDS/channel-contexts
Generate context from channelConfig, not URL
2016-03-21 09:49:35 +01:00
Hannah Wolfe
9a8fbd5286 Never output null JSON-LD schema
refs #5091, #6612

- fixes meta data so it won't output 'null' as a JSON-LD schema
- added test coverage for this if/else
- this case cannot happen within the existing system, it only happens with custom channels after #6612
2016-03-20 22:36:02 +00:00
Hannah Wolfe
5f2c913fc1 Clean up paginated URL generation
refs #5091, #6612

- unify getNextUrl & getPrevUrl into getPaginatedUrl
- ensure that it can generate a prev, next or exact page no url
- ensure that it can figure out the base url
- use the same code from the page_url helper
- refactor the tests to ensure there's 100% coverage

Following on from #6612, this ensures that pagination always works regardless of whether the channel is default or custom
2016-03-20 22:35:00 +00:00
Hannah Wolfe
17499dbc7b Generate context from channelConfig, not URL
refs #5091

- makes post context explicit - data.post must be set, rather than post being the default
- uses channelConfig to determine the context for a channel (the channel name) rather than basing it off of the URL
- updates tests to setup the contexts more clearly, the outcome has not changed

Since #6469 req has channelConfig attached to it.
We can use req.channelConfig to determine what the context should be for a channel (the channel name)
This allows us to remove the hardcoded URLs, and means that custom channels will automatically get their own context.
Coupled with removing 'post' from being a default/fallthrough, to being explicitly set, this will reduce
potential context errors, as we start to extend the frontend capabilities
2016-03-20 12:59:25 +00:00
Hannah Wolfe
0ad93c3df2 Rewrite DB update to be explicit
refs #6301

- Replace builder & automated database upgrade with a set of explicit tasks
- Ensure the tasks can only happen if they need to
- Remove some duplicate code between fixture & db upgrades (more to do)
- Add tests
2016-03-17 21:17:19 +00:00
Sebastian Gierlinger
ef0945b09f Merge pull request #6606 from ErisDS/permission-test-fix
Fix role fixture ordering bug in pg tests
2016-03-15 20:23:46 +01:00
Hannah Wolfe
051a917e37 Fix role fixture ordering bug in pg tests
closes #6605

- ensure that roles are being output in order of their ID before asserting
- the asserting checks both the content and order of the array - this could be done differently as order doesn't really matter here, but will let us know if there are changes in DB behaviour
2016-03-15 19:08:25 +00:00
Sebastian Gierlinger
0c483a0997 Merge pull request #6599 from ErisDS/migrations-split
Split migrations/index.js & add tests
2016-03-15 13:47:44 +01:00
Sebastian Gierlinger
f950775b48 Merge pull request #6602 from ErisDS/version-tests
Improve `getDatabaseVersion` & versioning tests
2016-03-15 11:22:09 +01:00
Hannah Wolfe
2cfee3812f Split migrations/index.js & add tests
refs #6301

- changes createTable to use createTableIfNotExists, this is consistent with deletion
- splits out backup, reset, update and populate functions from migration/index into their own files
- moves the wrapped function for populatingDefaultSettings to fixtures.ensureDefaultSettings
- moves `modelOptions` down to the fixture files that actually use it
- adds test coverage for backup, reset and populate, but not for update as that needs refactoring
2016-03-15 10:11:33 +00:00
Sebastian Gierlinger
f5602f3527 Merge pull request #6601 from ErisDS/remove-should-sinon
Remove should-sinon dependency
2016-03-15 11:10:48 +01:00
Sebastian Gierlinger
d71f46a40a Merge pull request #6600 from ErisDS/config-fix
Always override database config + exit tests on error
2016-03-15 11:08:50 +01:00
Hannah Wolfe
81deb88263 Improve getDatabaseVersion & versioning tests
refs #6301

- `currentVersion` was leftover from before the first public release of Ghost!
- simplified the code for `getDatabaseVersion`
- improved & made consistent how errors are handled in `getDatabaseVersion`
- migration error handling updated to reflect the changes in `getDatabaseVersion`
- added tests for both `getDatabaseVersion` and `setDatabaseVersion`
2016-03-14 17:11:04 +00:00
Hannah Wolfe
e4a1797085 Remove should-sinon dependency
no issue

- removes should-sinon dependency from package.json
- rewrites all usages of should-sinon to use normal should assertions

Unfortunately, should-sinon has very minimal documentation  and therefore it is hard to discern what is considered a correctly-written assertion:
- in some cases, refactoring to use should-sinon causes false positives
- in other cases, assertions that work written in the normal way fail when written using should-sinon (e.g. getters, combos with rewire)
The additional overhead created by these issues outweigh any benefit from the easier-to-read assertions
2016-03-14 16:52:22 +00:00
Hannah Wolfe
2386a69f9d Always override database config + exit tests on error
refs #6354, #6495 & #6599

- don't allow config.database to be merged, instead, override it always
- make sure that route tests call done even when they error
2016-03-14 15:39:59 +00:00
Jason Williams
39dfb2c09a Merge pull request #6596 from ErisDS/export-clean
Exporter cleanup & tests
2016-03-12 19:38:19 -06:00
Hannah Wolfe
9309adc511 Exporter cleanup & tests
refs #6301

- change knex getter def to be configurable, else it is not testable
- remove exportPath and lang from config - neither are used
- add client_trusted_domains to tables which shouldn't be exported as there are no clients in the export
- change export signature to be an object with `doExport` function consistent with import & easier to test
- cleanup export code so it is clearer, easier to read & to test:
  - use mapSeries instead of sequence
  - use Promise.props instead of Promise.join
  - split functionality into smaller functions
- add test coverage
2016-03-12 19:01:25 +00:00
Sebastian Gierlinger
411dd47002 Merge pull request #6579 from jaswilli/auth-api
Refactor authentication API into pipeline format
2016-03-08 15:54:34 +01:00
Jason Williams
fe13503470 Refactor authentication API into pipeline format
Refs #5508
2016-03-07 11:53:54 -06:00
Austin Burdine
5779ebbd2b Merge pull request #6581 from kevinansfield/ember-cli-242
deps: ember-cli@2.4.2
2016-03-07 06:28:12 -07:00
Sebastian Gierlinger
21770c53da Merge pull request #6572 from ErisDS/data005-part1-fixpastfixtures
Data 005 - Part 1 - Fix Past Fixtures (refactor & test fixture migrations)
2016-03-07 11:26:30 +01:00
Kevin Ansfield
db8946c90e deps: ember-cli@2.4.2
no issue
- bugfix release: https://github.com/ember-cli/ember-cli/releases/tag/v2.4.2
2016-03-07 09:17:51 +00:00
Austin Burdine
244a444e38 Merge pull request #6576 from kevinansfield/ember-cli-241
deps: ember-cli@2.4.1
2016-03-03 06:53:06 -06:00
Kevin Ansfield
7e0eb5911d deps: ember-cli@2.4.1
no issue
- bugfix release - https://github.com/ember-cli/ember-cli/releases/tag/v2.4.1
2016-03-03 09:17:37 +00:00
Hannah Wolfe
b2659d0cbb Refactor & test fixture migrations
refs #6301

Fixtures:
- Removed all the old (and now broken) 003 fixture upgrades
- Split the 004 fixture upgrade tasks out, each into their own file
- Improved the versioning code that figured out which upgrades we should do
- Added lots of test coverage to make sure all the fixtures are still being run correctly.

Permissions fixtures:
- Changed the code that was populating permissions fixtures to be more automated & based only on what is in the permissions.json file.
- Added lots of test coverage to make sure all the permissions are still being created correctly.

Merging the two things:
- Merged the content of permissions.json and fixtures.json into fixtures.json, but using the new structure from permissions.json.
- Changed to use the new automated model & relation creation for all fixtures, not just permissions.
- The only thing that can't be auto-populated just now is the owner creation, I think that's important enough to do separately.
- There were (so far) never any permission updates, so code for updating fixtures stays the same through the merge.
- This results in two clear code paths: populate (fill out a brand new DB) and update (make any changes since the last version)

Test coverage is now 100% across both updates and populations.
2016-03-03 09:03:37 +00:00
Hannah Wolfe
4a2944d36a Merge pull request #6566 from acburdine/ghost-url-fix
Ensure null query options don't break ghost-url
2016-03-02 18:39:56 +00:00
Hannah Wolfe
95dc835358 Merge pull request #6569 from jaswilli/update-bluebird
Update bluebird
2016-03-02 18:23:43 +00:00
Jason Williams
1edf49daf7 deps: bluebird@3.3.3
- Finishes refactoring started in #6376.
- Fixes invalid Promise.map() call.
- Cleans up promise (rejection) handling.
2016-03-01 15:17:20 -06:00