Commit Graph

7622 Commits

Author SHA1 Message Date
Peter Zimon
d7d5d9a13d Refined email styles 2019-11-22 11:40:56 +01:00
Kevin Ansfield
be4a5a84d9
Updated meta/structured data sources & fallbacks (#11068)
refs https://github.com/TryGhost/Ghost/issues/10921, closes https://github.com/TryGhost/Ghost/issues/11357, closes https://github.com/TryGhost/Ghost/issues/11403

- updates the sources and fallbacks for the output of `{{ghost_head}}` meta/structured data
- re-works related tests to better show the fallback chains for different scenarios
- fixes `{{ghost_head}}` tests to use `before/afterEach` so that tests are not interdependent
2019-11-21 13:08:00 +00:00
Naz Gargol
193c179110
Extracted members-specific middleware from site app module (#11405)
no issue

- In order to keep site/app.js module tidy and less coupled with members module we need to extract some of the functionality where it belongs conceptually
- Added "members enabled check" middleware to stripe webhook endpoint
- Reshuffled members middleware so that siteApp is in control of mounting points. This is meant to be a more explicit way to see which endpoints are being handled by members middleware
- Extracted member-specific public file middleware
- Unified use of `labs.member` alias method. Done for code style consistency
- Added basic members' test suite. This is a base we could work from when more modifications are needed
- Removed route handler for unexisting members file "members-theme-bindings.js". Calling this route otherwise causes a 500. Looks like a leftover from 49672a1e4d
2019-11-21 10:01:24 +07:00
Kevin Ansfield
f6ef12847a Override "Forbidden" Mailgun error to be more useful
no issue

- a 401 is received from Mailgun when invalid credentials are used but the default error message of "Forbidden" is not particularly useful
- intercepts "Forbidden" and swaps it for "Invalid Mailgun credentials" to be more user-friendly
2019-11-20 17:31:26 +00:00
Peter Zimon
e82f706afa Email design refinements 2019-11-20 18:27:52 +01:00
Kevin Ansfield
6eb992ce1f Removed meaningless code comment
no issue

- comment was about a deprecated property that has already been removed in 3.0
2019-11-19 16:24:04 +00:00
Naz Gargol
c2aec69af9
Added email retry logic for failed batches (#11402)
no issue

- When whole email batch fails we want to allow retrying sending a batch when post is republished
- Refactored naming for email event handling in mega
2019-11-18 21:28:54 +07:00
Kevin Ansfield
8fd1e816ae Cleaned up references to reserved slugs
refs https://github.com/TryGhost/Ghost/pull/11301

- the reserved slugs list was emptied in https://github.com/TryGhost/Ghost/pull/11301 but the empty array was left in place
- this cleans up all other references to reserved slugs so that the empty array can also be removed
2019-11-18 14:25:33 +00:00
Kevin Ansfield
0ef81708e7 Removed duplicated members key in overrides.json
no issue

- basic cleanup
2019-11-18 14:10:33 +00:00
Kevin Ansfield
1c8b78818f Merge branch 'master' into mega 2019-11-18 11:09:46 +00:00
Nazar Gargol
6751cc50c8 Fixed integrity test
no issue

- Schema was changed in c99f40957e
2019-11-18 15:47:19 +07:00
Rish
baccbb4942 Updated test email to throw error for failed requests
no issue
2019-11-18 13:24:28 +05:30
Peter Zimon
a64fab7e69 Refined mobile screen for unsubscribe 2019-11-16 16:39:26 +01:00
Peter Zimon
1f67cc6ddc Updated unsubscribe screen error handling 2019-11-16 13:02:36 +01:00
Kevin Ansfield
0a20243540 Fixed knex connection pool errors when saving posts with sqlite
no issue

- sub query within the `Post.onSaving` method was not passing through the transaction options which was locking up sqlite
2019-11-15 15:11:55 +00:00
Peter Zimon
b409a665b5 Refined unsubscribe screen design 2019-11-15 14:01:45 +01:00
Naz Gargol
c99f40957e
Improved mega error handling (#11393)
no issue

- Increased default mailgun retry limit to 5
- Handling retry logic closer to SDK layer gives less future manual handling
- Allowed failing request to be passed through to the caller
- To be able to handle failed requests more gracefully in the future we need all available error information to be given to the caller
- The previous method with `Promise.all` would have rejected a whole batch without providing details on each specific batch.
- Limited data returned with a failed message to batch values
- Added better error handling on mega layer
- Added new column to store failed batch info
- Added reference to mailgan error docs
- Refactored batch emailer to respond with instances of an object
- It's hard to reason about the response type of bulk mailer when multiple object types can be returned
- This gives more clarity and ability to check with `instanceof` check
2019-11-15 18:25:33 +07:00
Kevin Ansfield
ee47dd4dae
Added /unsubscribe/ route to the front-end (#11394)
no issue

- adds new router to the frontend for handling unsubscribe
- default template lives in `core/server/frontend/views/unsubscribe.hbs`
- `{{error}}` is present and contains the error message when unsubscribe fails
- `{{member}}` is present and contains the member email
- updated unsubscribe url to match the new format
2019-11-15 09:36:49 +00:00
Rish
52eb3ca9da Converted all link tags in preview to open in new tab
no issue
2019-11-15 11:26:43 +05:30
Kevin Ansfield
90f61d1f04 Added 'bulk-email' tag to bulk messages sent with mailgun
no issue

- helps distinguish bulk vs transactional email when both are using the same mailgun account
2019-11-15 00:06:23 +00:00
Kevin Ansfield
5fd2b7fed1 Added send_email_when_published query param to posts endpoint
no issue

- having a `send_email_when_published` property on the Post resource that only has an effect at certain times was confusing and was causing issues with clients that needed to know details of how that toggle worked
- makes `post.send_email_when_published` a fully read-only property in the API
- adds support for `?send_email_when_published=true` query param that can be passed in POST/PUT requests to the posts endpoint when scheduling or publishing a post - this is the only way to set `post.send_email_when_published` to `true`
- adds handling to ensure that `post.send_email_when_published` is always reset to `false` when reverting a post back to a draft _unless_ an email has already been sent
2019-11-14 17:29:03 +00:00
Rish
dbae6ccb58 Added site title as sender name for bulk email
no issue
2019-11-14 20:39:51 +05:30
Rish
c4706230d9 Updated fixtures regression test 2019-11-14 20:39:25 +05:30
Naz Gargol
d325912a55
Switched scheduler to use API v3 (#11391)
no issue

- The switch is needed so that mailinglist work when posts are scheduled
- v3 API is the default stable API that should be preferably used by all clients (including Scheduler)
2019-11-14 15:12:52 +07:00
Rish
1d89bbc852 Fixed settings tests 2019-11-14 11:32:34 +05:30
Nazar Gargol
98364e4d66 Removed unused method from bulk-mailer
- This was a leftover from rebase
- The method is not meant to be used anywhere
2019-11-14 12:35:26 +07:00
Rish
22b48cbef3 Fixed mailgun instance not updated on settings change
no issue
2019-11-14 10:45:26 +05:30
Rish
6d1de1b912 Fixed post not showing authors in email
no issue
2019-11-14 10:45:05 +05:30
Rish
eaf7289af3 Fixed bulk settings input serializer 2019-11-14 08:20:16 +05:30
Rish
b7df5c360d Updated send test email to use common email data 2019-11-13 22:53:33 +05:30
Rish
d3229b6ade Wired mailgun provider API keys via config or settings
no issue
2019-11-13 22:29:31 +05:30
Rish
05e9f01f30 Added dynamic fields isEnabled/isConfig on bulk email settings
no issue

Adds 2 new dynamic calculated fields on bulk email settings -

`isEnabled` - If mailgun is configured either with config or admin settings
`isConfig` - If mail is configured via config directly
2019-11-13 22:29:31 +05:30
Rish
572e56f90a Removed redundant bulk email settings migration
no issue
2019-11-13 22:29:31 +05:30
Rish
e540f36a9a Added new top-level bulk email settings
no issue
2019-11-13 22:29:31 +05:30
Peter Zimon
06afa4c042 Refined mail design 2019-11-13 14:11:54 +01:00
Rish
af43c0872c Fixed mailgun not sending test emails due to empty recipient variables
no issue

Mailgun expects `recipient-variables` to be a json object and fails to attempt sending the message in case its undefined, which is the case for test emails as they don't have member `uuid` or `unsubscribe` url. This sets a default empty object for `recipent-variables` in case of no data.
2019-11-13 17:02:56 +05:30
Fabien O'Carroll
d4ab151fce
Removed basic email validation
no-issue

This was rubbish anyway, and we should just rely on the input having `type=email`
2019-11-13 18:18:49 +07:00
Naz Gargol
f5479e1473
Added batching support for bulk email service (#11388)
no issue

- The limitation on Mailgun side of API seems to be 1000 emails per message.
- The only place where I could find a hard limit of 1000 emails per
batch was this PHP SDK issue: https://github.com/mailgun/mailgun-php/issues/469
- To store ids of sent messages introduce a mega column on the emails table. They can be synced with stats or other metrics during even pooling in the future
- Removed redundant `join(',')` statement.The SDK accepts an array of emails as well. Less code - better code :)
2019-11-13 17:52:23 +07:00
Naz Gargol
208b710677
Added tagging support to bul email service (#11390)
no issue

- Tagging needs to be added to be able to group/filter sent messages for various reasons. An example use case is when multiple Ghost instances use the same mailgun account
- Tag value can be provided as a part of config.json file under
`bulkEmail.mailgun.tag` key
2019-11-13 17:36:19 +07:00
Nazar Gargol
c9bd4a6c97 Updated Ghost-Admin to 3.0.3 2019-11-11 18:55:36 +07:00
Naz Gargol
45253cfe5f
🐛 Fixed 3.0 SQLite subscribers migration (#11383)
closes #11349

- The main reason for failure was SQLite's 999 variable limit
- More details here https://github.com/TryGhost/Ghost/pull/11270
2019-11-11 18:20:38 +07:00
Nazar Gargol
ae5eb4802c Reverted support to only data.post in meta layer
no issue

- It was partially removed in https://github.com/TryGhost/Ghost/pull/11080/files but didn't take into account hardcoded value in format response stage
2019-11-11 17:49:36 +07:00
Nazar Gargol
6345684556 🐛 Fixed twitter meta description for pages
closes https://github.com/TryGhost/Ghost/issues/11317
refs https://github.com/TryGhost/Ghost/issues/10042

- Introduced with f69f04ae8d
- Description and possible solution available in https://github.com/TryGhost/Ghost/issues/10042#issuecomment-551467666
2019-11-11 17:49:03 +07:00
Hannah Wolfe
6c921bf2ef Fix typo in regression test 2019-11-08 17:28:07 +07:00
Fabien O'Carroll
0a47adac88
Updated name of bulk email service config
no-issue
2019-11-08 17:26:05 +07:00
Hannah Wolfe
551e552928 Add a fallback API version, allows tests to pass
- 😏
- this shouldn't really be a thing, but it's better than updating 52 tests...
2019-11-08 17:24:10 +07:00
Fabien O'Carroll
11d0eff863 Converted bulk email service to use mailgun
no-issue
2019-11-08 17:21:20 +07:00
Fabien O'Carroll
00da426a02 Added unique_id to the recipient data
no-issue

This will be required by mailgun
2019-11-08 17:21:20 +07:00
Fabien O'Carroll
2b285c5fd3 Set from adress in the mega service
no-issue
2019-11-08 17:21:20 +07:00
Fabien O'Carroll
cc39786958 Updated members service to use config module
no-issue
2019-11-08 17:21:20 +07:00
Fabien O'Carroll
90d582c5f6 Added config module to members service
no-issue

This is for a central place to retrive member related settings from
2019-11-08 17:21:20 +07:00
Nazar Gargol
93b22af899 Added default stats object to email model
- The serialized object is meant to serve as a placeholder for future email related stats pooled from mail service provider
2019-11-08 17:11:54 +07:00
Naz Gargol
3f88e7de63
🐛 Fixed incorrect html title appearing on 'pages' pages (#11358)
closes #11357

- Change that introduced a bug was made in cbca480b97
- The condition could be removed once https://github.com/TryGhost/Ghost/issues/10042 is resolved. It is currently not dependent on the API version rather the object form used in the frontend.
2019-11-08 12:58:11 +07:00
Rish
0a17f5d3c0 Renamed migrations in correct sequence 2019-11-08 12:25:26 +07:00
Naz Gargol
b48f1f4b2c
Updated defaults handling for email property in posts (#11355)
no issue

- Fixed default email property output when the empty value is returned
- This is needed for consistency with other endpoint properties like primary_tag which are null when there is no value assigned
- Updated acceptance tests to handle email property
- Schema had to be updated to not use reference so that the information about email can be independent of the post - can still exist if the post is deleted
2019-11-08 11:40:49 +07:00
Nazar Gargol
13a0108aac Moved email preview spec to acceptance tests
- Tests here are baseline usecases which should be always in check
- More edge case scenarios might go into regression suite in the future
2019-11-08 11:38:06 +07:00
Peter Zimon
ed2f9e499c Fixed gallery image height 2019-11-07 17:17:34 +07:00
Nazar Gargol
3ca25886eb Removed redundant context passing
- Context object is not needed when model is used directly
2019-11-07 17:09:30 +07:00
Rish
d7d06653df Fixed email not returned in put object on post publish 2019-11-07 17:03:23 +07:00
Nazar Gargol
cc581c66ce Inlined context use so it matches convention used in most of the codebase 2019-11-07 16:45:53 +07:00
Peter Zimon
47bc7c400c Fixed pre style for email template 2019-11-07 16:31:48 +07:00
Nazar Gargol
fdba1cb95b Updated status handling
- We need to distinguish 2 stages before and after attempted sending of the email
2019-11-07 16:26:34 +07:00
Nazar Gargol
92dc86f0a5 Changed existing email status handling according to chenges in schema 2019-11-07 16:26:34 +07:00
Nazar Gargol
d0e8561b03 Changed email model statuses in schema
- Renames were done as that suits how emails would be handled by the bulk email handler
- These statuses are only for internal representation of the state and don't represent what happens to emails delivery-wise
- There is no need for 'sent' status as emails are "never done" and stats wold be checked for stats field would be used to check on details of the status
2019-11-07 16:26:34 +07:00
Rishabh Garg
b1d436e2ee
Added input validation to strip email object on post (#11351)
no issue

Removes post email relation from edit/add requests as we don't want to edit email object directly as part of post
2019-11-07 16:11:37 +07:00
Nazar Gargol
b364fc5e35 Not creating email record when there is nobody to send it to 2019-11-07 16:00:18 +07:00
Rish
7e0da18f85 Fixed typo on email relation in model 2019-11-07 15:52:01 +07:00
Kevin Ansfield
2421516aa6 Made email a default include on posts API in v3/canary 2019-11-07 12:47:07 +07:00
Nazar Gargol
3b792a075a Fixed serializer unit tests 2019-11-07 12:27:02 +07:00
Nazar Gargol
640f7155fc Fixed linter 2019-11-07 11:47:15 +07:00
Nazar Gargol
f34f4a7b8d Added comment to addEmail method 2019-11-07 11:47:15 +07:00
Nazar Gargol
eca129c18d Hooked mega service to listen to email.added event
- This was needed because we switched to synchronous request handling (to allow including email data with post.publish event)
2019-11-07 11:47:15 +07:00
Nazar Gargol
4e1caa8b08 Added email relation to post and allowed include for /posts endpoint 2019-11-07 11:47:15 +07:00
Rish
97e2af9a06 Added mailgun domain to members subscription settings
no issue

-  Delete api key and domain setting if its in the config to hide it in admin
2019-11-07 11:28:42 +07:00
Rish
86d6fc8578 Serialized post html for email
no issue
2019-11-07 11:15:16 +07:00
Rish
898c354644 Added [Test] for preview email subject 2019-11-06 19:20:12 +07:00
Rish
7b89cd445a Fixed unsubscribe url for preview email 2019-11-06 18:36:27 +07:00
Peter Zimon
4b24780ebd Refined figcaption size in emails 2019-11-06 18:35:03 +07:00
Rish
6357d0c79b Fixed custom subject in email preview 2019-11-06 18:32:11 +07:00
Rish
77daa77e04 Added status=all by default to preview api 2019-11-06 18:18:44 +07:00
Fabien O'Carroll
81b9018526 Passed unsubscribeUrl template variable to bulk email
no-issue
2019-11-06 18:08:11 +07:00
Fabien O'Carroll
509682cd6a Supported unsubscribe_url template variable for bulk email
no-issue
2019-11-06 18:08:11 +07:00
Fabien O'Carroll
00db1d385c Added createUnsubscribeUrl fn to mega
no-issue
2019-11-06 18:08:11 +07:00
Rish
4db260f17e Added authors to email preview template 2019-11-06 18:03:46 +07:00
Fabien O'Carroll
c64be968c1 Updated default values for post model
no-issue
2019-11-06 17:32:14 +07:00
Rish
90af59d15c Fixed test preview mail for draft posts 2019-11-06 17:02:42 +07:00
Rish
30f8cfddb4 Added mail. api key to default setting
no issue
2019-11-06 16:24:22 +07:00
Peter Zimon
4bd5b1c435 Added unsubscribe URL 2019-11-06 16:19:21 +07:00
Peter Zimon
36f7a88b84 Added current year in email footer 2019-11-06 16:17:03 +07:00
Nazar Gargol
f2a9bfcb93 Fixed DB integrity check 2019-11-06 16:07:14 +07:00
Nazar Gargol
59153394c3 Fixed db export test 2019-11-06 15:56:56 +07:00
Nazar Gargol
9d10f3b3b8 Fixed linter 2019-11-06 15:56:56 +07:00
Nazar Gargol
055fc6b09a Added email record after mage service sends an email 2019-11-06 15:56:56 +07:00
Nazar Gargol
c1ba238450 Fixed typo in email permissions migration 2019-11-06 15:56:56 +07:00
Nazar Gargol
6bc8a1bb18 Added email resource permission 2019-11-06 15:56:56 +07:00
Nazar Gargol
0e822b4d54 Added field defaults 2019-11-06 15:56:56 +07:00
Nazar Gargol
ae14eb00f9 Implemented GET /emails/:id endpoint 2019-11-06 15:56:56 +07:00
Nazar Gargol
1ed2598c3b Added basic read endpoint test 2019-11-06 15:56:56 +07:00
Nazar Gargol
c342ea1454 Added email data generators in test utils 2019-11-06 15:56:56 +07:00
Nazar Gargol
c264a5d8c4 Added email model 2019-11-06 15:56:56 +07:00
Nazar Gargol
fc9e62b1a2 Added emails table migration 2019-11-06 15:56:56 +07:00
Nazar Gargol
2af2500ccf Fixed db version integrity check 2019-11-06 15:56:56 +07:00
Nazar Gargol
f0c0ea2197 Added emails table schema definition 2019-11-06 15:56:56 +07:00
Peter Zimon
2c55b82be1 Refined email template 2019-11-06 15:47:20 +07:00
Peter Zimon
d6e8db28ab Refined email template 2019-11-06 15:39:27 +07:00
Fabien O'Carroll
809334d7dd Fixed tests for pages api
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
030819dc9e Added eslint ignore comments for template
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
cd6de74010 Added migration to populate missing uuid fields
no-issue

This is to ensure that all members have a uuid
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
f2709964ae Added migration for members uuid column
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
354e59a795 Added defaults to member model
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
a7e7f74f8b Wired up middleware to handle unsubscribing
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
73b00e77c2 Added unsubscribe handler to mega service
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
23964750a9 Allowed getting member by uuid
no-issue
2019-11-06 15:30:37 +07:00
Fabien O'Carroll
389b034875 Added uuid column to members table
no-issue

This will be used for unsubscribe links
2019-11-06 15:30:37 +07:00
Rish
45cd39c386 Fixed members settings cleanup for mailgun config 2019-11-06 15:21:46 +07:00
Rish
b3aba084ee Fixed fixture for send test email 2019-11-06 15:21:46 +07:00
Hannah Wolfe
9a2719ac4f Decoupled routing service and theme service
- This is a fairly temporary state
- It at least removes the themeService require from inside the routingService
- Requires us to pass the routingService the desired API Version...
- We're working towards having the entire frontend respect the theme API version by having it passed around everywhere
2019-11-06 15:20:13 +07:00
Hannah Wolfe
ca61e245e8 Updated syntax in labs service
- use consistent, simpler syntax
2019-11-06 14:53:53 +07:00
Peter Zimon
c2633b09ea Refined post email template 2019-11-06 14:53:40 +07:00
Hannah Wolfe
7a36200e24 🐛 Ensure deprecated labs flags are unset
fixes #11343

- solves the case where themes depends on old labs flags that are now always false, but the DB still has the feature set to true
- add concept of deprecated labs flags to the labs service
- make sure that the labs service gets used in our theme middleware
- added tests and other small fixes
2019-11-06 14:42:39 +07:00
Rish
9018e64493 Fixed email preview auth for test mails
no issue
2019-11-06 13:15:14 +07:00
Hannah Wolfe
27dd442059 Added extra handling for test port conflict errors
- If you use ghost cli, you may have extra ghost instances running on 2369
- Add extra handling to make this case super clear next time it happens to someone (probably me)
2019-11-06 12:48:58 +07:00
Rish
3e331fcf86 Fixed lint 2019-11-06 12:15:03 +07:00
Rish
cc514f1776 Fixed permission for test email API 2019-11-06 12:09:55 +07:00
Rish
686e0143c7 Added date formatting for email post data
no issue
2019-11-06 12:06:24 +07:00
Rish
3023619ac9 Allowed status data for email preview API
no issue
2019-11-06 11:57:46 +07:00
Naz Gargol
69bd4bdd4e Added post email preview permissions migrations (#11345) 2019-11-06 11:38:30 +07:00
Hannah Wolfe
814bb7da55 Fix silly issues with post class 2019-11-06 11:02:50 +07:00
Peter Zimon
7f3a1e93ae Working on email template 2019-11-06 10:21:58 +07:00
Daniel Lockyer
b91f3071be Deferred loading metascraper (#11337)
no issue

- reduces Ghost boot time from 1.47s to 1.33s on my machine.
2019-11-06 08:31:11 +07:00
Nazar Gargol
d47100168b Removed post only fields from pages
- As we introduced email_subject and send_email_when_published for post responses we don't want to return them for pages
2019-11-05 18:42:31 +07:00
Rish
d5aa38464b Added mail provider api key setting migration
no issue
2019-11-05 18:35:07 +07:00
Rish
78a9463243 Updated members setting serializer for mail config 2019-11-05 18:23:23 +07:00
Nazar Gargol
bb223f9f4d Allowed editing subscribed field for members 2019-11-05 18:03:19 +07:00
Hannah Wolfe
1cdc181c54 Added no-image class to content w/o feature_image
no issue

- Most of the offical Ghost themes have been doing this manually
- So we'll just do it by default:
2019-11-05 18:02:23 +07:00
Nazar Gargol
d0bf6e8579 Filtered out members which are unsubscribed in mailing service 2019-11-05 17:00:21 +07:00
Nazar Gargol
1ef015da10 Added subscribed column to members table
no issue

- Needed for unsubscribe functionality
2019-11-05 17:00:21 +07:00
Peter Zimon
b2f86315c0 Updated post email template 2019-11-05 16:37:12 +07:00
Rish
4a53184d7f Added send preview email API
no issue
2019-11-05 16:09:18 +07:00
Hannah Wolfe
72679aefb9 Updated inconistent frontend debug statements
- Fixed debug statements had wrong/inconsistent debug statement path after refactor
2019-11-05 15:06:15 +07:00
Nazar Gargol
5d76ceef8b Added plaintext field to email preview response 2019-11-05 15:04:48 +07:00
Fabien O'Carroll
d1812281f7 Updated serialisation to use current attributes
no-issue

We were getting some funny behaviour before this because some previous
attributes were just the defaults, when a post was new
2019-11-05 12:53:14 +07:00
Fabien O'Carroll
84300747a9 Added content gating to the mega service
no-issue
2019-11-05 12:53:14 +07:00
Fabien O'Carroll
15ffae211d Refactored members content gating check
no-issue
2019-11-05 12:53:14 +07:00
Fabien O'Carroll
6c97db2c22 Added content-gating module to members service
no-issue

This should be used as the central place to manage permissions to
members content
2019-11-05 12:53:14 +07:00
Fabien O'Carroll
0689ae9657 Fixed JSDoc comments for bulk emailer
no-issue
2019-11-05 12:53:14 +07:00
Nazar Gargol
a527a08cb0 Fixed linter error 2019-11-05 12:24:28 +07:00
Nazar Gargol
164861da76 Fixed unit tests - DB integriti checks
- Needed to be updated after adding new preview email permissions to the permission fixtures
2019-11-05 12:23:52 +07:00
Nazar Gargol
9daed773c9 Added email preview output serializer 2019-11-05 12:15:50 +07:00
Nazar Gargol
c913b0cbbf Extracted post email serializer from mega service 2019-11-05 12:15:50 +07:00
Nazar Gargol
8a7bf353d4 Added email preview controller 2019-11-05 12:15:50 +07:00
Nazar Gargol
61af0e08ae Added email preview endpoint to Admin API 2019-11-05 12:15:50 +07:00
Nazar Gargol
5e9a701d3a Improved regression test for post email 2019-11-05 12:15:50 +07:00
Nazar Gargol
facc2d0f29 Added email preview test 2019-11-05 12:15:50 +07:00
Nazar Gargol
60fd91b839 Added preview permissions 2019-11-05 12:15:50 +07:00
Fabien O'Carroll
3b11d25170
Fixed check for send_email_when_published
no-issue
2019-11-05 11:28:16 +07:00
Peter Zimon
5aaee4e8b2 Fixed post serialisation 2019-11-05 11:20:03 +07:00
Naz Gargol
977298b6e1 Added basic HTML template support to MEGA (#11336)
no issue

- Sends formatted email to members
- Added css inlining support for MEGA template
- Migrated MEGA service to use API serializers
- Service needs to be compliant with the API to be able to serve absolute URLs for resources like images
- Fixed send email check for previously sent mails
2019-11-04 17:53:42 +07:00
Rish
424e3aea7c Added restriction to not send mail for published posts
no issue
2019-11-04 16:07:33 +07:00
Rish
5b438d3df9 Added action for post email delievery
no issue
2019-11-04 15:42:00 +07:00
Nazar Gargol
fb88c541be Fixed custom subjects for mega emails 2019-11-04 15:24:20 +07:00
Naz Gargol
74f2145e81
Added MEGA service (#11333)
no issue

- This services listens  to 'post.publish' event, assemples email data and calls bulk mailer
2019-11-04 14:38:40 +07:00
Rish
82e022b582 Fixed db integrity test 2019-11-04 13:26:41 +07:00
Fabien O'Carroll
39688cef07 Fixed bulk-email service loop
no-issue
2019-11-04 13:23:49 +07:00
Rish
2ac2975178 Added migrations for email settings
no issue
2019-11-04 13:22:03 +07:00
Rishabh Garg
f2f9073edd
Added email subject post meta field (#11335)
no issue
2019-11-04 13:15:23 +07:00
Fabien O'Carroll
8503105b39 Improved bulk email service
no-issue

Used proper logging
2019-11-04 13:01:58 +07:00
Kevin Ansfield
e63083cd32 Added "send_email_when_published" migration 2019-11-04 12:58:42 +07:00
Fabien O'Carroll
5b071d08de Made send_email_when_published nullable
no-issue
2019-11-04 12:53:08 +07:00
Fabien O'Carroll
20ce0c313c Added initial bulk-email service
no-issue

This is a simple wrapper around the current ghost mailer service for now
2019-11-04 12:36:12 +07:00
Fabien O'Carroll
a30caa5c66 Added send_email_when_published to post input schema
no-issue

This is required to allow us to send the flag into the api
2019-11-04 12:03:24 +07:00
Fabien O'Carroll
3fc3c52dd3 Added flag for sending email when post is published
no-issue
2019-11-04 11:56:46 +07:00
Kevin Ansfield
6b420d0cbd Added member.edited webhook
no issue

- member model emits a `member.edited` event on update
- webhooks service listens for `member.edited` event and will trigger any registered hooks
2019-10-31 14:34:50 +00:00
Kevin Ansfield
a339a838b3
Removed /api/v2/members/ endpoints (#11308)
no issue

- this was a hangover from earlier members betas
- members is only available on `v3` and `canary` APIs
2019-10-31 11:11:46 +00:00
Naz Gargol
0c3b90283a
Renamed members to post-gating for better context (#11309)
no issue

- Using members.js naming for the file was a bad choice and lead to some false signals when doing a cleanup.  `post-gating` is more explicit and to the point of what the module is responsible for
2019-10-31 10:33:37 +01:00
Kevin Ansfield
1fd7014c45 Fixed member.deleted webhook having an empty payload
no issue

- the members output serializer was passing model objects through on `frame.response` but the webhooks serializer doesn't know how to deal with those
- adjusting the output serializer to use a mapper as per the other serializers means that POJOs are being passed through which allows the webhook serializer to correctly pick out the changed attributes
2019-10-31 15:19:45 +07:00
Casper Bøgeskov Hansen
638b4fc2f2 Fixed post preview access flag in 3.0 (#11275)
no-issue

The access flag was not being set in the preview controller which was causing 3.0 Member themes to incorrectly hide the content
2019-10-31 13:58:47 +07:00
Kevin Ansfield
2dc6f30f11 🐛 Fixed internal error for RSS feed when a post has no content
no issue

- initial report https://forum.ghost.org/t/rss-feed-stopped-working/9874
- `htmlRelativeToAbsolute` will return `null` if `null` is passed into it but `cheerio.load(null)` will throw a "Cannot read property 'parent' of null" error so we need to ensure we at least load an empty string
2019-10-30 17:46:17 +00:00
Kevin Ansfield
bddbdd2429 Updated Ghost-Admin to 3.0.2 2019-10-30 11:08:00 +00:00
Kevin Ansfield
a95bb6c5fd Updated Ghost-Admin to 3.0.1 2019-10-29 14:20:09 +00:00
Naz Gargol
9b347d6d95 🐛 Fixed 3.0 migration on SQLite with many posts (#11302)
refs https://github.com/TryGhost/Ghost/pull/11270

- Fixed 3.0/11-update-posts-html migration which failed in scenario when more than 999 posts with posts_meta relation were present
- The issue was originally spotted here: https://github.com/TryGhost/Ghost/pull/11270#issuecomment-546248308
- The main problem is in the `SELECT` statement which is generated for `findAll` method in Bookshelf which creates `WHERE IN(post_ids_here)` statement with all posts in the database
- Using knex directly as that's a preferred way to write migrations (does not depend on the model layer)
2019-10-29 12:16:47 +00:00
Kevin Ansfield
c2cdfef9e2
💡 Removed list of reserved slugs (#11301)
no issue

- reserved slugs get in the way of creating pages such as `/signin/` which do not currently exist and are useful for members
- the reserved slugs concept is a little meaningless because if there are any route clashes then our own routes should always win out over a post slug
2019-10-29 09:49:47 +00:00
Rishabh Garg
d370a4e840
🐛 Fixed members export limiting to 15 members only (#11299)
refs https://github.com/TryGhost/Ghost/issues/11298

The members export admin API by default paginates the result and only returns upto 15 members. This allows passing `limit` param to the API and allows passing `limit=all` to fetch all members in result.
2019-10-29 10:20:32 +05:30
Naz Gargol
99c6351feb
🐛 Fixed 3.0 migration for SQLite (#11270)
closes #11263

- Fixed `3.0/05-populate-posts-meta-table.js` migration failure when having >999 posts with metadata in the database
- The issue here is with hitting SQLite's internal SQLITE_LIMIT_VARIABLE_NUMBER limit when updating with a large amount of posts having metadata fields set (ref.: https://sqlite.org/limits.html#max_variable_number)
- Transforming migration to iterative method avoided inserting lots of records at once
2019-10-28 14:21:21 +01:00
Kevin Ansfield
7284227f1e
🐛 Fixed 404s when using a proxy setup (#11269)
no issue

When using certain proxy setups that result in `host` and `x-forwarded-host` being different, it became impossible to access Ghost because all routes showed generic 404 pages.

- `vhost` module that we are using to separate front-end and admin urls does not use express' `req.hostname` so it does not pick up the `x-forwarded-host` url that express' `'trust proxy'` config gives us
- switched to the forked `@tryghost/vhost-middleware` package which has a one-line change to use `req.hostname || req.host`
- added `'trust proxy'` config to the admin express app and switched to using `req.hostname` in our redirect code to avoid infinite redirect loops
2019-10-28 11:22:05 +00:00
Naz Gargol
b1e20d2ad5
🐛 Fixed migration path from pre 2.28.x to 3.0.0 (#11268)
no issue

- Bug reported here https://forum.ghost.org/t/ghost-3-0-update-q-install-cannot-read-property-type-of-undefined/9659/3
- The issue happens when migrating from e.g. 2.28.x Ghost instance directly to 3.0
2019-10-28 12:02:16 +01:00
Fabien O'Carroll
80e1530f7e Converted has helper imports to individual const
no-issue
2019-10-28 10:55:14 +00:00
Fabien O'Carroll
d78cbed84d 🐛 Fixed error from has helper w/o dependent data
no-issue

Usage of the has helper like `{{#has 'author:count>1'}}` when the
current context does not have the dependent data (in this case
`authors`) would error, because it could not read property length of
undefined.
2019-10-28 10:55:14 +00:00
Naz Gargol
518f2ccd82
🐛 Fixed incorrect body class output on page (#11264)
closes #11262
refs #10042

- Fixed issue where using {{body_class}} helper on a "page" type of a page was outputting `post-template` instead of `page-template`
- The issue was caused by this change 7dc38e2078 (diff-c33149d31de747bc5fbefcaf7a44da79L67-L72)
- Updated the comment to have real context of why this if is here
- Added test coverage for .page-template class
2019-10-23 18:06:45 +02:00
Fabien O'Carroll
a789431dfa Updated Ghost-Admin to 3.0.0 2019-10-21 22:41:48 +07:00
Fabien O'Carroll
74044190ff Updated Ghost-Admin to 3.0.0-beta.8 2019-10-21 18:34:46 +07:00
Nazar Gargol
5760395e92 Fixed reading_time calculation for non public posts
no issue

- The calculation of reading time has to happen before html field is sanitized for members plan.
2019-10-21 18:07:38 +07:00
Fabien O'Carroll
95543b0461
Added price data to templates (#11259)
no-issue

This is p. damn hacky!!
This exports `{{@price.monthly}}` and `{{@price.yearly}}` to the theme
so that we can have dynamic payment pages
2019-10-21 17:50:54 +07:00
Fabien O'Carroll
870b12ca2e Updated Ghost-Admin to 3.0.0-beta.7 2019-10-21 13:05:33 +07:00
Rish
d3c96ac04e Fixed filter in url config for posts
no issue

We use `visibility:public` filter for post url config for all API versions, which causes any post with non-public visibility to not get added in resource list. This means every time on server start/restart, fetching posts in theme will exclude any post not having `visibility:public` as it won't have a corresponding url resource added.

This fix was previously committed to master here - ff13821b27 - but got overwritten during `master` ->`v3` merge somewhere causing weird behavior with member posts on v3.
2019-10-21 12:20:39 +07:00
Rish
082718d236 Updated Ghost-Admin to 3.0.0-beta.6 2019-10-20 16:11:09 +05:30
Rish
38d7030708 Updated Ghost-Admin to 3.0.0-beta.5 2019-10-20 14:19:55 +05:30
Rish
1e1b704675 Updated Ghost-Admin to 3.0.0-beta.4 2019-10-19 18:40:27 +05:30
Fabien O'Carroll
acd7376803 Updated Ghost-Admin to 3.0.0-beta.3 2019-10-18 19:30:44 +07:00
Fabien O'Carroll
3c31820468 Updated Ghost-Admin to 3.0.0-beta.2 2019-10-17 18:53:17 +07:00
Fabien O'Carroll
a3b4ced241 Updated Ghost-Admin to 3.0.0-beta.1 2019-10-17 17:36:15 +07:00
Fabien O'Carroll
a500c3761f Added migration for subscriber labs flag
no-issue
2019-10-17 16:58:46 +07:00
Fabien O'Carroll
1fb41e1946 Removed superfluous space from filename
no-issue
2019-10-17 16:58:46 +07:00
Naz Gargol
f1fa74b5c4
💄Updated fixtures for Ghost v3 content + assets (#11247)
no issue 

- Updated post images and content
- Updated default blog cover asset
- Updated default Ghost user avatar
2019-10-17 10:49:30 +02:00
Fabien O'Carroll
8ab1d3fae9 Fixed test for updated favicon
no-issue
2019-10-17 13:20:09 +07:00
Peter Zimon
ce2e2e3834 Updated default publication icon
no issue
2019-10-17 07:59:21 +02:00
Rishabh Garg
d8e65d46e9
Updated post model queries to raw knex queries (#11246)
no issue

We split `posts` table into 2 in v3 with a new `posts_meta` table. Since migrations always use the version of code which is being migrated to - in this case the Post model - which in v3 relies on the posts_meta table, `2.x` migrations relying on post model will fail as it doesn't exist in the expected state. This PR updates all 2.x migrations using `models.Post` to use knex queries directly to access database and perform operations.
2019-10-17 10:36:18 +05:30
Fabien O'Carroll
7c4f177fee Added missing page prop to v2 Content API posts
no-issue

We have to wrap this in a check to make sure that `page` property is
only returned if either:
A) No `fields` param is passed (send back all fields)
B) `fields` param is passed AND it includes the `page` field
2019-10-16 15:44:05 +07:00
Fabien O'Carroll
38a05c0393 Fixed regression test for page property
no-issue

We have to manually add the page property since the schema no longer
includes it
2019-10-16 15:44:05 +07:00
Fabien O'Carroll
9a3bd55886 Updated fixture integrity hash
no-issue
2019-10-16 14:22:42 +07:00
John O'Nolan
055f129059 Correct Twitter username 2019-10-16 14:22:42 +07:00
Peter Zimon
cac8c4a3e7 Refined member emails
no issues
- refined typography and spacing for member signup, singin and subscribe emails
2019-10-16 14:22:42 +07:00
Fabien O'Carroll
d6b0db39c0 Added access property to entries for v3+ api
no-issue

This is done at the theme layer so that we do not introduce new concepts
to the api which may go away very quickly due to the beta status of
members.
2019-10-16 14:15:52 +07:00
Hannah Wolfe
fb072395ac Reduced API debug statements
- outputting so much information makes debug less useful
 - node debugger should be used for tracing values through the system,
     debug() is for more generally following logic and timing
 - removed debugs that output large objects
 - added consistent debugs for api methods
 - a couple of other tweaks for easier understanding of what's happening on a request
2019-10-15 15:07:38 +01:00
Fabien O'Carroll
c9c37b0da2
Merge master -> v3 (#11242)
Merge master -> v3
2019-10-15 17:44:14 +07:00
Nazar Gargol
634a9160a8 Fixed test suite timeout for multi-author posts
no issue

- The timeout has been triggered due to lot's (25) of posts being inserted into the databse , which took over 20 000ms on Travis.
- We don't need to insert this many posts in the first place to test the case
- The reason why it is taking longer to do the insertion operation then before should be investigated separately
2019-10-14 16:11:10 +02:00
Kevin Ansfield
8e2ed1d5b0 Updated Ghost-Admin to 2.37.0 2019-10-14 13:50:10 +01:00
Rishabh Garg
1e9d4875f5
Added new member subscription settings (#11240)
no issue

We added 2 new member subscription settings - `allowSelfSignup` and `fromAddress`- with defaults as `true` and `noreply`, this migration sets default values for both settings for users migrating from previous version and cleans up intermediate naming for `allowSelfSignup`.
2019-10-14 16:58:15 +05:30
Nazar Gargol
84d40983d2 Unskipped fixed test
no issue

- The test was fixed with 4a10ddc8fa
2019-10-14 12:21:26 +02:00
Fabien O'Carroll
20a6ad1ea6 Added member.added and member.deleted webhooks
no-issue
2019-10-14 15:50:24 +07:00
Fabien O'Carroll
5fb05e970c Updated webhook default to v3 api
no-issue

There are no members serializers on the v2 api
2019-10-14 15:50:24 +07:00
Fabien O'Carroll
d680f33f10 Removed unused members getter
no-issue

This would have errored when used
2019-10-14 15:50:24 +07:00
Fabien O'Carroll
94b261759e Added added and deleted events to member model
no-issue

These can be used to trigger webhooks
2019-10-14 15:50:24 +07:00
Fabien O'Carroll
df8a67a9ca Enabled members by default (#11190)
no-issue

This removes the need for `enableDeveloperExperiments` flag for members
2019-10-14 08:34:04 +05:30
Kevin Ansfield
4bdaa16792 Fixed tests 2019-10-11 13:45:54 +01:00
Kevin Ansfield
05f348f0fe Merge branch 'master' into v3 2019-10-11 13:28:19 +01:00
Kevin Ansfield
8aa3b40fd6 Fixed tests 2019-10-11 13:16:54 +01:00
Rish
0a75921a53 Updated Ghost-Admin to 2.36.0 2019-10-11 16:59:08 +05:30
Kevin Ansfield
78e16ddd3f Merge branch 'master' into v3 2019-10-11 11:31:31 +01:00
Rishabh Garg
fb1d11c09a Fixed subscribers migration to work without model (#11227)
no issue

Since we removed subscribers code in v3, we cannot use `models.Subscribers` for migration, and instead switch to using db directly for fetching existing subscribers before migrating them to members.
2019-10-11 10:43:18 +01:00
Rish
cd02fd5c63 Renamed member requirePayment setting
no issue

Renames member setting `requirePaymentForSignup` -> `allowSelfSignup` to match members API usage
2019-10-11 14:08:31 +05:30
Fabien O'Carroll
85d83b4f08 Fixed regression test for canary content api
no-issue

We now return the visibility field on the content api
2019-10-11 14:14:46 +07:00
Fabien O'Carroll
3eb4427888
Exposed visibility prop for posts on canary api (#11229)
no-issue

This is required by the theme layer to style member only posts
differently
2019-10-11 13:58:50 +07:00
Fabien O'Carroll
95fa815eb3 Improved settings model tests
no-issue

This makes them way less brittle and reliant on correctly indexing an array
2019-10-11 13:47:48 +07:00
Fabien O'Carroll
1500881923 Renamed getRequirePaymentSetting
no-issue

The negation before this function call was a little easy to miss for me
2019-10-11 13:47:48 +07:00
Fabien O'Carroll
0c602976c0 Passed members_email_auth_secret to members-api
no-issue
2019-10-11 13:47:48 +07:00
Fabien O'Carroll
cbb13904b8 Added members_email_auth_secret setting
no-issue

This will be used for signing HS256 JWTs it's a 64 byte (256 bit) hex
string
2019-10-11 13:47:48 +07:00
Fabien O'Carroll
ef5e6f7e5b Removed text-transform: capitalize from buttons
no-issue

Button text should be sentence case not title case
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
527632f287 Updated members email templates
no-issue

These changes fix come colors and styles
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
3062ec7690 Wired up members plaintext emails
no-issue
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
257bebbb39 Wired up the members emails templates
no-issue
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
f4d202d7c5 Added member email templates
no-issue
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
98f27c1c33 Added getSubject function for members emails
no-issue
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
6f160518d1 Ensured that members emails include our text version
no-issue
2019-10-11 11:45:11 +07:00
Fabien O'Carroll
b030081a4b Updated GhostMailer to allow forcing text content
no-issue

This is so that we can pass our own customised text content
2019-10-11 11:45:11 +07:00
Naz Gargol
1b04b48ffd Added from parameter for member emails (#11222)
* Added from parameter for member emails

no issue

- Passed in the `from` parameter when initializing members mailer to be able to customize outgoing address
- Extends GhsotMailer to accept a from parameter from the outside
2019-10-11 11:21:53 +07:00
Kevin Ansfield
0cc8b019d1 Updated Ghost-Admin to 2.35.0 2019-10-10 18:18:45 +01:00
Kevin Ansfield
c0533b75ac Fixed regression tests 2019-10-10 17:45:47 +01:00
Kevin Ansfield
6b3c4a59b4 🐛 Fixed rendering and url transformation of v1 "card-markdown" aliased cards
no issue

- Ghost 1.x stored markdown cards with the name `card-markdown`, this was changed in Ghost 2.x to be `markdown`. To keep compatibility with the older mobiledoc content the `markdown` card was aliased using a straightforward `Object.assign()`. Unfortunately this failed to work adequately when the url transformation functions were added to cards and resulted in corrupted data being returned in API responses
- moved the markdown card definition into a factory function so that a clean card definition object can be used for both the `markdown` and `card-markdown` cards
2019-10-10 16:35:29 +01:00
Rish
4f0ca2914f Updated members schema validation for name
no issue

- Removed minimum length requirement for `name` as its possible to have empty name for a member
2019-10-10 17:26:56 +05:30