Commit Graph

6237 Commits

Author SHA1 Message Date
David Balderston
c55140d0db Change default setting for to inside foreach helper
closes #6604

* Default for `to` was always `(from-1) + limit`. This caused a problem
where the `to` value could be higher than the length of the number of
blog posts, causing `@last` to never be called/reached
* Now sets `to` to have a default of `length` and if a limit was sent
through and not higher than `length`, to then set `to` to that value
* Added some extra tests for `@last` and `@first` use cases
* Added some inline commenting
2016-03-17 17:52:38 -07: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
JT Turner
3db9913191 deps: bluebird@3.1.2
closes #6361
- Updated bluebird dependency to latest 3.1.2.
- Updated update check to handle promises not resolving to arrays.
- Reviewed all other promise code and it looks good.
- Updated code using settle to use the new reflect function.
2016-03-01 14:47:23 -06:00
Austin Burdine
152d74b39e Merge pull request #6567 from kevinansfield/ember-upgrades
Ember 2.4.0 upgrades
2016-03-01 09:04:12 -06:00
Kevin Ansfield
4d35f954b4 deps: ember-data@2.4.0 2016-03-01 12:49:43 +00:00
Kevin Ansfield
73f2a61feb deps: ember@2.4.1 2016-03-01 12:49:43 +00:00
Kevin Ansfield
f451ff5aef deps: ember-cli@2.4.0 2016-03-01 12:49:28 +00:00
Austin Burdine
193e033f99 ensure null query options don't break ghost-url
closes #6565
2016-02-29 00:25:38 -06:00
Austin Burdine
bd3622b980 Merge pull request #6563 from szelpe/skipLink
Fixed skiplink positioning
2016-02-28 09:21:18 -06:00
Peter Szel
956932b07f Fixed bugs regarding the published date input field validation.
refs #5777

- removing error message from the previous validation
- only checking if date is in the past if the input date is valid to begin with
- always updating the view, even if the date hasn't changed to make sure the date format stays consistent
2016-02-28 01:33:24 +00:00
Peter Szel
6387b87fab Fixed skiplink positioning
refs #5986

- removed static position of the skiplink to prevent pushing the page content down
- only applying :focus CSS selector to focusable sr-only content
2016-02-27 15:37:15 +00:00
Sebastian Gierlinger
ba96847caa Merge pull request #6525 from AileenCGN/timezones_api
Including timezones API in configuration endpoint
2016-02-24 16:37:33 +01:00
Aileen Nowak
e347f95f15 Including timezones API in configuration endpoint
refs #6406
- endpoint configuration/timezones refers to timezones.json file in data
- added route for endpoint in api.js to use method read in configuration.js
2016-02-24 16:44:01 +02:00
Kevin Ansfield
f4cdf4dc15 Merge pull request #6561 from acburdine/test-fixes
Ember client test fixes
2016-02-24 09:36:24 +00:00
Kevin Ansfield
5de57f892d Merge pull request #6548 from ErisDS/config-api
Restructure Configuration API endpoint
2016-02-24 09:34:51 +00:00
Austin Burdine
df720934e1 various test 🐛 fixes
refs #6550
- cleanup deprecation messages
- fix get `undefined` error in tests
2016-02-23 23:27:57 -06:00
Austin Burdine
1fabe0805a Merge pull request #6558 from kevinansfield/refactor-feature-service
Refactor the feature service
2016-02-23 22:03:24 -06:00
Sebastian Gierlinger
81f119d098 Merge pull request #5888 from ErisDS/improve-fileserve
Serve immediate 404 for static files (no fallthru)
2016-02-23 17:15:21 +01:00
Kevin Ansfield
ad1fbfa456 Refactor the feature service
no issue
- removes the unneeded manual caching of the settings object
- fixes multiple API requests to fetch settings when using the feature service
2016-02-23 15:22:32 +00:00
Sebastian Gierlinger
6b852c11d8 Merge pull request #6553 from ErisDS/slack-unfurls
Strutured data: Slack Unfurls & published_at fix
2016-02-22 20:17:04 +01:00
Sebastian Gierlinger
37ef512a19 Merge pull request #6543 from ErisDS/fixture-i18n
Remove i18n from migration output
2016-02-22 09:49:55 +01:00
Sebastian Gierlinger
8d6ec8555c Merge pull request #6544 from ErisDS/client-secret
Move client secret logic into the model
2016-02-22 09:49:05 +01:00
Sebastian Gierlinger
24e6a93f22 Merge pull request #6555 from ErisDS/not-context
Rename confusing 'context' variables
2016-02-22 09:47:06 +01:00
Sebastian Gierlinger
62f9bff597 Merge pull request #6556 from ErisDS/i18n-jsdoc
Fix jsDoc on i18n.t()
2016-02-22 09:33:45 +01:00
Hannah Wolfe
8cef27d698 Fix jsDoc on i18n.t()
no issue

- my IDE has been moaning at me for every usage of i18n.t that didn't have 2 args
- this uses the optional notation and expects an object instead of JSON (JSON requires keys to be quoted)
2016-02-22 01:57:22 +01:00
Hannah Wolfe
dcc8bcc4f1 Strutured data: Slack Unfurls & published_at fix
refs #6534

- fixes a bug where published_at was incorrectly falling back to the created_at date
- updated meta index to get author name
- add written by & filed under labels + data if the values are present (only on posts/pages)
- updated tests
2016-02-22 01:45:00 +01:00
Hannah Wolfe
10fc320cc8 Rename confusing 'context' variables
no issue
- In Ghost, 'context' means the page or section of a blog we're currently within
when rendering a theme, e.g. 'post' or 'tag' or 'home'.
- In handlebars 'context' refers to the blob of JSON that is tied to a template.
- These two uses of the word 'context' have gotten very confusing, so I've removed all usage of 'context' within the Ghost handlebars helpers, EXCEPT where they actually refer to the current context (e.g. the is helper)
2016-02-21 22:07:15 +00:00