Commit graph

139 commits

Author SHA1 Message Date
Oliver Davies cae2091436 build(deps): remove discoverable_entity_bundle_classes
As this module is no longer supported, remove it from the codebase and
update all references to it within the custom code - instead manually
wrapping nodes with the `Post` or `Talk` class, or returning it from a
Repository.

Fixes: #465
2021-12-17 23:05:41 +00:00
Oliver Davies 2a0a2d47fa Rename Action to UseCase
Rename to avoid confusion with Drupal's core Action type.
2021-05-24 22:31:01 +01:00
Oliver Davies 9a88301585 Add a new stub test
Add a new stub test to show that some tags such as "rst2pdf" are not
automatically capitalised when converting a post's tags into hashtags.
2021-05-24 22:23:03 +01:00
Oliver Davies a5e2fcce63 Extract ConvertPostToTweetTest 2021-05-24 22:23:03 +01:00
Oliver Davies 8b040a09a2 Remove the toTweet() method 2021-05-24 22:23:03 +01:00
Oliver Davies 909374edcb Remove references to the toTweet() method 2021-05-24 22:23:03 +01:00
Oliver Davies 7542a2a542 Move the toTweet() functionality
Move the toTweet() functionality from the Entity into the Action.
2021-05-24 22:23:03 +01:00
Oliver Davies 9d1cbdeffd Use convertPostToTweet within the test
Use the convertPostToTweet action within the tests rather than calling
the toTweet() method, and delegate the Action to using the toTweet()
functionality.
2021-05-24 22:23:03 +01:00
Oliver Davies 23cc7cec2d Add the action to PostTest 2021-05-24 22:23:03 +01:00
Oliver Davies 25780e084b Allow for auto-configuring Actions 2021-05-24 22:23:03 +01:00
Oliver Davies 2f24cf7235 Combine hook content back in the .module file 2021-05-22 14:31:12 +01:00
Oliver Davies e9c2f2a2b0 Replace tightenco/collect with illuminate/collections
Fixes #417
2021-04-23 14:51:51 +01:00
Oliver Davies a80de5c738 Revert "Rename config keys for IFTTT and Integromat"
This reverts commit 9a46b63299.
2021-02-25 12:15:43 +00:00
Oliver Davies 9a46b63299 Rename config keys for IFTTT and Integromat 2021-02-25 10:06:35 +00:00
Oliver Davies e50a91dc30 Update queue name 2021-02-24 12:36:38 +00:00
Oliver Davies 7ea2c8991c Remove unused export command 2021-02-11 08:53:16 +00:00
Oliver Davies 0c1321fed5 Add TalkCollection, move logic for getting events
Add a `TalkCollection` which extends Laravel/Tighten's, and add a method
there for getting the events from the talks. This makes this logic more
reusable and also makes the code in the `TalkCounter` service simpler.
2021-02-11 08:53:16 +00:00
Oliver Davies 1f0926ac16 Extract a method for providing default properties and values 2021-02-11 08:53:16 +00:00
Oliver Davies abe0f3d93b Rename getAll to findAll, remove published argument 2021-02-11 08:53:16 +00:00
Oliver Davies afc0a0e448 Inject the TalkRepository into TalkCounter 2021-02-11 08:53:16 +00:00
Oliver Davies 24f1fd5673 Rename HttpPostPusher to WebhookPostPusher
References #340
2021-01-22 09:42:33 +00:00
Oliver Davies 79cffc22fe Add Integtomat implementation of PostPusher
Add an Integromat post pusher and add it to the queue worker so that
posts are pushed both to IFTTT (for Twitter) and Integromat (for
LinkedIn).

References #340
2021-01-22 02:30:29 +00:00
Oliver Davies 7204e2c5e8 Add integromat webhook URL
Add the integromat webhook URL to the Ansible Vault and also to the
generated Drupal settings file that Ansible generates, and the
opdavies_blog module configuration.

References #340
2021-01-22 02:30:26 +00:00
Oliver Davies 69d7d9dca9 Remove old FormatTagNamesCommand
This was a one-time command that is no longer needed, so it can be
removed.
2021-01-14 00:55:13 +00:00
Oliver Davies 322d948c1e Auto-configure the post factory
References #347
2021-01-14 00:45:58 +00:00
Oliver Davies 43455d5ae1 Auto-configure event subscribers
References #347
2021-01-14 00:45:58 +00:00
Oliver Davies 53ab326415 Auto-configure services and repositories
Enable the auto-configuration of service and repository classes,
including support for classes in subdirectories by using
`getRelativePathname()` rather than `getFilename()` and making some
additional changes to the result.

