From 4418a8be25bd9b85ba3a28d324c5b0ad9cda77ce Mon Sep 17 00:00:00 2001 From: emilweth Date: Sun, 31 Mar 2024 04:05:38 +0200 Subject: [PATCH 1/5] fix(dev): fix dev container build --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 60196fc..2def505 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,7 +80,7 @@ ENV APP_ENV=prod ENV APP_VERSION=$APP_VERSION # Development build -FROM base as app_php_dev +FROM frankenphp_base as app_php_dev USER root RUN set -eux; \ From 59fca696939a0dc279f62e492cd7970452b06819 Mon Sep 17 00:00:00 2001 From: emilweth Date: Sun, 31 Mar 2024 04:25:14 +0200 Subject: [PATCH 2/5] fix: now correctly checking if already tracking a thread user --- src/Service/WatchThreadsAccountService.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Service/WatchThreadsAccountService.php b/src/Service/WatchThreadsAccountService.php index 4f8cf52..559efd0 100644 --- a/src/Service/WatchThreadsAccountService.php +++ b/src/Service/WatchThreadsAccountService.php @@ -4,6 +4,7 @@ namespace App\Service; +use App\Entity\ThreadsUser; use App\Entity\Watch; use App\Exception\AlreadyWatchingAccountException; use App\Repository\WatchRepository; @@ -26,24 +27,16 @@ public function addWatch(string $acct, string $threadUserName): Watch $watch = new Watch($acct); } - if ($this->isAlreadyWatching($acct, $threadUserName)) { + $threadsUser = $this->accountCheckerService->getOrCreateUser($threadUserName); + + if ($watch->getWatched()->contains($threadsUser)) { throw new AlreadyWatchingAccountException(sprintf('Already watching account %s', $threadUserName)); } - $watch->addWatched( - $this->accountCheckerService->getOrCreateUser($threadUserName) - ); + $watch->addWatched($threadsUser); $this->watchRepository->save($watch); return $watch; } - - public function isAlreadyWatching(string $watcher, string $watched): bool - { - return null !== $this->watchRepository->findOneBy([ - 'watcher' => $watcher, - 'watched' => $watched, - ]); - } } From 0ab84b2ca1678f2a3f357ee56a4021d01b31b719 Mon Sep 17 00:00:00 2001 From: emilweth Date: Sun, 31 Mar 2024 04:25:50 +0200 Subject: [PATCH 3/5] fix: add missing messenger migrations --- migrations/Version20240331020836.php | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 migrations/Version20240331020836.php diff --git a/migrations/Version20240331020836.php b/migrations/Version20240331020836.php new file mode 100644 index 0000000..d38fb88 --- /dev/null +++ b/migrations/Version20240331020836.php @@ -0,0 +1,46 @@ +addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)'); + $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)'); + $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)'); + $this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$ + BEGIN + PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text); + RETURN NEW; + END; + $$ LANGUAGE plpgsql;'); + $this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;'); + $this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('DROP TABLE messenger_messages'); + } +} From 024ab8a12a299cf9428cf04be19d833586f54008 Mon Sep 17 00:00:00 2001 From: emilweth Date: Sun, 31 Mar 2024 04:27:49 +0200 Subject: [PATCH 4/5] style: cs-fixer --- src/Service/WatchThreadsAccountService.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Service/WatchThreadsAccountService.php b/src/Service/WatchThreadsAccountService.php index 559efd0..7f6b216 100644 --- a/src/Service/WatchThreadsAccountService.php +++ b/src/Service/WatchThreadsAccountService.php @@ -4,16 +4,15 @@ namespace App\Service; -use App\Entity\ThreadsUser; use App\Entity\Watch; use App\Exception\AlreadyWatchingAccountException; use App\Repository\WatchRepository; -class WatchThreadsAccountService +readonly class WatchThreadsAccountService { public function __construct( - private readonly WatchRepository $watchRepository, - private readonly ThreadsAccountCheckerService $accountCheckerService, + private WatchRepository $watchRepository, + private ThreadsAccountCheckerService $accountCheckerService, ) { } @@ -27,7 +26,7 @@ public function addWatch(string $acct, string $threadUserName): Watch $watch = new Watch($acct); } - $threadsUser = $this->accountCheckerService->getOrCreateUser($threadUserName); + $threadsUser = $this->accountCheckerService->getOrCreateUser($threadUserName); if ($watch->getWatched()->contains($threadsUser)) { throw new AlreadyWatchingAccountException(sprintf('Already watching account %s', $threadUserName)); From 198f533a267f00abbea65960951843b95a60a614 Mon Sep 17 00:00:00 2001 From: rivals-bot <165522653+rivals-bot@users.noreply.github.com> Date: Sun, 31 Mar 2024 04:33:14 +0200 Subject: [PATCH 5/5] chore(main): release 1.0.1 (#6) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ composer.json | 2 +- helm/threads-tracker/Chart.yaml | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 11fea0f..7dca81b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"1.0.0"} +{".":"1.0.1"} diff --git a/CHANGELOG.md b/CHANGELOG.md index 542e8a0..3c187db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [1.0.1](https://github.com/rivals-space/threads-tracker/compare/v1.0.0...v1.0.1) (2024-03-31) + + +### Bug Fixes + +* add missing messenger migrations ([0ab84b2](https://github.com/rivals-space/threads-tracker/commit/0ab84b2ca1678f2a3f357ee56a4021d01b31b719)) +* **dev:** fix dev container build ([4418a8b](https://github.com/rivals-space/threads-tracker/commit/4418a8be25bd9b85ba3a28d324c5b0ad9cda77ce)) +* now correctly checking if already tracking a thread user ([59fca69](https://github.com/rivals-space/threads-tracker/commit/59fca696939a0dc279f62e492cd7970452b06819)) + ## 1.0.0 (2024-03-31) diff --git a/composer.json b/composer.json index ee90ece..1b7dd6f 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "type": "project", "license": "unlicense", - "version": "1.0.0", + "version": "1.0.1", "minimum-stability": "stable", "prefer-stable": true, "require": { diff --git a/helm/threads-tracker/Chart.yaml b/helm/threads-tracker/Chart.yaml index dc94385..4ea7898 100644 --- a/helm/threads-tracker/Chart.yaml +++ b/helm/threads-tracker/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: threads-tracker description: A Helm chart for Kubernetes type: application -version: 1.0.0 +version: 1.0.1