Commit Graph

59 Commits

Author SHA1 Message Date
Kevin Ansfield 5606b9c068 Implemented first iteration of content snippets
closes https://github.com/TryGhost/Team/issues/411

- adds "Create snippet" icon to the editor toolbar
- uses the same link input component design for specifying snippet titles
- snippets are loaded in the background when the editor is accessed
- snippets are listed at the bottom of the card menus of the + and / menus
- clicking a snippet inserts the snippet's contents in place of the current blank section
2020-10-15 18:03:35 +01:00
Kevin Ansfield 68efc5bff3 Resolved "already declared in upper scope" linting warnings
no issue

- fixed all `no-shadow` linter warnings
- changed `no-shadow` eslint rule from `warn` to `error` so we don't re-introduce shadowed variables in the future
2020-10-05 09:56:21 +01:00
Kevin Ansfield c8a93925a3 Updated to fetch settings using `/settings/?group=` instead of `?type=`
refs https://github.com/TryGhost/Ghost/issues/10318

- primary change is in the settings service which is the only place we fetch the settings endpoint
- mocked APIs and fixture data updated to expect and to filter on `?group` rather than `?type`
2020-06-24 14:23:51 +01:00
Kevin Ansfield 8acc160003 Added missing renames of settings groups
refs https://github.com/TryGhost/Ghost/issues/10318, c5c50139ef

- the mocked settings endpoint was not returning any settings created with the old `blog` key which broke tests
2020-06-23 21:05:11 +01:00
Kevin Ansfield 312b9fb4e1 Added first pass bulk members delete confirmation and results display
no issue

- display a confirmation modal when bulk deleting members
- hit the `DELETE /members/?all=true` endpoint when confirming
- show counts of members deleted/skipped
- fix selection reset when leaving edit mode
2020-06-19 18:14:41 +01:00
Kevin Ansfield 2e3c72891e Updated members screen to work with final stats API naming
refs 071ab9774b

- stats API uses snake_case rather than camelCase to be consistent with the rest of Ghost's APIs
2020-05-26 12:26:04 +01:00
Kevin Ansfield 5de9483df8 Removed "members" from mocked stats API payload property names
no issue

- removes duplication from property names as the "members" part is implicit from the resource name
2020-05-25 10:35:39 +01:00
Kevin Ansfield 332cb72e25 Updated <GhMembersChart> to fetch stats from the API
no issue