References #347
2021-01-14 00:44:30 +00:00
Oliver Davies 5e9dc48896 Rename methods 2021-01-13 17:56:57 +00:00
Oliver Davies 7e06943be1 Rename event subscriber classes 2021-01-13 17:55:29 +00:00
Oliver Davies 17179fbfe4 Add a placeholder test, mark as skipped
References #344
2021-01-13 08:53:29 +00:00
Oliver Davies 661c26dcec Add query condition for status
References #344
2021-01-13 08:52:51 +00:00
Oliver Davies dee6051cd9 Add route cache context to related posts block
References #3
2021-01-11 02:32:17 +00:00
Oliver Davies a3e8f03cf1 Cache the block, not the render array
References #3
2021-01-11 02:20:17 +00:00
Oliver Davies cca8ed1970 Re-order array by key [ci skip]
References #3
2021-01-11 01:59:31 +00:00
Oliver Davies f404019a39 Add cache tag for the current post
References #3
2021-01-11 01:58:42 +00:00
Oliver Davies 52fa58733d Set cache max age on related posts block
Based on https://www.drupal.org/node/2451555, added a `max-age` value to
the related posts block.

References #3
2021-01-11 01:48:23 +00:00
Oliver Davies 105405e7f9 Display a list of related post titles
References #3
2021-01-11 01:48:21 +00:00
Oliver Davies 6436e3edb3 Generate a new block for related posts
References #3
2021-01-11 01:39:44 +00:00
Oliver Davies 3546ac427a Extract a method to contain the query logic
Group all of the query logic into one method, as this will make it more
readable and this logic is likely to grow.

References #3
2021-01-10 22:38:37 +00:00
Oliver Davies ae0024f335 Return an empty Collection if there are no posts
Return an empty Collection if there are no related posts for the given
post.

References #3
2021-01-10 22:38:37 +00:00
Oliver Davies 059e237600 Prevent duplicate terms being created
Within the `PostFactory` class, ensure that when using the `withTags`
method and creating tag terms that an existing term doesn't already
exist for a given name before trying to create it.

With the previous implementation, there would be multiple terms if the
PostFactory was used multiple times with the same tag name.

Given that `PostFactory` now has a dependency on `EntityTypeManger`,
this has been added as a service within `opdavies_blog_test` and needs
to be resolved from the container before trying to use it within a test.

This commit also updates the usages in `PostTest` so that those tests
continue to work and pass.

References #3
2021-01-10 22:38:36 +00:00
Oliver Davies b90ca42e87 Refactor to use an entity query
Refactor from using `loadByProperties` to using an entity query.

`loadByProperties` doesn't allow for passing multiple values for a
single property such as multiple tags to compare against, and also means
that removing the current node can be done in the query rather than
filtering it out of the Collection.

This might also be a more performant solution if we can do the grouping
and sorting of the results in the query rather than needing to perform
additional steps on the result.

References #3
2021-01-10 22:38:02 +00:00
Oliver Davies d7f3d8c482 Return related posts for a specified blog post
Add the initial code for specifying a blog post and returning related
posts. This includes adding a repository for related posts, and adding
it as a service within the `opdavies_blog` module.

References #3
2021-01-10 22:38:00 +00:00
Oliver Davies 62424d5b04 Add PostTestBase
Add a base test for writing kernel tests for posts, so that it will be
easier to start writing the tests for related posts.

References #3
2021-01-10 22:37:28 +00:00
Oliver Davies 2e94abab55 Add some additional empty tests to fill in later 2021-01-10 20:00:14 +00:00
Oliver Davies bbca137a83 Rename the test method 2021-01-10 19:57:08 +00:00
Oliver Davies 383c0d0fdf Push to IFTTT
References #328
2021-01-10 19:14:24 +00:00
Oliver Davies 790b221646 Save post as sent to social media
References #328
2021-01-10 19:13:00 +00:00
Oliver Davies e617e9984d Return early if the post shouldn't be pushed
References #328
2021-01-10 19:06:37 +00:00
Oliver Davies 73271de39a Move logic for if a post should be pushed
References #328
2021-01-10 19:06:36 +00:00