Skip to content

Commit

Permalink
Load current revision for talk.edit route
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmile committed Jun 7, 2024
1 parent c2b1445 commit fa26941
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/TalksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function store(SaveTalkRequest $request)
public function edit($id)
{
try {
$talk = auth()->user()->talks()->findOrFail($id);
$talk = auth()->user()->talks()->withCurrentRevision()->findOrFail($id);
} catch (Exception $e) {
Session::flash('error-message', 'Sorry, but that isn\'t a valid URL.');
Log::error($e);
Expand Down
11 changes: 11 additions & 0 deletions tests/Feature/TalkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,15 @@ function archived_talks_can_be_deleted()
$response->assertRedirect('talks');
$this->assertDatabaseMissing('talks', ['id' => $talk->id]);
}

/** @test */
public function editing_a_talk(): void
{
$talk = Talk::factory()->create();

$response = $this->actingAs($talk->author)
->get(route('talks.edit', $talk));

$response->assertSuccessful();
}
}

0 comments on commit fa26941

Please sign in to comment.