- added mocked API for `/admin/members/stats/` that generates random data for the chart
- re-architected `<GhMembersChart>` to fetch data from the API rather than calculating stats from all members loaded in memory
- enabled mirage in development so that the chart can be tested before the live API is ready
2020-05-22 17:58:45 +01:00
Rishabh Garg 7319d11e94
Fixed tests for labels (#1493)
no issue

- Updated member settings css property in tests
- Added mock for label API
2020-02-14 16:37:25 +05:30
Naz Gargol 3ec3671aee
Added member "add" screen (#1411)
no issue

- We have a need to create a member manually, this changeset solves this problem.
- Added new member button to the member's screen
- Needed to be able to perform add member action
- Fixed inconsistent `createAt` naming. All models use consistent `createdAtUTC`, fixed it up so that members model follows the same pattern. If we want to change this pattern should probably happen for all models at once
- Fixed member avatar when creating a new member. If the values are completely empty the screen ends up being filled with empty space. Added some dummy initials which are recalculated once the member enters the name or an email
- Refactored DS naming for consistency. Nowhere else in the codebase 'DS' name is ever used, made this consistent
- Added missing validations in members form
- Simplified if conditions in the member list template. When using the if/esle statements unnecessary new-line symbols were inserted which made it hard to test. Also by using computed property view is much cleaner
- Updated member's model default value for `subscribed` to "true". It is turned on by default in the model layer  on the backend (ref: https://github.com/TryGhost/Ghost/blob/3.1.0/core/server/data/schema/schema.js#L330), this behavior is intended and should be the same on the frontend
2019-11-28 18:30:21 +07:00
Kevin Ansfield 5b0e9826f7 Fixed tests 2019-11-08 11:14:04 +07:00
Naz Gargol 8dff0ee6d4
🔥 Removed all subscriber feature related code (#1337)
refs https://github.com/TryGhost/Ghost/pull/11153

- Removed all subscriber feature related code
- The feature is being substituted by members
2019-09-26 15:58:01 +02:00
Kevin Ansfield 7c66d66551
🎨 Added auto-login to private site when viewing site preview in admin (#1286)
closes https://github.com/TryGhost/Ghost/issues/10995

- when first loading the site preview, if private mode is enabled submit the login form in the background to get the cookie before loading the iframe
- refactors post-authentication preloading to ensure it occurs before post-authentication route hooks are called
- adds `showSuccess` attribute to `<GhTaskButton>` so that when set to `false` it can stay in the running state after "success" to avoid state change flashes whilst waiting for a transition
2019-08-12 09:11:10 +01:00
Kevin Ansfield be07650154 Fix linting errors
refs https://github.com/TryGhost/Ghost-Admin/pull/1274

- fixes errors introduced from upgrading to eslint@6
2019-07-22 11:21:24 +01:00
Kevin Ansfield fa8a08e40b
Removed usage of ember-light-table in subscribers screen (#1191)
no issue

`ember-light-table` is falling behind Ember.js and other addon development and is increasingly causing issues with Ember deprecations and addon incompatibility.

- swaps `ember-light-table` usage for a straightforward table using `vertical-collection` for occlusion
- uses the same loading mechanism as the members screen with a slight optimisation where the initial load will fetch subscribers in batches of 200 until they are all loaded
- removes now-unused pagination mixin
- fixes duplicate subscriber validation handling
2019-05-07 12:39:56 +01:00
Peter Zimon ca5f9f1f6e Improved theme upload/activate flow and error styles (#1142)
no issue 

* Update error and warning styles
* Refined upload dialog
* Theme upload and activation style refinements
2019-04-05 17:27:14 +01:00
Kevin Ansfield f0ad9dcdc4 🐛 Fixed missing error notification when attempting to activate an invalid theme
no issue
- updates error handling to work with new v2 error response formats
  - `.errorType` -> `.error`
  - `.errorDetails` -> `.details`
2019-03-25 11:32:29 +00:00
Kevin Ansfield a5c69cc86d Removed usage of /configuration/timezones/ endpoint
no issue
- replaced timezones endpoint with `@tryghost/timezone-data` module
2019-02-26 12:37:50 +07:00
Kevin Ansfield 4ab77cbb21 Fixed "Authorization Failed" error screens when not logged in
no issue
- `/config/` can only be requested when authenticated
- updated `/config/` mock to look for an Authentication header and return a 403 if it's missing
- updated `ajax` service to add an `Authentication` header when authenticated in testing env (cookies are not present when testing)
- updated `config` service to add `fetchUnauthenticated()` and `fetchAuthenticated()` methods in addition to `.fetch()`
- updated `application` route to only fetch authenticated config when authenticated
- updated `signin` controller to correctly fetch config after sign-in
2019-02-26 10:38:00 +07:00
Kevin Ansfield e3d5689fe1 Updated gh-uploader to work with new /images/upload/ endpoint 2019-02-25 23:01:49 +07:00
Kevin Ansfield b34269b66c Updated config service to use new /site/ and /config/ endpoints 2019-02-25 21:47:17 +07:00
Kevin Ansfield c405f5c351 Removed usage of /configuration/private/ endpoint 2019-02-25 19:20:17 +07:00
Kevin Ansfield 75753b17cb Implemented first pass of member details screen 2019-02-22 18:32:09 +07:00
Nazar Gargol df5134deba Updated /images* response structure
refs #10438
2019-02-22 18:16:25 +07:00
Nazar Gargol 8f03ac3611 Renamed /uploads* endpoints to /images*
refs #10438
2019-02-22 18:16:25 +07:00
Kevin Ansfield 5254488121 Fixed custom integrations tests 2019-02-22 11:11:15 +07:00
Kevin Ansfield f8b03f50b6
🎨 Separated post and page list screens (#1101)
no issue
- added `page` model
- removed `page` param from Post model
- added pages screen with associated links
- added `:type` param to editor screens to work with the right models
- removed post<->page toggle and associated tour item
2019-02-22 10:17:33 +07:00
Kevin Ansfield 8e734d3c79 Added initial members model and associated mirage setup
no issue
- mirage is now enabled by default in development with logging (can be turned off once we're no longer relying on mocked members endpoints)
2019-01-22 17:18:44 +00:00
Kevin Ansfield ffbfb06e41
Bump dependencies (#1092)
refs https://github.com/TryGhost/Ghost/issues/10310
- bump liquid-fire (cleans up multiple deprecations)
- bump ember-sinon
- bump ember-optional-features
- bump ember-assign-helper
- bump ember-cli-dependency-checker
- bump ember-cli-mirage
- bump ember-cli-pretender
- bump ember-cli-es6-transform

Partial dependency bump. Keeping groups smaller so that any issues are easier to pin down if needed.
2019-01-08 14:39:37 +00:00
Katharina Irrgang d27c067bd1 Removed `invitedBy` from signup routes (#1087)
refs https://github.com/TryGhost/Ghost/issues/10286

- not used
- looking for more information? visit https://github.com/TryGhost/Ghost/pull/10291
2018-12-17 10:57:26 +00:00
Kevin Ansfield 29453bae8e Fixed webhook modal title showing "New webhook" when editing a webhook
refs https://github.com/TryGhost/Ghost/issues/10137
- adjust modal title depending on `webhook.isNew` state
- add acceptance tests for modal creation
- add missing mirage webhook factory
- mock integrations/api-keys/webhooks in test env rather than development
2018-11-12 16:31:47 +00:00
Kevin Ansfield 3d03670f15 Fixed saving of posts with tags using mirage
no issue
- similar to the previous fix for authors, tags also need to be converted from POJOs to mirage Model objects when creating/saving records in the mirage route handlers
- refactored the code so that the POJO->Model transform can be shared across post and update requests
2018-11-08 13:43:58 +00:00
Kevin Ansfield 9a9c954f66 Changed "new-webhook" modal to generic "webhook-form" modal
no issue
- the webhook form needs to be re-usable for the "edit webhook" modal
- renamed modal
- added logic to adjust the confirm button's text depending on the state of the passed in webhook model
2018-10-18 18:43:34 +01:00
Kevin Ansfield 519b736015
Added initial custom integrations UI (#1051)
refs https://github.com/TryGhost/Ghost/issues/9865, https://github.com/TryGhost/Ghost/issues/9942

- `integration`, `api-key`, and `webhook` models and respective mirage mocks
- moves integration routes around to match ember's concept of nested routes (nested routes reflect nested UI not nested URLs)
- adds custom integrations list to integrations screen
- adds custom integration screen
  - allow editing of integration details
  - show list of webhooks
  - webhook creation modal

NB: the `enableDeveloperExperiments` flag needs to be enabled in the `config.development.json` file for the custom integrations UI to be displayed until it's out of development.
2018-10-18 00:18:29 +01:00
Fabien O'Carroll 42912cf39b Use Admin API v2 with session auth (#1046)
refs #9865
- removed all `oauth2` and token-based ESA auth
- added new `cookie` authenticator which handles session creation
- updated the session store to extend from the `ephemeral` in-memory store and to restore by fetching the currently logged in user and using the success/failure state to indicate authentication state
  - ESA automatically calls this `.restore()` method on app boot
  - the `session` service caches the current-user query so there's no unnecessary requests being made for the "logged in" state
- removed the now-unnecessary token refresh and logout routines from the `application` route
- removed the now-unnecessary token refresh routines from the `ajax` service
- removed `access_token` query param from iframe file downloaders
- changed Ember Data adapters and `ghost-paths` to use the `/ghost/api/v2/admin/` namespace
2018-10-05 19:46:33 +01:00
Kevin Ansfield 3a7108c975
Use `filter` instead of `status` and `staticPages` params for post queries (#1025)
no issue
- `staticPages` API param is deprecated in favour of using the `filter` param
- switched `status` query to param to the `filter` param as well for consistency
2018-07-20 11:57:53 +01:00
Kevin Ansfield d6169c38ef Fixed publishmenu re-rending side-effects breaking tests
no issue
- we currently rely on a side-effect of the individual publish menu components calling `setSaveType` when they are rendered
- in tests sometimes the timing was not what we expected and the menu would swap components mid-save which then updated the save type and caused further problems
- added a guard so that we never swap the publish menu components whilst a save is in progress
2018-03-27 18:50:52 +01:00
Kevin Ansfield 38b138d759 Use token input to allow selection of multiple authors in PSM
requires https://github.com/TryGhost/Ghost/pull/9426
- fixed default token component display in {{gh-token-input}}
    - if no `tokenComponent` is passed to `{{gh-token-input}}` then it should default to the ember-drag-drop `draggable-object` component but instead it didn't output anything
    - put `draggable-object` in quotes because `{{component}}` needs a component name rather than an object
    - rename `option` attribute to `content` to match the default `{{draggable-object}}` interface
- add embedded `authors` attr to the Post model
    - ensure authors is populated when starting new post
    - add validation for empty authors list
- swap author dropdown for a token input in PSM
- show all post authors in posts list
- update tests for `authors`
  - always provide through an authors array
  - fix mirage serialisation for paginated responses (embedded records were not being serialised)
- unify tags and author inputs design
  - remove highlight of primary tags
  - highlight internal tags
  - remove unnecessary/redundant title attributes on tags
  - use SVG icon for "remove option" button in token inputs
2018-03-27 18:50:52 +01:00
Austin Burdine c6ddf3eb80 Bump ember-cli-mirage to 0.4.2 (#969)
closes TryGhost/Ghost#9433
- remove unnecessary bower deps
- update mirage usage
- fix tests
2018-03-19 09:53:17 +00:00
Kevin Ansfield 7afb88a0c2 Switch to eslint-plugin-ghost extending plugin:ghost/ember
no issue
- fix lint errors in lib/gh-koenig
- fix ghost:base eslint errors
- update ember plugin refs, remove ember-suave plugin refs
- remove old jshint refs
- add `lint:js` script
- switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
2018-01-12 12:17:56 +00:00
Kevin Ansfield 3da1702af9 Fix Ember deprecations and warnings (#895)
no issue 

- `controller.content` will no longer be an alias to `controller.model`
- split relationships and `attrs` in Post model, add missing transforms
- fix unknown `error` field in payload warning when `/users/me` returns 404 during tests
- fix unsafe style binding warnings
2017-10-13 16:39:49 +07:00
Kevin Ansfield fb3dbbdff8 Fixed normalization of attrs in Mirage config and tests (#872)
no issue

We weren't being consistent in our use of Mirage's `normalizedRequestAttrs()` method which meant that in certain cases Mirage's internal database had duplicated attrs, the original set being `camelCase` and the new/updated set being `underscore_case` which was not only confusing but can lead to errors or unexpected behaviour in tests.

- updated Mirage config to always normalize where necessary
- updated tests to always use `camelCase` attrs
- added `HEAD` route handler for gravatar to avoid unknown route noise in tests
2017-09-28 09:33:00 +07:00
Kevin Ansfield 2e12987938 🎨 Enabled Unsplash integration by default (#862)
no issue

- Unsplash integration is enabled by default for all users
- it's no longer necessary to create your own Unsplash application and configure your application ID
2017-09-20 12:19:48 +02:00
Kevin Ansfield 6cb04e4c41 Removed defunct Ghost OAuth code (#848)
refs https://github.com/TryGhost/Ghost/issues/8958

- Ghost OAuth isn't coming back, time for the code to disappear and simply all the things
- fixes the `Usage of router is deprecated` notices that flood the console/test logs when testing
2017-09-04 21:17:04 +02:00
Kevin Ansfield 88449ed639 Switched from ember-cli-shims to new module imports (#779)
no issue

- add eslint-plugin-ember, configure no-old-shims rule
- run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports
- further cleanup of Ember globals usage
- remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
2017-08-22 14:53:26 +07:00
Kevin Ansfield 1e3191b811 Unsplash integration
closes https://github.com/TryGhost/Ghost/issues/8859, requires https://github.com/TryGhost/Ghost/pull/8895
- adds Unsplash app to app settings
  - enable/disable toggle
  - validation and testing of Unsplash App ID
  - Unsplash App ID field hidden if provided via Ghost config
  - adds `fetchPrivate` method to `config` service to pull config that requires authentication and updates authentication routines to fetch private config
- adds Unsplash buttons to editor toolbar and `{{gh-image-uploader}}`
  - only present when Unsplash app is enabled
  - opens Unsplash image selector when clicked
  - `{{gh-image-uploader}}` has a new `allowUnsplash` attribute to control display of the unsplash button on a per-uploader basis
- adds Unsplash image selector (`{{gh-unsplash}}`)
  - uses new `unsplash` service to handle API requests and maintain state
  - search
  - infinite scroll
  - zoom image
  - insert image
  - download image
- adds `{{gh-scroll-trigger}}` that will fire an event when the component is rendered into or enters the visible screen area via scrolling
- updates `ui` service
  - adds `isFullscreen` property and updates `gh-editor` so that it gets set/unset when toggling editor fullscreen mode
  - adds `hasSideNav` and `isSideNavHidden` properties
- updates `media-queries` service so that it fires an event each time a breakpoint is entered/exited
  - removes the need for observers in certain circumstances
2017-08-15 16:01:12 +01:00
Kevin Ansfield a9c8d7258c 🐛 fix autosave+transition on title blur with empty title (#767)
refs TryGhost/Ghost#8525
- fix `saveTitle` action
	- don't abort title save when we have an empty title
	- force a "dirty" state so that the save actually happens
- add acceptance test for title blur behaviour
- extract multiple instances `"(Untitled)"` into a const
2017-07-10 18:33:05 +07:00
Kevin Ansfield 9c4ae87d8f 🐛 prevent session sync issues with multiple tabs/refreshes (#772)
refs https://github.com/TryGhost/Ghost/issues/8616

- only refresh tokens on boot if we last refreshed more than 24hrs ago - this should prevent rapidly changing access/refresh tokens when opening new admin tabs or refreshing whilst other tabs are open
- fix token refresh test which was testing it's own behaviour instead of the applications 🙈

This may not be the full solution to the session issues but it closes one potential culprit and should at least reduce token churn which can only help track down the real cause.
2017-07-10 12:18:19 +02:00
Kevin Ansfield 7eefbba69f 💄🐷 sort-imports eslint rule (#712)
no issue

- adds `eslint-plugin-sort-imports-es6-autofix` dependency
  - implements ESLint's base `sort-imports` rule but has a distinction in that `import {foo} from 'bar';` is considered `multiple` rather than `single`
  - fixes ESLint's autofix behaviour so `eslint --fix` will actually fix the sort order
- updates all unordered import rules by using `eslint --fix`

With the increased number of `import` statements since Ember+ecosystem started moving towards es6 modules I've found it frustrating at times trying to search through randomly ordered import statements. Recently I've been sorting imports manually when I've added new code or touched old code so I thought I'd add an ESLint rule to codify it.
2017-05-29 20:50:03 +02:00
Kevin Ansfield 9db932ee48 streamline image uploads in settings/general (#702)
refs TryGhost/Ghost#8455

- ensure `uploadUrls` and `errors` are cleared in `gh-uploader` when new uploads are started
- yield `isUploading` in `gh-uploader` component
- replace image upload modals in settings/general with in-page uploads
2017-05-23 10:50:04 +02:00