Commit Graph

12844 Commits

Author SHA1 Message Date
Simon Backx
4c5ba4ed7d
Added database storage for link redirects and click events (#15423)
closes https://github.com/TryGhost/Team/issues/1916 
closes https://github.com/TryGhost/Team/issues/1917

- Added database storage for link redirects and click events via repositories (hides away database layer) defined in the wrapper services
    - Added LinkClickRepository to store click events to database
    - Added LinkRedirectRepository to store link redirects to database
    - Added PostLinkRepository to link LinkRedirects with posts
- Renamed link-replacement package to link-replacer, and made it dependency less (it only replaces links now, doesn't do anything else)
- The link-tracking service has a new `addTrackingToUrl` which returns a new URL that includes tracking. The new `addRedirectToUrl` method does the same but without tracking for now.
- MEGA service now uses the link-replacer to replace links in the emails using a combination of different services (member attribution + link-tracking service)
2022-09-19 17:12:54 +02:00
Kevin Ansfield
201d4ef228 Loosened error message snapshot matching for posts API test error output
refs d5f03ec0b1

- underlying error message varies across node versions
- adjusted to match only the part we explicitly set
2022-09-19 16:06:34 +01:00
Kevin Ansfield
744534fde6 Updated snapshot for posts API test error output
refs d5f03ec0b1
2022-09-19 15:56:30 +01:00
Kevin Ansfield
d5f03ec0b1 Added original error message to context in "Invalid lexical structure" error
no issue

- setting the original error message to the `context` property means it's not completely lost and gives us a clue for debugging
- updated the lexical and mobiledoc validation errors to use the messages+tpl pattern
2022-09-19 15:51:55 +01:00
Sanne de Vries
b2d449fecf Added Lexical indicator to post list
Closes https://github.com/TryGhost/Team/issues/1926
2022-09-19 15:40:19 +01:00
Sanne de Vries
242850b7da Added external link to lexical indicator pointing to koenig-lexical repo
Refs https://github.com/TryGhost/Team/issues/1926
2022-09-19 14:55:00 +01:00
Daniel Lockyer
74f1f1bba6
Fixed CDN URLs in tests
refs de416629e6

- I forgot to update them when making the referenced commit
2022-09-19 14:51:31 +01:00
Sanne de Vries
e2dbf2c748 Added indicator to the Lexical editor screen
Refs https://github.com/TryGhost/Team/issues/1926
2022-09-19 14:48:44 +01:00
Daniel Lockyer
1ba6d2e5a7
Updated test snapshot
refs de416629e6

- this was forgotten after I'd changed the endpoint in the referenced
  commit
2022-09-19 14:43:07 +01:00
Daniel Lockyer
de416629e6
ℹ️ Switched to jsDelivr CDN endpoint with shorter browser cache
fixes https://github.com/TryGhost/Toolbox/issues/416

- this commit switches the default endpoint for our CDN-loaded assets to
  a Ghost-specific jsDelivr one, with a shorter 10 min browser cache config, so
  assets are refreshed quicker upon publishing
2022-09-19 14:22:34 +01:00
renovate[bot]
225765241c
Updated @tryghost dependencies (#15404)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-19 12:09:33 +01:00
Kevin Ansfield
226f45fd83 Fixed "cannot save both mobiledoc and lexical" error when tabbing from title field to lexical editor
closes https://github.com/TryGhost/Team/issues/1924

- updated the Post model so the relevant `mobiledoc`/`lexical` field always has a blank document by default depending on which editor is selected via the feature flag
- ensures we don't send `{mobiledoc: null, lexical: null}` inadvertently creating a mobiledoc post (API sets the default blank document in that scenario) when the lexical editor flag is enabled
2022-09-19 12:06:05 +01:00
Kevin Ansfield
180bb72115 Added link and heading id attribute support when rendering lexical
no issue

- bumped `@tryghost/kg-lexical-html-renderer`
2022-09-19 11:42:15 +01:00
Kevin Ansfield
3bdfb68ff6
Added __GHOST_URL__ transform support to posts.lexical field (#15433)
no issue

- bumped `@tryghost/url-utils` to get access to the new lexical transform utilities
- updated the Post model's `parse()` and `formatOnWrite()` methods to transform the `lexical` field contents when reading/writing to ensure any links in content point at the correct place with `site.url` config changes
2022-09-19 11:30:38 +01:00
Sanne de Vries
a6c76dadc3 Fixed missing shadow on hovering edit button in post list 2022-09-19 10:47:27 +01:00
Simon Backx
901a28f3c6
Added link_redirects and members_link_click_events tables (#15421)
closes https://github.com/TryGhost/Team/issues/1912
closes https://github.com/TryGhost/Team/issues/1913
2022-09-19 11:20:36 +02:00
Sanne de Vries
8a5b401795 Removed dash separator between scheduled status and time in post list 2022-09-19 10:04:04 +01:00
Djordje Vlaisavljevic
99f119a1f4
Source attribution design (#15431)
- Updated subscription box design
- Added Source attribution widget to the dashboard

Co-authored-by: Rishabh <zrishabhgarg@gmail.com>
2022-09-19 10:48:24 +02:00
Rishabh
54f848415a Updated stripe checkout session metadata for referrer data
- adds referrer source, medium and url to stripe checkout metadata for later storage
2022-09-19 12:29:22 +05:30
Rishabh
c765c3230e Updated attribution service to handle referrer information
refs TryGhost/Team#1907

- calculates final attribution source and medium using captured referrer information in history
- adds new referrer-translator that goes through available history and based to determine most valid referrer info
- includes referrer url, source and medium in the attribution data for storage
2022-09-19 12:29:22 +05:30
Rishabh
2807a35cb0 Updated attribution script to capture referrer information
refs TryGhost/Team#1906

- captures referrer url and any source/medium param for referrer
- maintains history with latest referrer information when moving around pages
2022-09-19 12:29:22 +05:30
Naz
1b6a24f0d8
🐛 Fixed incorrect API error response message
closes https://github.com/TryGhost/Ghost/issues/15424
refs b9ab1002b3
refs 9210ac7dc7

- When errors were throw from the model layer the HTTP API responses contained misleading information about the error - e.g.:

"message": "Unknown error - TypeError, cannot save post."

- This was due to the error handling code throwing it's own internal error resulting in compete loss of the original Ghost's error context.
2022-09-19 14:52:28 +08:00
renovate[bot]
40df6c3252 Update dependency html-validate to v7.5.0 2022-09-19 07:52:04 +01:00
Sanne de Vries
9cca07ff70 Replaced all classnames referencing stats with analytics
Refs https://github.com/TryGhost/Team/issues/1893
2022-09-17 12:26:39 +01:00
Sanne de Vries
8a5bbad8e3 Updated resources section on post analytics page
Refs https://github.com/TryGhost/Team/issues/1918
2022-09-17 12:21:03 +01:00
Peter Zimon
7e3e4bd36b Fixed number formatting in Publish menu
no refs.

- number formatting (ie. thousands indicators) were missing in a couple of places in the Publish menu
2022-09-16 19:36:39 +02:00
Sanne de Vries
a4ff3e1900 Added resource section to post analytics page
Refs https://github.com/TryGhost/Team/issues/1918
2022-09-16 16:09:54 +01:00
Ghost CI
29e5a91323 v5.15.0 2022-09-16 16:00:36 +01:00
Kevin Ansfield
8b5bd09341 Added Sentry logging of any errors that occur internally in Lexical
no issue

- adds custom `onError` handler that both logs to console (as per default behaviour) and also logs to Sentry with the `lexical` tag added for easier filtering
- does not re-throw so Lexical will attempt to gracefully recover without losing data
2022-09-16 15:13:58 +01:00
Sanne de Vries
a077d4393f Updated post list for newsletters and/or memberships disabled
Refs https://github.com/TryGhost/Team/issues/1915
2022-09-16 14:59:29 +01:00
Aileen Nowak
be45d4ebcf Added post stats service to return total posts in Explore endpoint
no issue

- The explore endpoint needs to expose the total amount of published posts
- To be more consistent, this PR creates a PostStats class which is exposed as `stats` method within the PostService; just like it's done with the MemberService
- Moved existing method to return the date of the most recently published post into the stats service
- Updated the explore service test to reflect the new return property
2022-09-16 13:56:14 +01:00
Kevin Ansfield
79d8e64e9a 🐛 Fixed tag slug not auto-matching tag title when creating new tag
refs 08b099e527

- when the use of scratch values was removed a bug was introduced where only the first character of the tag title was used to set the slug when typing
- bug was caused because previously we were checking against the original `tag.slug` value which wouldn't have been set yet because we were setting scratch values instead
- updated the code to explicitly mark the slug value as being set manually if it's edited directly so the auto-update logic can use that to skip updates instead of comparing against old/unset values
2022-09-16 13:34:48 +01:00
Peter Zimon
04dfa0a9e5 Updated loading animation 2022-09-16 14:22:01 +02:00
Sanne de Vries
e87f468042 Updated email newsletter tracking settings
Refs https://github.com/TryGhost/Team/issues/1914
2022-09-16 13:14:48 +01:00
Kevin Ansfield
ce461aef34 Fixed post/page API requests having incorrect ?include= params
refs 58b0a1b90d

- `buildQuery` in the post/page adapters was recently removed which meant it was falling back to the `EmbeddedRelationAdapter.buildQuery` method which uses the defined Ember Data relationships to build up an `?include=` param
- the Ember Data relationships are not fully in sync with the API because we don't have models for all of the members/tiers related relationships meaning we were adding a more restrictive `?include` parameter than what the API would use internally by default, breaking parts of the app that expected the default embedded relationships
2022-09-16 12:54:50 +01:00
Peter Zimon
9972892259 Updated loading animation 2022-09-16 13:44:58 +02:00
Kevin Ansfield
3b21d26be7
Wired up creation of post_revisions entries when saving posts with lexical (#15422)
no issue

- added `PostRevsion` model
- duplicated `mobiledoc_revision` creation routine in Post model's onSaving hook to create `post_revision` when model's `lexical` field has changed
- updated `mobiledoc_revision` creation to skip when `lexical` field is populated
2022-09-16 11:59:35 +01:00
Kevin Ansfield
48aaa53770 Added lexical editor feature flag
no issue

- adds `lexicalEditor` alpha labs flag and associated toggle in Admin
- when feature flag is enabled the new post/page routes will load the lexical editor instead of the mobiledoc editor
2022-09-16 11:59:03 +01:00
Peter Zimon
e957c6d3a1 Updated Members importer preview table min. height
no refs.

- removed `min-height` of members importer preview table because it caused a weird spacing issue when there were only 1 or 2 columns in the CSV
2022-09-16 11:30:34 +02:00
Kevin Ansfield
1581f439e9
Added post_revisions table (#15420)
no issue

- initially this will perform the same function as `mobiledoc_revisions` but storing `lexical` instead of `mobiledoc`
- naming is intentionally generic ready for later expansions
2022-09-16 10:19:05 +01:00
Simon Backx
f9e5d57f0d 🎨 Added number formatting to members import email
refs https://ghost.slack.com/archives/C02G9E68C/p1663318892246929?thread_ts=1663317382.429489&cid=C02G9E68C
2022-09-16 11:13:12 +02:00
Simon Backx
7a565d4892 🐛 Fixed duplicate error columns in members import error CSV
fixes https://github.com/TryGhost/Team/issues/1911

Kept on creating a new error column when unparsing the error list. So for every error we would create a new column when it was already added.
2022-09-16 11:02:22 +02:00
Peter Zimon
2769578dbd Various Members importer UX improvements
no refs.

- CSV overview table headings were selectable
- spinner on the last screen was confusing: users might think they had to wait for something to finish, but that's not true
- spacings in import confirmation emails were off
2022-09-16 10:50:54 +02:00
Fabien 'egg' O'Carroll
bddb0ba754
Wired up link redirects & tracking (#15418)
refs https://github.com/TryGhost/Team/issues/1910
refs https://github.com/TryGhost/Team/issues/1888

- Uses an in-memory repository for now whilst in development
- Updates the LinkReplacementService to choose the slug
- Exposes a `getSlug` method so we can ensure uniqueness
- Emits the RedirectEvent for use by LinkTracking
2022-09-16 10:42:21 +02:00
Rishabh
87cbcc8f14 Updated copy for newsletter email verification popup
- updates heading copy dynamically based on verification status
- removes quotes around newsletter name
2022-09-16 13:40:44 +05:30
Simon Backx
a7b583050c
Added link tracking to paywall (#15414)
closes https://github.com/TryGhost/Team/issues/1908

### Problem:
- We need tracking on the paywall links in each email. (we cannot ignore them because those buttons are probably gonna have a higher paid conversion attribution than others).
- Currently we only add the paywall HTML to an email when processing each batch. So if we batch an email to 1.000 recipients per 100, we'll generate the paywall HTML 10 times. 
- We cannot replace links in `renderEmailForSegment` because that methods will get called multiple times. We don't want to have multiple redirect instances created for the same link in the same email.

###  Solution:
- Move the generation of the paywall to the `serialize` method of the post email serializer.
- Surround the generated paywall with HTML-comments so we can remove it if required in `renderEmailForSegment` depending on the member segment we are sending the email to.

---

### Before:

**Serialize output:**
```html
<html>
    <body>
        <h1>Generated email header</h1>
        <p>Generated text</p>

        <div>
            <!-- POST CONTENT START -->
                <h1>Post title</h1>
                <p>Content visible for all members</p>
            <!--members-only-->
                <p>Content visible for paid members only</p>
            <!-- POST CONTENT END -->
        </div>
    </body>
</html>
```

To be modified later by  `renderEmailForSegment`:

**Paid members (nothing changed):**
```html
<html>
    <body>
        <h1>Generated email header</h1>
        <p>Generated text</p>

        <div>
            <!-- POST CONTENT START -->
                <h1>Post title</h1>
                <p>Content visible for all members</p>
            <!--members-only-->
                <p>Content visible for paid members only</p>
            <!-- POST CONTENT END -->
        </div>
    </body>
</html>
```

**Free members (paywall _added_):**
```html
<html>
    <body>
        <h1>Generated email header</h1>
        <p>Generated text</p>

        <div>
            <!-- POST CONTENT START -->
                <h1>Post title</h1>
                <p>Content visible for all members</p>
                <h2>Generated paywall here</h2>
                <a href="https://subscribe.com">Subscribe to read the full post</a>
            <!-- POST CONTENT END -->
        </div>
    </body>
</html>
```

### After this change:

**Serialize output:**
```html
<html>
    <body>
        <h1>Generated email header</h1>
        <p>Generated text</p>

        <div>
            <!-- POST CONTENT START -->
                <h1>Post title</h1>
                <p>Content visible for all members</p>
            <!--members-only-->
                <p>Content visible for paid members only</p>
             <!-- PAYWALL -->
                <h2>Generated paywall here</h2>
                <a href="https://subscribe.com/?tracked">Subscribe to read the full post</a>
            <!-- POST CONTENT END -->
        </div>
    </body>
</html>
```

To be modified later by  `renderEmailForSegment`:

**Paid members (paywall removed):**
```html
<html>
    <body>
        <h1>Generated email header</h1>
        <p>Generated text</p>

        <div>
            <!-- POST CONTENT START -->
                <h1>Post title</h1>
                <p>Content visible for all members</p>
            <!--members-only-->
                <p>Content visible for paid members only</p>
            <!-- POST CONTENT END -->
        </div>
    </body>
</html>
```

**Free members (members-only content removed):**
```html
<html>
    <body>
        <h1>Generated email header</h1>
        <p>Generated text</p>

        <div>
            <!-- POST CONTENT START -->
                <h1>Post title</h1>
                <p>Content visible for all members</p>
            <!-- PAYWALL -->
                <h2>Generated paywall here</h2>
                <a href="https://subscribe.com/?tracked">Subscribe to read the full post</a>
            <!-- POST CONTENT END -->
        </div>
    </body>
</html>
```
2022-09-16 10:08:12 +02:00
Peter Zimon
18a251976e Updated Explore section category link
no refs.

- category link wasn't opening in a new window which took users away from the Admin
2022-09-16 07:35:52 +02:00
renovate[bot]
72a08f4901
Update dependency sanitize-html to v2.7.2 2022-09-15 20:21:58 +00:00
Kevin Ansfield
58b0a1b90d Fixed post/page requests in Admin not including correct ?formats param
no issue

- `buildQuery` method in adapters is only used for store `.query()` calls so when saving the formats param wasn't being added meaning we were losing the `lexical` field in the API response
- switched to `buildURL` which is always used
2022-09-15 17:40:45 +01:00
Daniel Lockyer
6f3c18b6f4
Merged v5.14.2 into main
v5.14.2
2022-09-15 17:16:24 +01:00