Commit Graph

12476 Commits

Author SHA1 Message Date
Kevin Ansfield
68af12cfad Added 2fa happy path to Admin
closes https://linear.app/tryghost/issue/ENG-1617/
closes https://linear.app/tryghost/issue/ENG-1619/

- updated cookie authenticator's `authenticate` method to accept an `{identification, pasword, token}` object
  - if `token` is provided, hit our `PUT /session/verify/` endpoint passing through the token instead of hitting the `POST /session/` endpoint
- added `signin/verify` route
  - displays a 2fa code input field, including required attributes for macOS auto-fill from email/messages to work
  - uses `session.authenticate({token})` when submitted
- updated signin routine to detect token-required state
  - detects a `403` response with a `2FA_TOKEN_REQUIRED` code property when authenticating
  - if detected transitions to the `signin/verify` route
2024-10-21 11:01:40 +01:00
Ghost CI
e42ed553dc v5.97.0 2024-10-18 15:05:19 +00:00
Kevin Ansfield
2fb88e65ca Fixed signin and signup button failure state hover colors
ref https://linear.app/tryghost/issue/ENG-1653

- we were always setting a `style="background-color: #123456"` attribute on the buttons but that didn't allow for different button states such as the red failure state to correctly override meaning there was some odd behaviour when hovering
- removed the fixed `style` attribute and adjusted `<GhTaskButton>`
  - added `@useAccentColor` prop
  - when `@useAccentColor` is true, add the necessary `style` attribute except when showing the failure state
