diff --git a/app/Listeners/MarkLastActivity.php b/app/Listeners/MarkLastActivity.php index 53d8cd315..aae113333 100644 --- a/app/Listeners/MarkLastActivity.php +++ b/app/Listeners/MarkLastActivity.php @@ -12,6 +12,7 @@ public function handle(ReplyWasCreated $event): void { $replyAble = $event->reply->replyAble(); $replyAble->last_activity_at = now(); + $replyAble->timestamps = false; $replyAble->save(); } } diff --git a/tests/Feature/ReplyTest.php b/tests/Feature/ReplyTest.php index 6cb44db64..f8e57a38b 100644 --- a/tests/Feature/ReplyTest.php +++ b/tests/Feature/ReplyTest.php @@ -123,3 +123,17 @@ $this->assertNotNull($thread->fresh()->last_activity_at); }); + +test('replyable updated_at timestamp is not touched when reply is created', function () { + $thread = Thread::factory()->create(['subject' => 'The first thread', 'slug' => 'the-first-thread', 'updated_at' => '1970-01-01']); + + $this->login(); + + $this->post('/replies', [ + 'body' => 'The first reply', + 'replyable_id' => $thread->id, + 'replyable_type' => Thread::TABLE, + ]); + + $this->assertSame('1970-01-01', $thread->fresh()->updated_at->format('Y-m-d')); +});