Commit Graph

10292 Commits

Author SHA1 Message Date
Daniel Lockyer
65fa8c12b5
Refactored database check to use utility
refs https://github.com/TryGhost/Toolbox/issues/213

- this removes another hardcoded string check that would have been
  incorrect when we switch the sqlite client to better-sqlite3
2022-03-28 16:12:32 +01:00
Rishabh
b5cf019840 Fixed multiple mobile size bugs for Portal 2022-03-28 17:46:06 +05:30
Daniel Lockyer
f24ea42697 Updated Admin to v4.41.3 2022-03-25 16:00:32 +00:00
Hannah Wolfe
45de9b0efc
Fixed filename casing in canary API
refs: 0ef5a5c97a

- As per the previous commit, our mixed filename casing inadvertently resulted in a bug
- The casing in the codebase is meant to be kebab-case always, so fixing this everywhere that's relevant to the API whilst there's a good reason
2022-03-24 17:25:53 +00:00
Hannah Wolfe
0ef5a5c97a
Fixed members connect endpoint returning JSON
refs: https://github.com/TryGhost/Toolbox/issues/245
refs: https://github.com/TryGhost/Team/issues/1360

- As a result of my changes in https://github.com/TryGhost/Ghost/commit/3bd4d098 the members connect endpoint had started returning JSON
- This is because the members connect endpoint relied on the old default behaviour of the serializer being to return no response, whereas now it does our default JSON response format
- I had written a tool to iterate over all endpoints and ensure that they all had explicit serializers before changing the default behaviour, but it missed this endpoint due to the snake case naming
- I have double checked and this was the only missed endpoint, the only other one was member_signin_urls.permissions but that was not a true endpoint and was removed in https://github.com/TryGhost/Ghost/commit/202696382
- Note: the snapshot file for this test was generated from running the test against https://github.com/TryGhost/Ghost/commit/e6b92aed9 - one commit before I added the new default behaviour.
  - Without the new serializer this test fails on main
  - With the new serialzier, this test passes again, showing the response format has gone back to what we expect
2022-03-24 17:09:23 +00:00
Hannah Wolfe
202696382f
Removed extraneous permission flag in member signin urls
- This doesn't affect permissions, only permissions inside an endpoint config block does that
- Rather it creates an extra unused "endpoint" called member_signin_urls.permissions
- same as https://github.com/TryGhost/Ghost/commit/b53296c4d
2022-03-24 16:14:06 +00:00
Rishabh
7e6cae2ef2 Revert "Refined UI/UX for Portal"
The new visual update to Portal needs more refinements before going live, this reverts commit b405e37be9.
2022-03-24 16:34:47 +05:30
Daniel Lockyer
d0497a6e40
Added theme-service-init metric during boot
refs https://github.com/TryGhost/Toolbox/issues/254

- it's useful for us to know how long it takes the theme service to
  init, especially as it is dealing with a lot of user-provided files
  outside of the Ghost codebase