2024-10-17 16:54:23 +01:00
Steve Larson
2e0293c99f
🐛 Fixed NQL filters for single letter slugs (#21340)
fixes https://github.com/TryGhost/Ghost/issues/20133
- includes fix to support single letter slugs
2024-10-17 15:35:26 +00:00
Ghost CI
27e1a89e58 Merged v5.96.2 into main 2024-10-16 09:31:44 +00:00
Ghost CI
42fcd385a6 v5.96.2 2024-10-16 09:31:42 +00:00
renovate[bot]
b70bb13fb4 Update sentry-javascript monorepo to v7.119.2 2024-10-15 15:57:58 +02:00
renovate[bot]
7dc0415439 Update sentry-javascript monorepo to v7.119.1 2024-10-15 14:37:04 +02:00
Sag
d5aa77bb7f
🐛 Fixed missing 'duplicate a post' feature for editors (#21304)
ref https://linear.app/tryghost/issue/ENG-1647

- as per [staff user definitions](https://ghost.org/docs/staff), an
editor should be able to duplicate a post
- this feature was missing from the right-click menu on post/page lists
for editors
2024-10-15 12:19:56 +02:00
Daniël van der Winden
d7e36cb22a
Updated media query (#21303)
Fixes
https://linear.app/tryghost/issue/DES-317/adminx-members-list-header-column-overlaps-sidebar-in-mobile-viewport

Added a positioning and z-index change to the `thead` within the media
query to make sure it moved back behind the overlay.
2024-10-15 10:10:21 +00:00
Ghost CI
b7409ff3d2 v5.96.1 2024-10-11 15:05:17 +00:00
Daniël van der Winden
2a5ba1c13c
Added hover states for Resource boxes (#21276)
On Post Analytics, and on the Dashboard, the resource boxes did not have
a hover state, making them look very static. They now have a hover
state.
2024-10-10 10:24:06 +00:00
Djordje Vlaisavljevic
598ce03186 Allowed search results to span multiple lines
ref https://linear.app/tryghost/issue/DES-832/admin-search-results-that-span-multiple-lines-get-cut-off
2024-10-10 11:07:48 +01:00
Djordje Vlaisavljevic
29dd2bca8d Fixed alignment of icon and text in admin search
ref https://linear.app/tryghost/issue/DES-806/fix-alignment-of-search-input-field
2024-10-10 11:07:48 +01:00
Djordje Vlaisavljevic
3c3b001df2 Made newsletter preference toggles more compact on Member details screen
ref https://linear.app/tryghost/issue/DES-818/toggles-are-huge-lets-make-them-more-elegant

- They were too big and stood out too much on this screen, the `xs` variant fits better
2024-10-10 10:55:10 +01:00
Djordje Vlaisavljevic
bce8687004
Added nicer apostrophes (#21271)
ref https://linear.app/tryghost/issue/DES-814/replace-dumb-quotes-with-smart-quotes-in-admin

- Replaced “dumb” apostrophes with “smart” (or “curly”) apostrophes, see
http://quotesandaccents.com/
2024-10-10 10:11:19 +01:00
Daniel Lockyer
de5dcb8189 Fixed treeshaking and require size for date-fns
- we don't need to require the entire package and this costs 5% of our
  boot time
- this commit bumps NQL to the latest version, which fixes the requires
  to help with treeshaking and loading less code
2024-10-09 17:03:04 +01:00
Daniel Lockyer
e5d8294f71 Delayed ember-template-lint warnings
- these have started flagging up again but we don't currently want to
  fix them, so I've regenerated the file to fix linting
2024-10-08 14:34:11 +01:00
Ghost CI
5f32c8e89d v5.96.0 2024-10-04 15:05:25 +00:00
renovate[bot]
9a93a5cfc6 Pin dependency i18n-iso-countries to 7.12.0 2024-10-02 07:28:28 +00:00
Peter Zimon
7cb8cbdf7a
Showing country names instead of codes in Stats (#21172)
[ANAL-53](https://linear.app/tryghost/issue/ANAL-53/10-stats-page-engineering-stuff)

- So far only country codes were displayed instead of human readable country names in the Stats page
2024-10-02 09:17:06 +02:00
Kevin Ansfield
3bbe8c8c7a
Fixed bugs in post's change-access context menu flow (#21173)
ref 86d61304b1
ref https://linear.app/tryghost/issue/ONC-323

- added `tracked()` to our proxy model object properties
  - fixes default data always showing when opening the modal
- fixed data push after completing modal
- `post.tiers` is set up as an attribute in Admin rather than a relationship
- fixes incorrect tiers list showing when the change access modal is opened again after changing access before the post is re-fetched from the API
- fixed flash of failure button state when saving modal changes
- expanded tests to cover tiers selection
2024-10-01 17:16:23 +00:00
Peter Zimon
8aaac5abe1
Stats page design fixes (#21171)
[ANAL-95](https://linear.app/tryghost/issue/ANAL-95/internal-beta-qa)

Various design refinements and fixes for the Stats page:
- Updated scroll area in detail modals so that the Close button and the footer is never outside the viewport
- The detail modal didn't close after clicking on the filter values
- "Show all" button was displayed also when there were no new items in the detail modal
- Dropdown styles needed a visual update: the toggles were way too huge and inconsistent with other dropdowns
- If no audience was selected we still showed stats. Now it's displaying the default empty screen in this case
- Click through filter indicators had low discoverability
- Technical data styles needed some love: changed the alignment and color scheme
- Mobile size viewports were not handled
- The google favicon API returned 404 many times for sources. Swapped the service for another one that returns favicons more reliably
- Default favicon was not handled. Now it comes from static.ghost.org
2024-10-01 17:51:55 +02:00
Kevin Ansfield
86d61304b1 🐛 Fixed errors creating new posts after a post access change via context menu
ref https://linear.app/tryghost/issue/ONC-323

After changing a post's access via the posts list context menu, creating new posts or members would not work correctly.

- the issue stemmed from `this.post.set('currentState.parentState.isNew', false);` that was called when changing a post's access level, after that all Ember Data models created from the store would have `isNew: false` causing Ember Data to attempt a PUT request to update the not-yet-created model rather than a POST request to create it
- we were only using a real post model instance in order to run validations against the post access level settings but we can do that just as easily by creating a new object and injecting our validation mixin
2024-10-01 15:10:59 +01:00
Kevin Ansfield
c0bc17fb72 Added beforeunload debug log to editor
ref https://linear.app/tryghost/issue/ONC-323

- we're sometimes seeing our force-refresh failing when Ember Data gets into a bad state but we're not sure why so this log should tell us if it's the browser's native "leave site" modal that is preventing the refresh
- updated the `onbeforeunload` event handler to match modern JS approach
  - modern browsers use `event.preventDefault()` to show their dialog
  - older browsers use `event.returnValue = true` (this is what our old string return was triggering)
  - no browser supports a custom message in the native dialog
2024-09-30 16:58:54 +01:00
renovate[bot]
d9a18a77a9 Update dependency webpack to v5.95.0 2024-09-30 08:52:06 +00:00
Ghost CI
de82b6be61 v5.95.0 2024-09-27 15:05:25 +00:00
Chris Raible
046b06fe72
Refactored local revisions to avoid QuotaExceededErrors (#21128)
ref https://ghost-foundation.sentry.io/issues/5908152800/

- In the current state, we are maintaining an 'index' key for all
revisions in localStorage. This gives us quick and easy access to all
the revisions in localStorage, but it requires additional "bookkeeping"
to update the index each time we add/remove a key.
- In some obscure edge cases, this results in the `remove()` method
throwing a `QuotaExceededError` (since removing a revision also requires
updating the index with `localStorage.setItem()`). If the `remove()`
call fails, we are sort of stuck — the only way to reduce our storage
usage is to remove items, but if the `remove()` method throws errors, we
can't do that.
- This change removes the whole index concept, and instead loops over
all the keys in localStorage, filtering by the prefix to find all our
revisions. This makes the `keys()` method slightly more complex, as it
has to filter out keys in localStorage that aren't related to revisions,
but it simplifies saving and removing revisions.
- Critically, this also means that `remove()` should never throw a
`QuotaExceededError`, since it no longer needs to call
`localStorage.setItem()` — it now simply calls
`localStorage.removeItem()` for the revision, which should never fail.
2024-09-26 12:50:31 -07:00
Fabien O'Carroll
9bb1696329 Loaded AdminX activitypub app from jsdelivr in production
ref https://linear.app/tryghost/issue/AP-438

We want to keep development and test mode using the local build so we can have
feedback on our local changes.
2024-09-26 23:24:26 +07:00
Fabien O'Carroll
9884e2bb2c Allowed to load AdminX apps from custom url
ref https://linear.app/tryghost/issue/AP-438

This is going to allow us to load the activitypub package from the jsdelivr
cdn, which means we can release new versions without releasing the admin.
2024-09-26 23:24:26 +07:00
Hannah Wolfe
68be1f95b1
Updated stats page to show visits instead of hits (#21133)
closes:
https://linear.app/tryghost/issue/ANAL-102/visits-on-tables-is-actually-displaying-pageviews

- The expectation is that the UI shows unique visits, not pageviews for
the breakdown charts
2024-09-26 14:50:30 +01:00
Ronald Langeveld
052ef6971f
🐛 Fixed infinite loops in setFeatureImageCaption for deleted posts (#21081)
ref ONC-364

- Adds a condition to check whether the record is deleted or if deleting
is in progress before firing the `setFeatureImageCaption`.
- Adds tests. Managed to reproduce the issue using tests.
2024-09-25 08:02:38 +00:00
Chris Raible
0125f52dc4
Added sentry logging to local revisions service for localStorage errors (#21078)
no issue

- Added Sentry logs to capture how often we are running into
`QuotaExceededErrors` when saving local revisions to localStorage, to
help in deciding if localStorage is sufficient, or if we need to expand
to e.g. IndexedDB.
- Also adds some handling to ignore errors when calling
`localStorage.setItem()` elsewhere in the admin app to avoid crashing if
localStorage isn't supported or the quota is exceeded.
2024-09-24 19:39:36 -07:00
Steve Larson
c121149ca3
Added posts restore UI (#21096)
ref https://app.incident.io/ghost/incidents/107
ref cc88757e2a
- added new path in admin `/restore`
- added basic ui for restoring posts from local storage
- added limits for # of revisions for posts with an `id` (5 revisions)

This commit adds a simple UI for restoring posts in case of data loss.
This is a backstop for very rare situations in which it seems Ember gets
into a conflicted state. See ref'd commit for more info. Clicking
'Restore' will create a new post with the saved off content.
2024-09-24 15:01:17 +00:00
Hannah Wolfe
45211b2f4c
Fixed bounce rate on stats page (#21097)
closes
https://linear.app/tryghost/issue/ANAL-81/investigate-bounce-rate-looks-incorrect

- Think I've figured out what was wrong
- TODO: Figure out TinyBird's test pipeline, so we can verify this
2024-09-24 15:52:57 +01:00
Hannah Wolfe
7e27b1cb36
Clickthrough filtering for stats page (#21095)
closes
https://linear.app/tryghost/issue/ANAL-58/click-through-filtering-for-content
closes
https://linear.app/tryghost/issue/ANAL-60/click-through-filtering-for-sources
closes
https://linear.app/tryghost/issue/ANAL-61/click-through-filtering-for-locations

- This implements filtering and click-throughs for device, browser,
source, location and pathname.
- It requires significant updates to our tinybird setup, to pass through
all the right data and have them as parameters on the API endpoints
- We update the UI to add query parameters when clicking around and then
pass those through to every chart/request.
- We've added a interface to display the filters and remove them

---------

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2024-09-24 15:26:08 +01:00
Hannah Wolfe
5ebdbe4e25
Renamed referrer without www to source in tinybird (#21094)
ref
https://linear.app/tryghost/issue/ANAL-60/click-through-filtering-for-sources

- In our stats page we use the referrer without a protocol or www, that
is the pure domain as our source that we output
- Meanwhile all the data pipelines had the full url as the referrer
passed through
- When we come to add clickthroughs/filtering, we'll need to use this
value to filter the data. If we have a different value locally in the UI
to what is in the DB, we won't be able to make the filters match
- Also, we pay for everything we store, and this removes all the
https:// and www. data
2024-09-24 14:16:50 +01:00
Hannah Wolfe
2c1d57dcef
Updated stats UI to hide unfinished features (#21089)
ref
https://linear.app/tryghost/issue/ANAL-53/10-stats-page-engineering-stuff

- There are several features that we are yet to implement, the UI is
ready for them
- Hiding the UI in the short term so that it's less confusing what
is/isn't working as we test things
2024-09-24 12:44:38 +01:00
Hannah Wolfe
e397046fb5
Improved the implementation of the stats page (#21088)
ref
https://linear.app/tryghost/issue/ANAL-53/10-stats-page-engineering-stuff

- All of these changes are intended to improve developer experience
going forward, to make it easier to implement further changes to the
stats page.
- Moved the modal into the stats components, as it has a lot of shared
code, and it makes it easier to update them all
- Removed various comment blocks that were outdated or didn't really add
value
  - Fixed all imports to use the same pattern starting `ghost-admin/`
  - Ensured all the components had the correct name
- Dried up the generation of params for Tinybird charts into a utility
function as we'll need to add several more in the near future
- Tried to use a consistent pattern everywhere for the order of
operations
- Dried up the implementation of technical.js which handles the
device/browser charts
2024-09-24 12:23:27 +01:00
renovate[bot]
31f1d7b464
Update dependency @tinybirdco/charts to v0.2.1 (#20937)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| @&#8203;tinybirdco/charts | [`0.2.0-beta.2` ->
`0.2.1`](https://renovatebot.com/diffs/npm/@tinybirdco%2fcharts/0.2.0-beta.2/0.2.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tinybirdco%2fcharts/0.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tinybirdco%2fcharts/0.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tinybirdco%2fcharts/0.2.0-beta.2/0.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tinybirdco%2fcharts/0.2.0-beta.2/0.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Configuration

📅 **Schedule**: Branch creation - "every weekday" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/TryGhost/Ghost).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-24 11:08:32 +01:00
Sodbileg Gansukh
2f02ec5566
Added unschedule bulk action to posts (#20945)
ref DES-675
2024-09-24 15:32:45 +08:00
Peter Zimon
8d54e4bf7a
Updated button styles (#21080)
DES-774

- The buttons in the Admin got very diverse over the last couple of
years. This PR updates the styles to use outline buttons, white
background for better contrast and slightly more rounded corners.
Additionally the right click and dropdown menu typography and spacing
has also been updated.
2024-09-24 07:20:20 +00:00
Kevin Ansfield
459a2c553e Added full-page refresh when new post route is in a bad state
ref https://linear.app/tryghost/issue/ONC-323

When the store gets into a bad state for new posts that causes saves to fail we can detect that by looking at the `model.isNew` property. Currently our best approach to fix this state is to restart the app.

- added a `didTransition()` hook to our `lexical-edit.new` route
  - detects the bad state, logs the error, and triggers a browser refresh
  - logs with a `recreatedPostIsGood` property that will let us know if we could instead just try recreating the post and avoiding a full refresh (so far we have no reproduction case so we need to learn what we can)
- added `sinon-chai` dependency for better assertions on spies/stubs
- added `sentry-testkit` dependency so we can test our Sentry integration calls
  - we can't use sinon for these calls because of the way Sentry's es6 imports work
- extracted our full Sentry config object generation to a util function so it can be re-used in unit tests
  - updated our integrations list to disable the default `dedupe` integration because it can cause very unexpected/difficult to debug test failures when you're asserting using `sentry-testkit`
2024-09-23 22:38:34 +01:00
renovate[bot]
7d441f24be Update dependency ember-auto-import to v2.8.1 2024-09-23 09:34:16 +02:00
renovate[bot]
a1dcd9168d Update dependency ember-auto-import to v2.8.0 2024-09-23 09:08:50 +02:00
renovate[bot]
ed04bd4a8b Pin dependency microdiff to 1.4.0 2024-09-23 08:56:08 +02:00
Ghost CI
887fdbd430 v5.94.2 2024-09-23 06:43:10 +00:00
Kevin Ansfield
c41c44b02d Fixed "Editor crashed" error showing for a valid 404
ref https://linear.app/tryghost/issue/ONC-323

- sometimes posts can be deleted by another user or in a different tab but then edited in an old tab that had the post loaded in the editor
- in this situation we were displaying our "Editor crashed" error put in place for the  rarer situation where the editor is genuinely in a bad state
- added an extra conditional for the bad state and a custom error message for the deleted post state
2024-09-20 09:40:44 +01:00
Kevin Ansfield
64118c139e Added extra post model state properties to debug logs
ref https://linear.app/tryghost/issue/ONC-323

- include post model state properties as well as the state name
2024-09-20 09:14:39 +01:00
Chris Raible
cc88757e2a
Added local revisions to the editor as backstop against data loss (#21044)
ref https://app.incident.io/ghost/incidents/107

- We have a rare bug that causes the initial `POST` request to create a
new post from the editor to be skipped or fail. Subsequent `PUT`
requests then fail because there is no post ID, potentially resulting in
data loss. The aim of this commit is to start saving revisions of posts
in the editor to the browser's localStorage, as a last-ditch option to
restore lost work.
- Since we don't know where the bug is yet, and to protect against
future bugs, we've deliberately avoided depending too heavily on the
`lexical-editor` controller or the ember store. We've aimed to create a
direct route to the state in the editor, by hooking into the
`updateScratch` method (effectively the `onChange` handler for the
editor).
- The `scheduleSave` function on the new `local-revisions` service is
called immediately upon any changes to the state of the lexical editor,
which is effectively every keystroke. The service has some logic and
timeouts, so it doesn't actually save a revision on every change to the
editor.
- The "schema" of the datastore is a simple key-value store, where the
key is of the format: `post-revision-${postId}-${timestamp}` if the post
has an ID, or `post-revision-draft-${timestamp}` for an unsaved draft.
There is also an array of all the revisions' keys, which allows us to
clear all the revisions without having to loop over every key in
localStorage (along with some other conveniences, like filtering).
- There is currently no UI for viewing/restoring revisions. In the event
that you need to restore a revision, you can access the service in the
browser console. You can access all the saved revisions using the
`list()` method, which logs all the revisions to the console by title &
timestamp. You can then choose a revision to restore, and call
`restore(revision_key)`, which will `POST` the revision's data to the
server to create a new post.
- Since localStorage data is limited to a 5mb quota in most browsers,
the service has a mechanism for evicting the oldest revisions once it
meets the quota. If a save fails because it would exceed the quota, the
`performSave` method will evict the oldest revision, then recursively
try to save again.

---------

Co-authored-by: Steve Larson <9larsons@gmail.com>
2024-09-20 00:08:28 -07:00