Commit Graph

117 Commits

Author SHA1 Message Date
Daniël van der Winden
0412decaec
Excerpt form error fix (#20730)
fixes
https://linear.app/tryghost/issue/DES-435/excerpt-in-post-settings-has-an-inconsistent-error-state

The excerpt form field seemed to not be properly handling errors.
However, it was a case of the error styling being overruled by the
regular styling, causing the red border to only show upon `:focus` when
there is an error in the excerpt.

I've rewritten the logic to be slightly less obfuscated and added some
CSS to circumvent the issue.
2024-08-12 09:35:21 +00:00
Kevin Ansfield
9ca1f3ce24
Renamed subtitle to excerpt (#20334)
no issue

We've settled on using "excerpt" naming in place of "subtitle" to better reflect the underlying property name and tie in with themes and historical usage.

- added migration to rename the `show_subtitle` newsletter setting to `show_excerpt`
- renamed all places in the codebase that referenced subtitle
2024-06-05 17:59:30 +01:00
Kevin Ansfield
9ab9a88d5b Adjusted subtitle copy
closes https://linear.app/tryghost/issue/MOM-180
closes https://linear.app/tryghost/issue/MOM-184
2024-06-04 09:31:00 +01:00
Ronald Langeveld
833ac83921
Added validation logic to in-editor subtitle (#20284)
closes https://linear.app/tryghost/issue/MOM-150

- use our validation engine to display an error state when >300 characters have been typed in the subtitle input field

---------

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2024-06-03 11:02:18 +00:00
Sanne de Vries
c157619e3e
Fixed error message of the date-time-picker not breaking onto next line (#20221)
REF DES-261

- Also updated error message copy of both the date-time-picker and the
date-picker to be friendlier.
2024-05-16 14:59:07 +00:00
Kevin Ansfield
b9c2989325
Cleaned up unused Post.statusScratch property (#18817)
no issue

- remnant from earlier code that is no longer needed/used
2023-11-01 11:53:29 +00:00
Naz
cc4ff8c6d4 Added collections CRUD UI
refs https://github.com/TryGhost/Team/issues/3168

- This is basic scaffolding for collection resources UI in Admin. For the most part it's a copy-paste of tags code with slight modifications to fit the collections usecase
2023-05-23 17:26:47 +07:00
Michael Barrett
ef0b863c2b
🐛 Fixed validation error when creating 0% offer (#16803)
closes https://github.com/TryGhost/Team/issues/3073

Fixed validation error when creating 0% offer. Issue was occurring due
to a falsy check on the offer value. Have resolved by having a more
strict check on the offer value based on the possible empty value it can
be - If creating a new offer without providing an offer value, the value
will be `undefined`. If supplying an offer value, then removing the
offer value, the value will be an empty string. This check prevents `0`
being classed as an invalid value.
2023-05-16 12:03:37 +01:00
Kevin Ansfield
581f0b34b4
🐛 Fixed missing validation of offer amounts in the admin panel (#16022)
closes https://github.com/TryGhost/Team/issues/2380

- improved offer validation for `amount` field to cover all type/amount cases
- added validate-on-blur to the amount field to match our standard validation behaviour
- added re-validation of the amount field when the type is changed and the amount gets reset
- removed the internal parsing of a decimal trial days entry to an integer so the field value matches what is set internally and we let the user know that partial trial days are not supported

Non-user-facing refactors:
- renamed `_saveOfferProperty` to `_updateOfferProperty` to better reflect what it does
- fixed missing indentation for conditional blocks in the offer template
2023-01-03 09:23:11 +00:00
Simon Backx
b615c9f7d2
Added post scheduling Playwright test and loosened time restrictions (#15960)
refs https://github.com/TryGhost/Team/issues/2371

- Adds a test that schedules a post 5 seconds in the future and waits
for it to be published
- Reduced the time restrictions for scheduling: 
    - The minimum time in the frontend is now 5 seconds in the future (came
from 5 minutes in the future)
    - The time picker now suggests 10 minutes in the future instead of the
minimum scheduling time (came from 5 minutes)
    - In the backend, a post will be allowed to be scheduled if it is at
least 2 minutes in the past (came from 2 minutes in the future)
    - The scheduler will publish a post if it is at least 5 minutes in the
past, and maximum 5 minutes in the future (came from 2 minutes)
2022-12-07 17:29:36 +01:00
Kevin Ansfield
786e0ac9c5
Updated ValidationEngine to support bare native class models (#15567)
no issue

- if a plain native class instance with tracked properties is validated against the `ValidationEngine` and it's associated validators would cause errors by assuming that the instance has a `.get()` method
- updated all model access in `ValidationEngine` and the validators to use direct property access which works for both native class and `EmberObject` instances
2022-10-07 20:13:42 +01:00
Kevin Ansfield
fa84808048 Dropped ember-cli-moment-shim dependency
no issue

Since `ember-moment@10.0` it's not been necessary to use the `ember-cli-moment-shim` package, with `moment` instead being usable directly via `ember-auto-import`. Getting rid of the shim package is necessary for compatibility with `embroider`, Ember's new build tooling.

- dropped `ember-cli-moment-shim` dependency
- added `moment-timezone` dependency and updated all imports to reflect the different package
- worked around `ember-power-calendar` having `ember-cli-moment-shim` as a sub-dependency
  - added empty in-repo-addon `ember-power-calendar-moment` to avoid `ember-power-calendar` complaining about a missing package
  - added `ember-power-calendar-utils` in-repo-addon that is a copy of `ember-power-calendar-moment` but without the build-time renaming of the tree for better compatibility with embroider
2022-09-24 13:28:23 +02:00
Hakim Razalan
e376ef0242
🐛 Fixed Hidden error in "Add tier" modal (#15361)
closes https://github.com/TryGhost/Ghost/issues/15290

- Capture error from model errors
- Add hasValidated for name property to properly mark field as error/success
- Add property to hasValidated after each failed validation
- Wrap saving on try-catch to suppress uncaught exception (validation error)
2022-09-13 09:23:54 +01:00
Georg Grauberger
36d9ae36ae
Added secret handling for webhooks (#13980)
closes: https://github.com/TryGhost/Team/issues/1203
refs: https://github.com/TryGhost/Ghost/issues/9942

- Ensures that the webhook secret is validated and saved in Ghost admin
- Then makes use of this value by optionally adding an X-Ghost-Signature header that effectively signs the webhooks
- This allows for verifying the source of a webhook coming from Ghost is truly Ghost.
- Uses the same pattern as GitHub uses: https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks

Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
2022-08-23 16:34:32 +01:00
Djordje Vlaisavljevic
824d03c803 Updated error message
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 21:27:02 +02:00
Rishabh
728b2d36e1 Updated trial duration validation for new offers
refs https://github.com/TryGhost/Team/issues/1726

- handles negative trial duration to show inline errors in offer creation UI
2022-08-11 12:03:38 +05:30
Rishabh
b8acc9ef19 Wired trial offer UI to data
refs https://github.com/TryGhost/Team/issues/1726

- wires creating new trial offers in the Admin UI
2022-08-11 12:03:38 +05:30
Kevin Ansfield
90a080e0b8 Update dependency eslint-plugin-ghost to v2.14.0 (#2441)
no issue

- bumped dependency
- fixed all new lint failures
- removed deprecated `ember-cli-eslint`
  - it was tying us to an old version of `eslint` resulting in missing rule definition errors when linting was run as part of `yarn dev` and `ember test`
  - we run linting separately in CI so we don't need linting to run _again_ on each of our ember test runs
2022-08-03 12:21:16 +01:00
Kevin Ansfield
7a5f15414b Fixed scheduled publishedAt validation being triggered unexpectedly
no issue

Problem:
- the server stores time with second-level precision but we send milliseconds
- when scheduling a post we were storing the selected publish-at time in the PublishOptions instance with non-zero milliseconds as the initial date was based on now+5mins
- when we were saving after the initial schedule that millisecond-containing time was still being used resulting in a perceived time difference in our client-side and server-side validations indicating that the published_at value should be updated, but when that time was <2 mins in the future the published_at change validation was triggered resulting in errors

Solution:
- ensure we only set times on PublishOptions with 0 milliseconds
- update client-side validations so we only trigger published_at validation when it's dirty

Also fixed:
- client-side validation errors were not shown on the confirm step due to a missing `.args`
2022-05-19 23:11:01 +01:00
Hannah Wolfe
385240e03d Refactored to use individual slack settings (#2384)
refs: TryGhost/Team#1625

- we want to remove backwards compatibility code for slack being a single setting

Co-authored-by: Rishabh <zrishabhgarg@gmail.com>
2022-05-16 11:38:32 +01:00
Hannah Wolfe
affe6743e5 Renamed products to tiers (#2372)
refs: https://github.com/TryGhost/Team/issues/1145

- this should allow us to remove the /products endpoint in v5

It avoids:

- `kg-product-card`, that really is meant to say product
- `product-cadence` on offers

Co-authored-by: Rishabh <zrishabhgarg@gmail.com>
2022-05-11 22:41:54 +05:30
Kevin Ansfield
d10da5a02b Updated newsletter management for switch to nullable sender_name
refs https://github.com/TryGhost/Team/issues/1513

- `sender_name` is now nullable with a fallback to the site title
- updated new-newsletter route
  - removed default setting of site title in `senderName` of the new newsletter instance
  - removed extra checks when showing unsaved changes modal as we no longer need to compare the `senderName` attribute against the site title
- updated newsletter preview so the sender name falls back to the site title
- updated sender name input placeholder to show the site title
- removed not-empty validation
- fixed the switch to "multiple newsletter" state in the background of the new-newsletter modal
  - problem was `displayingDefault` getter was looking at all active newsletters rather than just the filtered ones so it was counting the new-but-unsaved newsletter even though it wasn't displayed in the list
  - fixes layout glitch when the new-newsletter modal animates out after cancelling creation
2022-04-15 09:43:22 +01:00
Rishabh Garg
0bfc402090 Added newsletter management for member (#2336)
refs https://github.com/TryGhost/Team/issues/1492

Allows site owners to manage member's newsletter preference directly in Admin.

- also adds `visibility` property for newsletter model
- updates members test model to include `visibility`
2022-04-14 20:10:04 +05:30
Kevin Ansfield
4565882941 Updated newsletter model and form for latest schema
refs https://github.com/TryGhost/Team/issues/1500

- `senderEmail` is now nullable with a fallback to `noreply@{site domain}`
- `senderName` is not nullable and has no fallback
  - updated preview and input placeholder to match real-world behaviour
  - inserted site title as the default value when creating a new newsletter to avoid friction with the sender name needing to be filled in when saving
- switched `senderReplyTo` input field to a select with "newsletter" and "support" options
  - added basic `<Inputs::Select>` component as `<OneWaySelect>` had re-rendering issues causing loss of selected value when the label of the newsletter email changed to reflect a custom newsletter email value
2022-04-12 14:01:41 +01:00
Kevin Ansfield
6e0be9e175 Wired up newsletter management with real newsletter model and API
refs https://github.com/TryGhost/Team/issues/1441

- switched "leave settings" confirmation modal on members email settings screen over to modern modal pattern
- removed unused `showEmailDesignSettings` property and `closeEmailDesignSettings()` action on `<Settings::MembersEmailLabs>` component
  - the used property and action live on the controller, looks like it was a copy/paste hangover when functionality was moved to a component
- added newsletter model
  - includes design-related attributes which are not yet supported by the API but are due to be added
  - includes `default` attribute but there is no setting for it, due to be removed from the API but it's needed for save not to error for now
  - set up basic mirage model and endpoints
  - added validation for main settings to match API validation
- added `EditNewsletter` modal
  - separate tabs for general newsletter settings and design-related settings
  - used for both creating and editing newsletters
- added `/settings/members-email/newsletters/new` and `/settings/members-email/newsletters/:id` routes
  - both display the `EditNewsletter` modal on top of the members-email settings screen with the appropriate newsletter model
- updated `<Settings::MembersEmailLabs::NewsletterManagement>` component to work with real newsletter model instances and the new add/edit routes
- removed now-unused `newsletter` service that was providing mocked data for earlier design iteration
2022-04-04 19:30:52 +01:00
Sanne de Vries
59fb35592d Updated error copy on setup page 2022-03-08 20:23:55 +00:00
Rishabh Garg
7c5b14d050 Updated specific tier visibility handling for posts/pages (#2233)
refs TryGhost/Team#1071

Specific tier visibility for a post was previously stored in `visibility` column directly, which had a limitation of 50 charts. Going forward, for the specific tiers visibility of post/page, we use `tiers` array in API that contains list of tiers with access for post. This change -

- replaces `filter` type to `tiers` for visibility
- adds new visibility filter segment component in post settings menu which stores array of tiers instead of nql string for visibility
- updates serializer and model for post/page
- updates tests
2022-02-01 12:24:06 +05:30
Rishabh
7cd09eee96 Updated name validation for offer to restrict to 40 chars
refs https://github.com/TryGhost/Team/issues/1236

Stripe allows coupon names to be only upto 40 chars long, while Ghost allowed them to be 191 chars. This change updates the admin validation to restrict name to 40 chars to match Stripe limit
2021-11-24 18:18:22 +05:30
Rishabh
1fa408c48d Removed mandatory requirement from display title for offer
refs https://github.com/TryGhost/Team/issues/1163
2021-10-22 17:32:24 +05:30
Rishabh
457bd19446 Updated copy of offer validation error messags
no refs
2021-10-22 15:49:11 +05:30
Rishabh
eddeb07a52 Added error handling and validation for offer
closes https://github.com/TryGhost/Team/issues/1159

- validates offer fields before save client-side
2021-10-19 13:05:18 +05:30
Rishabh
31e4b77525 Added initial wiring for offer screens
refs https://github.com/TryGhost/Team/issues/1084
refs https://github.com/TryGhost/Team/issues/1085

- adds model/validator/config and router for offers
- updates template for offer list and detail with dynamic values
- updated route handling for offer list and creation
- wires offer data from API to list and detail pages
2021-10-06 20:01:25 +05:30
Peter Zimon
8cce7989f2 Updated tier modal copy 2021-09-01 10:14:56 +02:00
Peter Zimon
a6ba245bcd Updated copy for tiers
- Updated copy of multiple products to "Tiers"
2021-07-19 12:39:59 +02:00
Peter Zimon
7778d3c470 Refined visibility dropdown in post settings 2021-07-06 14:51:36 +02:00
Peter Zimon
830d24cb20 Refined post visibility settings
- added placeholder text to product/tier dropdown
- applied visual refinements

Note: alpha feature
2021-07-06 14:46:33 +02:00
Rishabh
6feb14b839 Handled visibility filter for posts
refs https://github.com/TryGhost/Team/issues/849

Multiple products alpha feature brings back segmented post access using products. The new visibility filter based on segments is returned in a separate `visibility_filter` property on post/page API
2021-07-05 17:14:26 +05:30
Rishabh
3c5e334041 Added ability to set post access to segments
refs https://github.com/TryGhost/Team/issues/801

- This reverts commit de560733c5
- brings back members segment select component to post access, which allows setting access to specific labels/products
- only works behind the alpha feature flag - `multipleProducts`
2021-06-28 17:46:24 +05:30
Peter Zimon
0acf9b1d9b Refined benefits 2021-06-28 12:39:31 +02:00
Rishabh Garg
46b311b561 Wired benefits section to API (#2023)
refs https://github.com/TryGhost/Team/issues/792

- updates product benefit to use `name` instead of `label` attribute for benefit text
- updates model/serializer/validator to correctly handle benefit attributes
- added `+` button for adding new labels as the enter behavior is closing the popup(needs fix)
2021-06-28 15:19:54 +05:30
Rishabh
dc6b2884f1 Added model and validator for product's benefit item
refs https://github.com/TryGhost/Team/issues/792

- updates product model to read product's list of benefits
- adds transformer to return emberArray with list of product benefits
- adds new model for each product benefit
- adds validator for new product benefit
2021-06-21 14:05:01 +05:30
Kevin Ansfield
ceb16b5e9f Added first version of feature image with caption inside editor (#1999)
refs https://github.com/TryGhost/Team/issues/771

- updated `<GhImageUploaderWithPreview>` to take an `@includeMetadata` argument that shows a basic html supporting caption field underneath (ready for toggle between caption/alt but not fully implemented)
- added feature image alt/caption properties to post model
- updated UI behind "featureImageMeta" labs flag
  - added the feature image uploader to the top of `<GhKoenigEditor>` for display above the editor title
  - removed feature image uploader from post settings menu
- added labs flag checkbox
2021-06-10 20:42:32 +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
Rishabh
42463e4fdd Added error handling for product details page
refs https://github.com/TryGhost/Team/issues/678

Product name is a mandatory field for a custom product, this change adds error handling on save and custom error message if product is attempted to save without name.
2021-05-10 19:18:30 +05:30
Rishabh Garg
2555b70456 Wired new Products settings UI to API data (#1930)
refs TryGhost/Team#627

This updates the new Products settings screens to use real data from API for existing Custom Products and Prices to populate them on UI and allow site owners to edit them.

- List all Products of site and allow editing Product name
- List all Prices for a product and allow editing individual Price names
- Add new Prices on a Product
2021-04-26 23:52:04 +05:30
Kevin Ansfield
95aa341468 Added max length validation to snippet's name field 2020-10-16 19:22:09 +01:00
Kevin Ansfield
7e169a2a86 Renamed snippet.title to snippet.name for consistency
no issue

- all of our models which allow users to name something use `name` as the field descriptor rather than `title` so `snippet.title` was renamed for consistency
- also fixes typo in the plus-menu component that stopped clicking on snippets from working
2020-10-16 10:15:07 +01:00
Kevin Ansfield
b590ce1b95 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
59a15a0895 Fixed incorrect validation when member's name is too long
no issue

- the email length validation was conditional on `member.name` rather than `member.email` so if the name was too long both name and email were marked as invalid
2020-05-11 11:40:38 +01:00