Commit Graph

265 Commits

Author SHA1 Message Date
Sanne de Vries
a83830db7a Styled publishing action dropdown in publish menu 2021-08-26 13:01:45 +02:00
Naz
9e84441e75 Added publishing action dropdown to publish menu
refs https://github.com/TryGhost/Team/issues/947

- Added a "distribution" dropdown component to the post publish menu allowing to select from one of three available types of distribution: publish, poblush&send, and send
2021-08-25 22:20:11 +12:00
Kevin Ansfield
1ad2c05d37 Bumped eslint-plugin-ghost and fixed linter errors
no issue

- new linting rules that needed fixing:
   - calling `super` in lifecycle hooks
   - no usage of String prototype extensions
2021-07-15 15:27:29 +01:00
Kevin Ansfield
c646e78fff Made session.user a synchronous property rather than a promise
no issue

Having `session.user` return a promise made dealing with it in components difficult because you always had to remember it returned a promise rather than a model and had to handle the async behaviour. It also meant that you couldn't use any current user properties directly inside getters which made refactors to Glimmer/Octane idioms harder to reason about.

`session.user` was a cached computed property so it really made no sense for it to be a promise - it was loaded on first access and then always returned instantly but with a fulfilled promise rather than the  underlying model.

Refactoring to a synchronous property that is loaded as part of the authentication flows (we load the current user to check that we're logged in - we may as well make use of that!) means one less thing to be aware of/remember and provides a nicer migration process to Glimmer components. As part of the refactor, the auth flows and pre-load of required data across other services was also simplified to make it easier to find and follow.

- refactored app setup and `session.user`
  - added `session.populateUser()` that fetches a user model from the current user endpoint and sets it on `session.user`
  - removed knowledge of app setup from the `cookie` authenticator and moved it into = `session.postAuthPreparation()`, this means we have the same post-authentication setup no matter which authenticator is used so we have more consistent behaviour in tests which don't use the `cookie` authenticator
  - switched `session` service to native class syntax to get the expected `super()` behaviour
  - updated `handleAuthentication()` so it populate's `session.user` and performs post-auth setup before transitioning (handles sign-in after app load)
  - updated `application` route to remove duplicated knowledge of app preload behaviour that now lives in `session.postAuthPreparation()` (handles already-authed app load)
  - removed out-of-date attempt at pre-loading data from setup controller as that's now handled automatically via `session.handleAuthentication`
- updated app code to not treat `session.user` as a promise
  - predominant usage was router `beforeModel` hooks that transitioned users without valid permissions, this sets us up for an easier removal of the `current-user-settings` mixin in the future
2021-07-08 14:54:31 +01:00
Rishabh
64819714a7 Added custom segment option to post settings access option
refs https://github.com/TryGhost/Team/issues/822

With multiple products flag we are re-enabling segmentation by product for posts. This change adds new segment option for post access option in post-settings menu, which allows option to choose specific products for post access.

- updates post settings and post settings labs menu to add new option for segment
- handles visibility filter changes for API based on selected segment
- the new behavior is behind the alpha flag for multiple products
2021-07-05 17:14:26 +05:30
Kevin Ansfield
0d30077325 Switched to new component for labs feature image redesign
refs https://github.com/TryGhost/Team/issues/771

- added `<GhEditorFeatureImage>` for more flexibility than offered by `<GhImageUploaderWithPreview>`
  - updated to more closely match intended designs
- removed alt/caption support from `<GhImageUploaderWithPreview>` as it's no longer used
- fixed upload/delete/upload not working due to file input references getting out of sync
2021-06-16 17:56:25 +01:00
Kevin Ansfield
de560733c5 🎨 Reverted ability to set post access level to labels
refs https://github.com/TryGhost/Team/issues/581

Setting post visibility to a label results in undesirable and confusing behaviour with no good way to manage access long-term. Coupled with products being limited to a single product for now we're reverting the UI back to the "Public", "Members", and "Paid" options.
2021-05-14 16:01:14 +01:00
Kevin Ansfield
3e4b9a6865 🎨 Updated post settings menu visibility option to support member segments
https://github.com/TryGhost/Team/issues/581

The API now supports `posts.visibility` being an NQL string as well as the special-case `'members'` and  `'paid'` values so the post settings menu visibility select needs to be updated to reflect that.

- swapped visibility dropdown for two radio buttons, "Public" and "Members-only" which uses the `<GhMembersSegmentSelect>` component
- updated post model to use a `visibility-string` transform
  - converts `members` and `paid` to/from the NQL equivalent for correct display in the segment select
- updated post model with two additional properties `isPublic` and `visibilitySegment`
  - `isPublic` helps with the radio button display
  - `visibilitySegment` allows fallback to the default content visibility setting when set to public
- added validation for `post.visibility` so we can show an error and skip saving when members-only is selected and the segment select is cleared
- deleted the now-unused `<GhPsmVisibilityInput>` component
2021-05-10 20:34:23 +01:00
Kevin Ansfield
8e8059cc0c Skipped test that broke with FF85 on linux
no issue

- possible difference in `localeCompare()` ordering, edge case enough not to worry about for now
2021-02-10 09:23:29 +00:00
Kevin Ansfield
27dadcf1c4 Switched from v3 to canary API
refs https://github.com/TryGhost/Team/issues/221

- we're getting ready for the 4.0 API version so we should be using canary to fully test the changes
- changed from `v3` to `canary` in `utils/ghost-paths.js`
- updated mirage and tests to use `ghostPaths` util so we only need to change the version in one place in the future
2021-02-05 09:12:26 +00:00
Kevin Ansfield
b466e844e4 Removed unused GhLaunchWizard tests
no issue

- tests were fragile because they were checking content that is undergoing heavy iteration
- tests were not testing anything important
2021-02-02 16:08:06 +00:00
Kevin Ansfield
4b5f3f64a4 Added launch wizard prototype
refs https://github.com/TryGhost/Team/issues/450

Initial prototype of new launch-site wizard, meant to speed up the setup of a members site with the following steps:

1. Customise design
2. Connect Stripe
3. Set subscription pricing

- added wizard link to dashboard screen
- added `/launch/*` screens representing the wizard steps
- duplicated and refactored relevant general and members setting code and templates into each step
2021-02-02 16:08:03 +00:00
Kevin Ansfield
72d8b4f14d Reverted launch wizard prototype
no issue

- removing launch wizard from master ready to re-apply in 4.0 branch
2021-01-21 09:02:19 +00:00
Kevin Ansfield
26f4e79ac7 Fixed test (updated expected text in) 2021-01-19 22:38:32 +00:00
Kevin Ansfield
00c73bbf68 Actually fixed tests 2021-01-18 21:16:00 +00:00
Kevin Ansfield
60be92bbc0 Fixed tests 2021-01-18 21:07:48 +00:00
Kevin Ansfield
d48abaa1f8 Added outline launch wizard framework
refs https://github.com/TryGhost/Team/issues/450

- adds `launch/*` routes corresponding to launch wizard steps
- sets up navigation between each wizard step
- adds components for each `launch/*` step to contain step-related functionality and facilitate later refactoring to a generalised wizard component
- adds link to the launch wizard from the dashboard screen
2021-01-18 13:48:23 +00:00
Sanne de Vries
77e24d4d25 Fixed test failure for post time format 2020-12-11 10:03:29 +01:00
Rishabh Garg
f068e40723 Added new members CSV importer (#1797)
no refs
depends on https://github.com/TryGhost/Ghost/pull/12472

The members CSV importer gets an overhaul and works with new importer module in members service, performing the import in a background job when the import will take too long to complete in a reasonable time and send an email with data on completion. Also includes updated CSV mapping UI and error handling to allow easier import from different type of exports.

Co-authored-by: Fabien O'Carroll <fabien@allou.is>
Co-authored-by: Peter Zimon <zimo@ghost.org>
2020-12-10 01:02:31 +05:30
Nazar Gargol
240edf89aa Added automatic 'first_name' column mapping for members CSV importer
no issue

- When columns which match /name/ patter are present in imported CSV they should detect the mapping to 'name' column automatically
2020-08-20 15:04:35 +12:00
Nazar Gargol
670c33f2fe Reenabled members importer tests
refs 2bf69f94e7

- Tests were temporary disabled to unblock the release.
- The solution for failing tests was adding a "waitFor" statement which allowed asyncronous CSV parsing to finish
2020-07-16 23:59:48 +12:00
Nazar Gargol
2bf69f94e7 Removed developerExperiments flag from behind updated members importer
no issue

- Removes redesigned members importer features from behind `enableDeveloperExperiments` flag enabling it by default for everyone
- Had to disable some of the tests for future investigation to unblock the release
2020-07-13 23:55:07 +12:00
Peter Zimon
f74ca902c2 Added sample CSV link to members import
no refs.
- added link to a sample CSV in members import start screen
2020-07-09 17:30:24 +02:00
Peter Zimon
59ed8d718d Members import refinements
no refs.
- updated and removed copy on mapping screen
2020-07-09 14:42:29 +02:00
Peter Zimon
c611f65f53 Refined members import modal
no refs.
- fixed title logic
- fixed stripe validation message
2020-07-09 12:12:53 +02:00
Nazar Gargol
bcfc3792cd Removed invalid and duplicate email validations in members importer 2020-07-09 17:55:40 +12:00
Peter Zimon
36613212bb Fixed test for member import validation
no refs.
- fixed copy for member import validation test
2020-07-08 16:05:44 +02:00
Nazar Gargol
2da05338dd Fixed failure to render gh-members-import-table compontent
refs 4ee30dc5bd

- The tests were failing because there was no protective code to check for empty parameters.
2020-07-08 23:11:07 +12:00
Peter Zimon
6511a47524 Fixed tests
no refs.
2020-07-07 18:18:00 +02:00
Peter Zimon
1dd2a3db07 Updated styles for members import
no refs.
- added spinner to validation state
- applied styles to pre-validation step
- applied styles to import results
2020-07-07 17:53:59 +02:00
Rish
f8b2092f6c 🐛 Fixed nav item not saving updated value on keyboard save
no issue

- Fixes nav item values not saving on keyboard save shortcut
- Nav items value was only being updated in settings on focus out from text field.
- In case of keyboard save, focus out didn't happen so old value got saved and re-populated
- Change fixes to update setting value while typing
2020-07-07 14:47:10 +05:30
Nazar Gargol
39c4fec9ea Improved validation process for members CSV import
no issue

- A new validation stage has been introduced as a second step after CSV file has been dropped. It is meant to catch any obvious validation errors and output detailed statistics about
- These improvements also improve sampling logic which increases sample size to 30 non-empty cells which are used to validate stripe_customer_ids when there's such need.
- New sampling logic also introduces improved automatic field type detection which allows to better map email and stripe_customer_id fields to CSV columns
2020-07-07 00:28:30 +12:00
Nazar Gargol
e36b79c940 Added field mapping column to members importer gird
no issue

- Adds UI to map imported csv fields to ones accepted by Ghost API
- Includes automatic mapping detection for emails and stripe_customer_ids
2020-07-03 16:54:21 +12:00
Kevin Ansfield
8f8fcfc8bb Added UTC offset to scheduled editor status text
refs https://github.com/TryGhost/Ghost/issues/11965

- updated the `{{gh-format-post-time}}` helper that is used in editor status and in post settings menu email sub-menu for displaying email sent time
2020-07-01 20:37:46 +01:00
Kevin Ansfield
6d55e46b73 Fixed gh-format-post-time tests
refs eacf8a72d8

- updated to reflect change of "x hours" display from <15mins to <12hrs
2020-07-01 13:33:25 +01:00
Nazar Gargol
08853fac2d Fixed member import test
refs 09f4a48bc5

- The copy was changed, test needed to be updated as well.
2020-07-01 17:46:50 +12:00
Kevin Ansfield
fcb9b87884 Renamed activeTimezone setting to timezone
refs https://github.com/TryGhost/Ghost/issues/10318

- API has been updated to still work with `active_timezone` for backwards compatibility but it makes sense for the client to match the underlying settings keys
2020-06-24 15:34:59 +01:00
Kevin Ansfield
9348858bbe Added missing renames of settings groups
refs https://github.com/TryGhost/Ghost/issues/10318, 6d83c30f01

- 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
Nazar Gargol
6aefc005f8 Removed email validation test from members import validator
refs 2dfff367b9

- The test was removed because feature is no longer needed.
- Qoute from Zimo: " reason: it’s based on a sample so we don’t know for sure how much of the data is actually affected. we might bring it back in the future though"
2020-06-19 14:20:56 +12:00
Nazar Gargol
29c1b2f18c Commented out broken test untill the case clears out
no issue

- Need to understand if email validation was removed from the client intentionally.
2020-06-19 00:10:30 +12:00
Nazar Gargol
f62554934d Fixed one of failing member import validation tests 2020-06-18 23:34:49 +12:00
Nazar Gargol
131fd8fe2c Fixed failing test
refs ed98d89771
2020-06-18 18:11:15 +12:00
Nazar Gargol
ed98d89771 Added imported members csv data preview
no issue

- Adds a table representation of data present in a CSV file that is about to be imported. Allows to navigate through data to see how exactly the file would be parsed on server
2020-06-18 17:47:04 +12:00
Kevin Ansfield
7331f8feed Fixed multiple no-shadow linting errors 2020-06-17 09:35:46 +01:00
Daniel Lockyer
282ce16d2c Fixed error message in tests
no issue
2020-06-16 22:06:11 +01:00
Nazar Gargol
fca6d3300d Renamed members import/export endpoints to match API changes
refs 5f00619d1a
2020-06-16 18:13:06 +12:00
Nazar Gargol
095e29d83d Added imported member count to the "Import" button
no issue

- When importing members from CSV file this change shows total amount of members that will attempt to be imported
2020-06-13 00:51:19 +12:00
Nazar Gargol
060b0e759b Fixed isStripeEnabled usage in import validator tests
refs c63a0e6826

- Reason for the fix same as in the referenced commit
2020-06-12 18:28:15 +12:00
Nazar Gargol
c3d141dd03 Added improved validations for 2nd step of members import
no issue

- Adds validations for imported CSV data
- These checks include obvious validation checks for data - like if email addresses are valid, checking if Stripe configured when entries with stripe_customer_id are present and additional server-side validation for entries with stripe_customer_id to check if they appear in connected Stripe account
- The validation set is calculated by naive choosing of first 5, middle 5 and 5 tail records from imported set. This logic comes from observations that errors usually apear withing "test" records in the beggining or the end of the file. These selection rules might change in the future if we find a need for it.
- Adds papaparse CSV parser, which was chosen for it's maturity and relatively small minified size. In the future this library should be lazy-loaded to make the first page load UX nicer
2020-06-12 17:22:36 +12:00
Peter Zimon
8a88f31a91 Fixed test for member import dialog copy changes
no refs.
2020-06-05 15:41:00 +02:00