Commit Graph

207 Commits

Author SHA1 Message Date
Sag
e4f60ee028
Fixed member subscription status when multiple subs (#19530)
fixes PROD-325
- if a member has multiple subscriptions, show the status of the active
subscription
- if a member has multiple active subscriptins, show the status of the
subscription with the latest current_period_end date
2024-01-24 12:16:26 +01:00
Steve Larson
549aaa4c5a
Added tests for TK indicators within editor (#19262)
closes TryGhost/Product#4225
- added basic tests for TK detection in title
- added coverage for TK reminder modal popping up
2023-12-06 11:29:27 -06:00
Chris Raible
a97e2b823e
Added error handling to Sentry's beforeSend (#19109)
refs TryGhost/Product#4175

- Added error handling to Sentry's beforeSend function in both Admin and
Core, so if there is any error in beforeSend, we will still send the
unmodified event to Sentry
- This is in response to an incident yesterday wherein the beforeSend
function threw an error due to an unexpected missing value in the
exception. The event sent to Sentry was the error in the beforeSend
function, and the original error never reached Sentry.
- If the original event had reached Sentry, even if unmodified by the
logic in beforeSend, we could have been alerted to the issue sooner and
more easily identified all affected sites.
- Also added defensive logic to protect for certain values in the
exception passed to beforeSend not existing and added unit tests for the
beforeSend function in admin and core
2023-11-23 02:46:50 +00:00
Jono M
e8e0d84d50
Deleted old Ember settings pages (#18740)
refs https://github.com/TryGhost/Product/issues/4055

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 3b24693</samp>

Removed unused components related to announcement settings, custom theme
settings, and file upload. These components were part of a deprecated
feature or a legacy UI.
2023-11-06 06:46:31 +00:00
Kevin Ansfield
fa0b1c607b
Deleted all Admin code relating to the old editor (#18580)
no issue

- removed labs flag
- removed main editor component and all associated components
- switched usage of `<KoenigBasicHtmlInput>` and `<KoenigBasicHtmlTextarea>` over to use plain `textarea`, the only uses were in settings modals that have been replaced in AdminX
- cleaned up unused editor CSS
2023-10-12 13:17:39 +01: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
94c863f189
Implemented post slug update on duplicated post title update (mobiledoc) (#16811)
no issue

Updated the slug generation logic so that when a mobiledoc post is
duplicated and the title is edited, the slug gets updated to reflect the
new title of the post. See lexical implementation here:
https://github.com/TryGhost/Ghost/pull/16802
2023-05-17 10:11:01 +01:00
Jono M
62f7600aa4
Update search text highlighting to escape HTML (#16760)
refs: https://github.com/TryGhost/Team/issues/2390

Escapes each matched and non-matched segment of the post title in the
admin search field, to make sure they're displayed in plain text but
still have matches highlighted.
2023-05-11 09:53:05 +12:00
Sanne de Vries
2325a359bb Fixed failing test due to CSS change
No ref
2023-04-12 08:45:56 +01:00
Rishabh
8d4bc97dbe Fixed admin utils test
refs 9fc9e4311d
2023-01-13 19:49:01 +05:30
Rishabh
9fc9e4311d Removed www prefix from newsletter link table
closes https://github.com/TryGhost/Team/issues/2206

- removes `www.` from the url shown on links table in post analytics
- we had previously removed http(s) protocol from it as well, and they are only shown while editing the url
2023-01-13 15:38:54 +05:30
Hannah Wolfe
e4dbf9b0fd Updated error fallbacks to generic error message
refs: https://github.com/TryGhost/Team/issues/1121

- We've decided on one  preferred message for unexpected errors
- We want to use this everywhere where we don't know what to display
- We now have a GENERIC_ERROR_MESSAGE constant that we should use
2022-11-23 21:49:40 +00:00
Hannah Wolfe
c740eecaec Fixed duplicate error messages from API
refs: https://github.com/TryGhost/Team/issues/1121

- In certain cases our API sends the same data for message and context.
- We will also fix this server-side, but we should also be smart in the UI and not show duplicate info
2022-11-23 15:56:58 +00:00
Kevin Ansfield
060d791a63 Removed need for .get() with settings service
no issue

The `settings` service has been a source of confusion when writing with modern Ember patterns because it's use of the deprecated `ProxyMixin` forced all property access/setting to go via `.get()` and `.set()` whereas the rest of the system has mostly (there are a few other uses of ProxyObjects remaining) eliminated the use of the non-native get/set methods.

- removed use of `ProxyMixin` in the `settings` service by grabbing the attributes off the setting model after fetching and using `Object.defineProperty()` to add native getters/setters that pass through to the model's getters/setters. Ember's autotracking automatically works across the native getters/setters so we can then use the service as if it was any other native object
- updated all code to use `settings.{attrName}` directly for getting/setting instead of `.get()` and `.set()`
- removed use of observer in the `customViews` service because it was being set up before the native properties had been added on the settings service meaning autotracking wasn't able to set up properly
2022-10-07 16:14:57 +01:00
Aileen Booker
c4188c1a9e
Added Ghost Explore in Ghost as iframe app behind feature flag (#15495)
no issue

- Added Ghost Explore screen behind alpha flag
- Moved existing /explore route to /explore/connect which we'll redirect to for outside requests
- Added iframe communication with Ghost Explore App
2022-10-07 14:32:54 +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
Aileen Nowak
515bf1cc14 Added Ghost Explore UI
no issue

- Added `/explore` route which requires min. Admin and is behind a feature flag
- Fetches Admin API key and ID to create a token and return back to Ghost Explore with the correct query params
- Fullscreen UI
2022-08-01 11:11:47 +01:00
Kevin Ansfield
c24ea5d0bc Fixed raw JS error messages appearing in alerts (#2407)
refs https://github.com/TryGhost/Team/issues/1613

We use `notifications.showAPIError()` in many of our try/catch routines but those can also pick up standard JS errors which can result in ugly and useless messages showing in alerts.

- added a list of known built-in JS error type names to check against and a generic error message to be used in place of ones we know shouldn't be displayed
- in `showAPIError(obj)` check `obj.name` against the known list and swap the message for a generic one
  - only the message is swapped, we still log the full/original error to Sentry
- in `handleNotification(msg)` which is the final method used when displaying any alert/notification, extract all words in the supplied message and check that against the known list and swap the message on a match. This handles situations where the API might give us a raw JS error message in the message string
2022-05-27 11:52:39 +01:00
Kevin Ansfield
7356bfbcd9 Migrated notifications tests to Octane patterns
refs e021843e3f

- fixed closing of alerts due to missing `.args` after migrating to glimmer syntax
- updated related tests for glimmer component syntax
2022-05-25 12:45:26 +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
Kevin Ansfield
17710c3e8e Switched members table to show info from most-recently-updated subscription instead of first in array
no issue

- members having multiple subscriptions is not really expected but if it does happen then the most recently updated subscription is most likely to be the one that we're interested in showing the details of in the members table
- added `{{most-recently-updated arr}}` helper+function that will return the item in the array argument with the most recent "updated at" value
  - uses `updatedAtUTC` or `updatedAt` or `updated_at` values so it will work against any of our models or un-transformed API response objects
- updated `<GhMembersListItemColumn>` to use a `mostRecentSubscription` getter when showing subscription data rather than assuming the first object in the subscriptions array should be displayed
2022-03-04 16:32:41 +00:00
Kevin Ansfield
57b1ab4800 Ran ember-cli-update --run-codemods (#2219)
no issue

- part of ember upgrades
- removed all unnecessary usage of `.get`
- cleaned up imports where we had imports from the same module across multiple lines
- standardized on importing specific computed helpers rather than using `computed.foo`
- switched tests from using `wait()` to `settled()`
2022-01-21 19:25:47 +00:00
Rishabh
948934da2d 🐛 Fixed incorrect MRR value on dashboard
closes https://github.com/TryGhost/Team/issues/950

- fixes the mrr value/chart on dashboard when a site has no new mrr events in more than 30 days shown as 0
- adds tests to cover more mrr event scenarios
2021-08-09 17:47:09 +05:30
Thibaut Patel
dc9c812d9c Renamed isAdmin/isOwner/isAdminOrOwner to reduce confusion
issue https://github.com/TryGhost/Team/issues/857

- The goal is to avoid testing for the owner role only is cases where we should be testing for the owner or admin role
- `isOwner` => `isOwnerOnly`
- `isAdmin` => `isAdminOnly`
- `isOwnerOrAdmin` => `isAdmin` (concerns now both Owner and Admins)
2021-07-12 14:55:56 +02: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
Peter Zimon
e36f0a42d3 Updated character counter color 2021-07-08 15:15:49 +02:00
Kevin Ansfield
2770c73bab Fixed tests
refs 37a6197f81

- fixed find/replace whoopsie with `slugGenerator.generateSlug()`
- updated editor controller unit tests to match rename
2021-06-21 15:18:11 +01:00
Kevin Ansfield
ba47b710cb 🎨 Moved default focus in editor from body to title for new posts
refs https://github.com/TryGhost/Team/issues/707

Placing focus in the title aligns better with typical editorial process.

- switched `autofocus` attribute from body to title for new posts
- added a default value to the `mobiledoc` attr on the Post model, without it the autosave when moving from title to editor creates a forced re-render and clears the focus whilst you're typing
2021-06-14 15:35:59 +01:00
Naz
40cedb84ff Added integration with limit service
refs https://github.com/TryGhost/Team/issues/587

- This is first pass on the frontend limit-service integration. Max count queries are substituted with HTTP requests to mimick backend checks. Note, they are not meant to substitute backend checks only to suplment them.
2021-04-08 16:59:56 +12:00
naz
238632402c 🐛 Fixed host limit error when resending a pending invite (#1881)
refs https://github.com/TryGhost/Team/issues/587
refs e30b9735fa

- It was not possible to invite a new Contributor to a site that has reached its limit
- This fix divides the resend invite action into two separate steps: 1. Deleting existing invite 2. Creating a new one for the same data
- It was hitting the limit because the permissions were correctly checking for "add" action being executed when the limit of invites/staff users was already used up. By removing existing invite we mimic the behavior the server would do for us anyway (2111992dd4/core/server/services/invites/invites.js (L18-L22))

Co-authored-by: Rish <zrishabhgarg@gmail.com>
2021-04-06 15:10:03 +12:00
Rishabh Garg
74e2d3ef8c 🐛 Fixed MRR start date value in chart (#1865)
no refs

MRR start date value for charts was being calculated with start value as 0, assuming we have the data for first date in our range to use as start value. Since the events data returned only has data on dates where any MRR event happened, in case the first date in our range didn't have any. data we started from 0 instead of value on previous date. This fix

- updates calculation to pick the start value for chart based on value on last date in our range(30 days)
- adds unit tests for stats
2021-03-15 15:23:55 +05:30
Kevin Ansfield
e66bb4feac Removed tour feature
refs 10b48b1d6d
refs 1531712d92

- the tour feature is no longer used so all associated code can be removed
- removes `liquid-tether` dependency as it was only used by the tour throbbers/popovers
2021-03-02 14:29:26 +00:00
naz
07abb5443a Fixed EmberObject.create error on Admin start (#1841)
refs https://github.com/TryGhost/Ghost/pull/12632

- The `unsplash` setting has been migrated to a new format - plain boolean value. This is why it's no longer needed to do any serialization dances
2021-02-18 13:25:21 +13:00
Peter Zimon
697a28ecef Fix test 2021-02-08 15:08:55 +01: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
Peter Zimon
04d9caefed Updated navigation (#1832)
no issue

Updated settings navigation to a completely redesigned flow for Ghost 4.0 🎉

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
Co-authored-by: Fabien O'Carroll <fabien@allou.is>
Co-authored-by: Rish <zrishabhgarg@gmail.com>
2021-02-02 16:08:06 +00:00
Kevin Ansfield
5b17a70e8b Update dependency eslint-plugin-ghost to v1.4.0
no issue

- applies fixes for new/updated rules
- disables `ember/no-mixins` rule as we're not able to migrate away yet
2020-05-06 18:07:01 +01:00
Peter Zimon
4b5f538552 Updated notifications design (#1498)
no issue

- updating toaster design for better discoverability
2020-02-27 09:19:29 +00:00
Kevin Ansfield
3d7e593c96 Fixed Ember Data record.toJSON() deprecation
no issue

- https://deprecations.emberjs.com/ember-data/v3.x/#toc_record-toJSON
2020-01-07 13:23:15 +00:00
Hannah Wolfe
00ce91ce3a Added Secondary Navigation (#1410)
refs: https://github.com/TryGhost/Ghost/pull/11409

- Added a new UI for a second set of navigation links
- This should support most concepts of nav, e.g. left and right, or header and footer
- This PR mostly updates the design and nav components to cope with a second set of nav
2019-12-04 11:14:45 +07:00
Naz Gargol
c41c184762 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
Naz Gargol
7e3412ce8e 🔥 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
Rishabh Garg
30b2d3a4b3 Switched Admin API version from canary to v3 (#1317)
no issue

- Switches over to new v3 endpoint from canary
2019-09-03 12:40:27 +05:30
Kevin Ansfield
d4f2280a68 Switched Admin API version from v2 to canary (#1291)
no issue

- Ghost-Admin is our primary API client, we should keep it in sync with the canary API branch to dog food our API changes
2019-08-12 09:56:21 +01:00
Kevin Ansfield
457a8e2955 🎨 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
Renovate Bot
c9537e27f1 Update ember core
no issue

- remove usages of function prototype extensions
- fix usage of evented.off
2019-07-22 14:00:52 +01:00
Kevin Ansfield
0b649eaedd Remove unused files
no issue

- `app/helpers/gh-format-html` is duplicated in `lib/koenig-editor/addon/helpers/sanitize-html` and is not used anywhere else
- `app/helpers/gh-path` is not used anywhere - the API should be returning absolute URLs everywhere so path generation is no longer as necessary within templates
- `app/helpers/is-equal` replaced with `{{eq}}` from `ember-truth-helpers`
- `app/helpers/is-not` replaced with `{{not}}` from `ember-truth-helpers`
- `app/utils/isFinite` is not used anywhere
- `app/utils/titleize` is not used anywhere
2019-07-22 11:06:16 +01:00
Renovate Bot
9925a02793 Update dependency ember-mocha to v0.16.0
no issue

- removes now-unneeded `adapter-error` override helper
- comments out the `gh-post-settings-menu` unit tests because the top-level `describe.skip` was causing all further unit tests to be skipped
2019-06-17 15:32:09 +01:00
Kevin Ansfield
1520122483 Refactored deprecated usage of setupTest* methods
no issue

- https://github.com/emberjs/ember-mocha/blob/master/docs/migration.md#upgrading-to-the-new-testing-apis
- deleted tests files which had no specific tests
- migrated unskipped component unit tests to integration tests
2019-05-13 15:31:32 +01:00
Kevin Ansfield
75245f0d3d Improved duplication checking in notifications service
closes https://github.com/TryGhost/Ghost/issues/10514
- deduplicates alerts based on message content as well as key
2019-03-12 17:50:45 +00:00