Commit Graph

21 Commits

Author SHA1 Message Date
Fabien "egg" O'Carroll
3df19235b0 Added support for updating Mentions when Webmentions are resent
refs https://github.com/TryGhost/Team/issues/2535

At the moment we only update the metadata of the Webmention source, so
that we can capture update titles, excerpts, etc... when a post is updated.
2023-02-10 11:43:16 +07:00
Fabien "egg" O'Carroll
78bebc6279 Refactored the assignment of Mention metadata
refs https://github.com/TryGhost/Team/issues/2535

Moving this into a separate method allows us to set the metadata externally from
the Mention entity and keep all of the validation, without having duplicate code
2023-02-10 11:43:16 +07:00
Fabien 'egg' O'Carroll
4e8af72305
Added support for deleting mentions (#16238)
refs https://github.com/TryGhost/Team/issues/2534

As we're using soft deletes for mentions we need to store the `deleted` column
as well as enforce a `'deleted:false'` filter on the bookshelf model. 

We've also implemented the handling for deleting mentions. Where we remove a
mention anytime we receive and update from or to a page which no longer exists.

Co-authored-by: Steve Larson <9larsons@gmail.com>
2023-02-09 17:29:13 +07:00
Steve Larson
6c97edec25
moved sending mentions to job (#16234)
refs TryGhost/Team#2523
-implemented jobsService within mention sending service
-updated tests so we don't need to sleep
2023-02-08 16:29:12 -06:00
Ronald Langeveld
e02c67dd3a
Mentions ordering (#16215)
closes https://github.com/TryGhost/Team/issues/2498

- can now order mentions via the API via params eg `api/admin/mentions/?order=created_at%20desc`.
2023-02-02 13:25:09 +08:00
Steve Larson
855bcb8613 added tests to cover internal data checks
no ref
-tests didn't cover imported data escape
-tests didn't cover internal data escape
2023-02-01 17:40:29 -06:00
Steve Larson
3186323663 updated listeners in test to be fully inclusive
no ref
-test wasn't previously updated to include all event listeners
2023-02-01 17:20:24 -06:00
Steve Larson
ae92d1425d
updated events that send mentions (#16219)
refs TryGhost/Team#2477
-removed post.edited as it was too inclusive
-changed to post.published, post.published.edited, post.unpublished
-blocked import and internal data from triggering mentions
2023-02-01 16:49:58 -06:00
Fabien "egg" O'Carroll
72d7580461 Added source_is_ghost flag to outgoing Webmentions
This is a pretty simple way for us to track which webmentions are sent
by Ghost. Although it's easily spoofed, so are other approaches like
using a header (e.g. User-Agent). If we find that this data is being
spoofed we can look at different approach.

Becuase our receiving implementation stores the payload of the
Webmention, we'll be able to know inside Ghost which Mentions
originated from another Ghost installation, which is useful for stats
and gives us the possibility to display that information in the feed.

Longer term we might want to consider storing this data in a separate
column for Mentions, rather than the `payload` column - but that is
outside the scope of this change.
2023-02-01 13:44:55 +07:00
Steve Larson
a3064d95cb
completely blocked external requests in Webmentions tests (#16186)
no issue
-had timeout issues in test suite
-tests were still doing dns lookup via external request
2023-01-25 10:43:57 -06:00
Ronald Langeveld
dd74f42376
Added mentions email notifications (#16170)
closes https://github.com/TryGhost/Team/issues/2429

- sends email notifications to staff users when their site receives a Webmention.
- currently behind a flag, that can be toggled in the labs settings.
2023-01-25 21:10:29 +08:00
Fabien 'egg' O'Carroll
33ebe971f8
Added BookshelfMentionRepository implementation (#16156)
fixes https://github.com/TryGhost/Team/issues/2418

This stores the received webmentions in the database.

Co-authored-by: Simon Backx <simon@ghost.org>
2023-01-20 14:32:50 +01:00
Simon Backx
8c9893e568 Improved MentionSendingService timeout
no issue

The current timeouts were unreliable.
2023-01-20 11:46:18 +01:00
Steve Larson
8895d22602
Added mention discovery service (#16154)
fixes https://github.com/TryGhost/Team/issues/2407

The MentionDiscoveryService fetches mentioned sites to return the webmention endpoint.
2023-01-20 11:45:48 +01:00
Simon Backx
a596acf7d2
Added MentionSendingService (#16151)
fixes https://github.com/TryGhost/Team/issues/2409

The MentionSendingService listens for post changes and sends webmentions
for outbound links in the post.
2023-01-19 17:35:10 +01:00
Fabien "egg" O'Carroll
4215786bf1 Improved internal types for the Mention entity
This makes development a little more streamlined, and helped catch a wee bug!
2023-01-19 19:25:19 +07:00
Fabien "egg" O'Carroll
3a0e0831ec Updated Mention entity validation of properties
Based on a discussion in slack we want to make all metadata properties optional,
with the exception of the title, which will default to the host of the source
URL if it's missing.

This is so that we can accept as many webmentions as possible and convert them
into Mentions. If we were to have strictly validation, we'd end up having to
drop webmentions that didn't match our criteria, and lose important data.

Giving the title a default allows us to provide a consistent UI experience too.
2023-01-19 19:24:07 +07:00
Fabien "egg" O'Carroll
743da542d0 Wired up the Webmention receive endpoint to the Mentions service
refs https://github.com/TryGhost/Team/issues/2419

This is the initial stab at having everything wired up, we're not
using a queue but we are handling the processing of the Webmention
asyncrounsly so that the HTTP response can be end immediately.

We've also laid the groundwork for extending and implementing the
correct processing of Webmentions, for example checking if the target
URL exists in the system, pulling out the metadata from the Webmention
source and fetching any internal resources.
2023-01-19 18:41:49 +07:00
Fabien "egg" O'Carroll
560d168169 Added site title and author to Mention entity
refs https://github.com/TryGhost/Team/issues/2435

We've made these fields optional, and we may need to extend this to other fields
too as we discover more about the data we're able to get access to.
2023-01-19 18:41:49 +07:00
Fabien "egg" O'Carroll
1babf6126a Added initial basic Mentions implementation
refs https://github.com/TryGhost/Team/issues/2416

This extends the mock API to use a more formal pattern of moving our
entity code into a separate package, and use the service/repository
patterns we've been work toward.

The repository is currently in memory, this allows us to start using
the API without having to make commitments to the database structure.

We've also injected a single fake webmention for testing. I'd expect
the Mention object to change a lot from this initial definition as we
gain more information about the type of data we expect to see.
2023-01-17 17:01:20 +07:00
Ronald Langeveld
e55405691a
Added webmentions package (#16133)
refs https://github.com/TryGhost/Team/issues/2408

- Added webmentions package 
- Setup basic folder structure, controllers, repositories & services to
get started.
- note package haven't been published yet
2023-01-17 13:18:16 +08:00