2022-03-24 09:20:52 +00:00
Simon Backx
6bd1806650
Fixed same redirectManager used in offer service between tests (#14340)
refs https://ghost.slack.com/archives/C02G9E68C/p1647599592576139
refs https://ghost.slack.com/archives/C02G9E68C/p1647620250625909

Issue: `Cannot destructure property 'fromRegex' of 'this.redirectsredirectId]' as it is undefined.` is being thrown, only when running all tests.
Cause: duplicate redirects are added to a redirectManager, and not cleared correctly in the redirectManager, which throws an error when removing one of the duplicate redirects.

Because the same redirectManager is used, multiple event listeners are connected to the same redirectManager. So when the offer service has been initialised multiple times, multiple listeners are added, which create a redirect for every newly created offer... to the same redirectManager.
So there are three possible fixes for the same problem (would be best to fix them all):
- Create a new redirectManager every time the offer service is initialised
- Figure out a way to remove DomainEvents subscribers between tests
- Don't add the same redirect id multiple times to redirectIds in addRedirect from the express-dynamic-redirects package

This commit contains a fix for the first solution.

It also moved the offers service initialising before the frontend (to `initServicesForFrontend`)
2022-03-24 10:18:52 +01:00
Rishabh
b405e37be9 Refined UI/UX for Portal
With tiers going GA, this change brings a massive visual overhaul to Portal for almost all pages and flows, along with adding consistency between different multiple tier flows. It also overhauls the tests to match our new UI/UX for Portal.
2022-03-23 21:22:52 +05:30
Rishabh
6978892c57 Merged v4.41.2 into main
v4.41.2
2022-03-23 21:08:06 +05:30
Daniel Lockyer
6bf2985dd5 Updated Admin to v4.41.2 2022-03-23 15:06:02 +00:00
Hannah Wolfe
2b6b31ee14
Removed unnecessary authors serializer
refs: https://github.com/TryGhost/Toolbox/issues/245

- we don't need this serializer because the default serializer will call the authors mapper
- added an author mapper which is just an alias for users. I did this in a named file, not in index.js
  - because we want to change the api framework to load files automatically without needing index files.
  - makes sense to hold off that deeper change until we only have one api version else we have to change old APIs
2022-03-23 14:09:24 +00:00
Hannah Wolfe
9db1694647 Removed unnecessary tags serializer
refs: https://github.com/TryGhost/Toolbox/issues/245

- we don't need this serializer because the default serializer will call the tags mapper
- for now I've changed, rather than removed the tag serializer test as this shows default works the same!
2022-03-23 13:23:23 +00:00
Hannah Wolfe
b28beed755 Removed unnecessary integrations serializer
refs: https://github.com/TryGhost/Toolbox/issues/245

- we don't need this serializer because the default serializer will call the integrations mapper
2022-03-23 13:23:23 +00:00
Hannah Wolfe
30f3dea1e7 Removed unnecessary action serializer
refs: https://github.com/TryGhost/Toolbox/issues/245

- we don't need this serializer because the default serializer will call the actions mapper
2022-03-23 13:23:23 +00:00
Hannah Wolfe
396dd5f7f9 Removed unnecessary labels mapper & serializer
refs: https://github.com/TryGhost/Toolbox/issues/245

- There's no need for a mapper or serializer as labels uses the default behaviour
- Added a full suite of tests, consolidating from regression and using the new framework to prove nothing is broken
2022-03-23 13:23:23 +00:00
Hannah Wolfe
e68cb8b314
Improved settings cache unit tests
- settings cache was appearing as untested because we use rewire!
- rewire was totally unnecessary in this case, so I removed it
- updated to 100% test coverage whilst there, including removing one unreachable branch
- commented some undesirable behaviour I found whilst trying to reach all branches
- I don't want to change the behaviour to return false correctly without having a reason beyond improving coverage
2022-03-23 11:37:52 +00:00
Rishabh
4acdd0de7c Merged v4.41.1 into main
v4.41.1
2022-03-23 14:10:20 +05:30
Daniel Lockyer
51a6bc969a Updated Admin to v4.41.1 2022-03-23 08:24:59 +00:00
Sam Lord
de3a45a805
Fixed theme error handler (#14363)
no issue

Prevents errors from being uploaded to Sentry when a 404 happens in Ghost Admin. At the moment, 404s in Ghost Admin create an ENOENT error in express' static library. Our generic 404 handler at the end will only intercept requests that don't have any errors in the context, so a simple middleware can strip out 404 errors just before we add in our own.

The Ghost-specific error that we attach to requests does not get uploaded to Sentry :)
2022-03-22 15:32:55 +00:00
Hannah Wolfe
3bd4d0989a Added default serializer + handling
refs: https://github.com/TryGhost/Toolbox/issues/245

- Added a serializer called default to the canary API
  - Ideally, this would be part of the shared framework, but this would change v2/v3 and we're about to get rid of them
  - Therefore, we change just canary for now, and we can refactor again later.
- Added wiring to handler that uses the default serializer, if there is a default, and isn't an explicit serializer for the endpoint
- Removed the invites serializer, so that one endpoint now uses the default

Note: previous commits have added explicit serializers to every endpoint, this is the first step towards paring
that back so that we have less serializers overall, not more!
2022-03-22 13:52:32 +00:00
Hannah Wolfe
e6b92aed9b Added serializer for offers
refs: https://github.com/TryGhost/Toolbox/issues/245

- Offers didn't have a serializer because it's deliberately set at the API level
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Tests were added to cover this endpoint in ...
2022-03-22 13:52:32 +00:00
Hannah Wolfe
3919d31838 Added serializer for missing settings endpoints
refs: https://github.com/TryGhost/Toolbox/issues/245

- Upload, updateMembersEmail, validateMembersEmailUpdate & disconnectStripeConnectIntegration were all missing serializers
- Upload is an as-is response, same as download
- updateMembersEmail, validateMembersEmailUpdate & disconnectStripeConnectIntegration are all passthroughs with no response
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Updated the file based tests to prove the body doesn't change
- Tests were added to cover updateMembersEmail, validateMembersEmailUpdate & disconnectStripeConnectIntegration in 68c1bc0285
2022-03-22 13:52:32 +00:00
Hannah Wolfe
a188cfe677 Added serializer for session.all
refs: https://github.com/TryGhost/Toolbox/issues/245

- Session didn't have a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Tests were added to cover this endpoint in 2cf7e00493
2022-03-22 13:52:32 +00:00
Hannah Wolfe
7e6a7cb98c Added serializer for email_preview.sendTestEmail
refs: https://github.com/TryGhost/Toolbox/issues/245

- sendTestEmail was missing a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Updated the tests to prove the body doesn't change
2022-03-22 13:52:32 +00:00
Hannah Wolfe
2d7117bddd Added serializer for slack.all
refs: https://github.com/TryGhost/Toolbox/issues/245

- Slack didn't have a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Tests already cover this endpoint
2022-03-22 13:52:32 +00:00
Hannah Wolfe
3a1185f2a1 Added serializer for authentication.resetAllPasswords
refs: https://github.com/TryGhost/Toolbox/issues/245

- resetAllPasswords was missing a serializer
- added a new passthrough serializer for now
- the tests already cover this endpoint
2022-03-22 13:52:32 +00:00
Hannah Wolfe
84500be0e2 Added serializer for themes.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- The destroy endpoint was missing a serializer
- Instead of adding one, I've refactored to use an all method that's a passthrough
- Updated the tests to use the same pattern as others to make it clearer this is tested
2022-03-22 13:52:32 +00:00
Hannah Wolfe
ac3f18b251 Added serializer for snippets.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- The destroy endpoint was missing a serializer
- As this serializer uses the same createSerializer pattern as members, I've copied the passthrough from members into here
- This ensures the behaviour will stay the same when the default behaviour changes
- Updated the tests to prove the body doesn't change
2022-03-22 13:52:32 +00:00
Hannah Wolfe
a29ee2834d Added serializer for members.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- This was the only endpoint in the members API that didn't have a serializer
- It just needs to be a simple passthrough, but we define it so we can change the default
2022-03-22 13:52:32 +00:00
Hannah Wolfe
c89a01b031 Added serializer for integrations.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- The destroy endpoint was missing a serializer
- Instead of adding one, we've refactored to use the standard structure for this serializer
- Updated the tests to prove the body doesn't change
2022-03-22 13:52:32 +00:00
Hannah Wolfe
7433378e6a Added serializer for redirects.upload
refs:  https://github.com/TryGhost/Toolbox/issues/245

- There was only a serializer in place for redirects.download.
- Upload was falling through, which means nothing happens by default atm
- We want to change this default, so I'm making sure all our routes have serializers declared and tests
- Updated the tests and checked the behaviour was the same before and after:
  - We can't use our new framework here yet because it doesn't support uploads or downloads
  - Instead, just add simple matching for the body of the responses
2022-03-22 13:52:32 +00:00
Naz
fd14b7eaf6 Refactored the gscan version check to use single variable
no issue

- Just a small refactor as it was becoming painful to change the version in three places while experimenting with gscan
- Also follows the "rule of 3"
2022-03-22 09:53:22 +08:00
Simon Backx
028cf7becc Added dashboardV5 feature flag 2022-03-21 16:56:34 +01:00
Peter Zimon
2324b29b2a Added multiple newsletters flag 2022-03-21 16:11:36 +01:00
Daniel Lockyer
7de80473b1 Updated Admin to v4.41.0 2022-03-21 11:38:12 +00:00
Naz
25e5cb46de 🐛 Fixed /canary/ API endpoints 404s
refs https://github.com/TryGhost/Toolbox/issues/169
refs 7becf0a2b2

- The referenced commit has dropped existance of Content and Admin APIs under `/canary/` prefix, which made a breaking change and clients that are still relying on "canary" started to break.
- The `/canary/` prefix should be used up untill the introduction of Ghost v5, otherwise we run the risk of accidentally breaking API clients.
2022-03-21 19:11:13 +08:00
Daniel Lockyer
ac5f42b7ad
Added missing message string
- we use this property in the code but it was missing from the messages
  object
- this was causing an error in the `tpl` library so this commit adds the
  correct message
2022-03-21 09:07:54 +00:00
Kevin Ansfield
8a28923421 Added members activity feed screen to admin area
no issue

- adds a separate activity feed screen with all member events
  - can be filtered to show specific event types
  - can be filtered by a specific member to show their full event feed
- updated member details screen to show all events instead of just email events
2022-03-18 16:29:12 +00:00
Kevin Ansfield
95c919852b
Fixed missing product name in API response when editing creating/editing subscriptions (#14339)
refs https://github.com/TryGhost/Team/issues/1141

- switched to the same member fetch method as used in `GET /member/:id/` so there's consistent data available when rendering the API responses
2022-03-18 16:06:38 +00:00
Daniel Lockyer
76fb1f56eb Updated Admin to v4.40.0 2022-03-18 16:00:40 +00:00
Djordje Vlaisavljevic
808143e005 Fixed horizontal scrolling issue in code blocks in emails 2022-03-18 15:26:08 +01:00
Rishabh
f44c86c937 Refined scrollbar and preview style in Portal
- bumps portal with several design refinements and tiny UX fixes
2022-03-18 19:35:58 +05:30
Thibaut Patel
b4ea309893
Added the MemberCancelEvent model to MembersApi (#14313)
refs https://github.com/TryGhost/Team/issues/1302

- Added the `MemberCancelEvent` model to MembersApi
- Triggered when a subscription is canceled by an admin or by the member
- Updated shared dependencies

Co-authored-by: Simon Backx <simon@ghost.org>
2022-03-18 14:25:35 +01:00
Matt Hanley
1033e7be21 Fixed minified CSS not reflecting latest changes
- CSS was updated previously, but the minified version wasn't
- as a result the private site landing page was visually broken
- minified CSS is built as part of `grunt prod`, called during `grunt release`
2022-03-17 14:47:21 +00:00
Kevin Ansfield
6b0bffac9a Fixed linter error
refs 0cc147ae2d

- labs import was left in the members serializer after removing it's usage
2022-03-17 11:01:09 +00:00
Kevin Ansfield
0cc147ae2d 🐛 Fixed member "last seen at" data not being returned in the API
refs c4470ff732

- labs flag was removed under the false assumption it was a client-side only flag but the `last_seen_at` property in API responses was also gated meaning the member details screen showed "Not seen yet" and the members list did not show the last seen date of all members when filtering
2022-03-17 10:58:07 +00:00
Fabien 'egg' O'Carroll
9ff8d7f910
🐛 Fixed post access in the get helper (#14282)
refs https://github.com/TryGhost/Team/issues/1367

Because we are passing through a different member object as the context
in the get helper, the content gating was not working correctly, as the
member was missing a status property, this adds the property which fixes
content gating.

- Added extra tests for get helper {{access}} property
- Added extra test for {{access}} property in next_post helper
- In the future we might want to update the tests so they test the whole request -> HBS context flow. Currently the has context is still stubbed manually.
2022-03-17 11:14:29 +01:00
Rishabh Garg
18b59d2c01
Removed archived tiers from content api (#14329)
closes https://github.com/TryGhost/Team/issues/1426

When fetching tiers using the content API, we incorrectly returned all tiers including archived ones unless the active:true filter is passed. Correct behaviour is to always hide archived tiers, so this filter should not be required.

- forces `active:true` filter for tiers content api browse
- updates test to check for archived test removal in tiers content api
2022-03-16 22:02:42 +05:30